

This behavior starts at relatively low baud rates, so perhaps the safe upper limit in the standard Arduino Serial bitrates is just 19,200. When A is sending (the SoftwareSerial component is supposed to be receiving), we get complete garbage. the SoftwareSerial component is transmitting), all is well. The window on the left is connected to B, the one on the right to A. Here’s what I got (click to enlarge): SoftwareSerial issue demonstrated Adjust the monitors to the same baud rate as in the Arduino code (57,600 in this case), and send strings back and forth to see what you get. You’ll need two serial monitor programs, one for each Arduino – I suggest my own Serial Monitor Deluxe -). Now, connect the RX/TX pins of A to pins 2/3 of B, and connect both Arduinos to the PC.
#Software serial library software#
This simple code echoes whatever it gets on the hardware serial to the software serial, and vice versa.

Upload an empty sketch to A (just the setup and loop functions, with nothing in them). The easiest way to achieve that is to get two Arduino boards ( NOT leonardos – these treat serial communications differently). For completeness, the test should be done twice: once with the SoftwareSerial as listener and once as transmitter.

To demonstrate the problem, we need to construct a communication cycle: send known data through a SoftwareSerial connection and see what we get on the other side. This is not some improvised hack by a nobody from nowhere SoftwareSerial is one of the few libraries that come built-in with the Arduino IDE itself! The details of how I discovered it are less interesting – something didn’t worked, I investigated, voilà – but it almost cost me a job with a client, hence my anger and almost total lack of trust in libraries. Here’s how you can see that for yourself. In me previous rant, I mentioned that even Arduino’s own SoftwareSerial library suffers from issues that make it unreliable.
