Last night I got the three primary zone circuits instrumented and connected to the Arduino. I also have the two thermistors working but I have yet to run the outdoor sensor through the house wall. All this has been done with USB communication to the Arduino siting on the floor of the furnace room.
It was therefore time to run a serial cable to my Linux file server one floor up from the furnace room. My recent experience with RS-232 over long runs pushed me to an RS-485 solution.So I pulled out the Sparkfun RS-485 boards I purchased a while back for the lightning detector. I had discovered a problem with their implementation. As delivered the boards are useless for multidrop communication, but will work just fine for a single point to point communication channel.
I make up a cable harness and connected the CMOS logic to RS-485 converter to the RX/TX pins on the Arduino, and I used the Arduino D13 logic signal to drive the RTS pin on the converter. I then went to upload a new sketch to the Arduino and it failed to load.
At first I figured I had swapped RX and TX and therefore I was screwing up the bus, but a careful survey indicated I had connected it up properly. So I un-soldered the RX and TX pins and verified that I could upload. So next I connected the Arduino’s transmit pin to the converters receive. That worked as well. As soon as I did that I realized my problem.
I have bus contention on the Arduino’s receive line. Both the USB UART and the RS-485 converter are trying to drive the Arduino RX line. This garbles the communication and prevents a good upload. So what to do?
Well I could use one of the bit bang serial port libraries available to avoid the problem. But I really do not want to give up two GPIO pins when I already have two designed for serial communications. The easiest solution will be to put in a mechanical switch to isolate the RX/TX lines during programming. That switch can be inserted into the cable harness and mounted inside the enclosure so it can’t be accidentally flipped.
For a moment I wondered if I could program the Arduino over RS-485. But mu guess is no. The Arduino IDE does not likely support the mono directional RS-484 format. Oh well.