Wire.h serial interference - only SoftwareSerial?

I've currently got an Arduino Uno, which uses the hardware serial for an XBee module, and uses wire.h to communicate with a magnetic position sensor. I'm trying to add a CH376 to act as a USB stick reader. As the hardware serial is in use, I've tried using SoftwareSerial to do so. Following the implementation of this, the magnetic position sensor now gives inconsistent results. At one position, for example, it'll give a readout of 3380, then one 360-degree rotation later, it'll give a readout of 3390 at the same position. However, for this application precision is important.

I've read that the wire.h library and softwareserial don't get on. So I tried using AltSoftSerial, but this did not resolve the problem either. Given that the hardware serial device and magnet sensor have worked well together for over 2 years, I suspect that wire.h may not have an issue with hardware serial ports. Is this correct?

If so, then I'll upgrade the Uno to a Mega and use the ports on that. Either that or SPI (the SPI ports on the Uno are already in use).

Yes, there should not be any issue with a hardware serial.

Software serial is very time critical and I would recommend to avoid it unless you develop a very cheap product with millions of units. There are plenty of Arduinos with more UARTs available and some of them are even cheaper than your UNO.

Thanks for the reply. I upgraded to an Arduino Mega, and that partially resolved the problem. Turned out that the attachment on the stepper motor - not the magnet, but the bit it was aligning - was slipping on the driveshaft. A drop of CA fixed that issue.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.