At home I have a need to measure temperature and control various circuits in response to those temperature changes and other inputs. The sensor network needed to span at least 100m and ideally should have the ability to reach out to 200m (so I could get down to the Chicken Coop and pool). Looking around the internet it appeared the RS485 standard would do this.
I found on AliExpress the store RobotDyn which appeared to good reviews all round and I couldn’t find a bad word about their boards anywhere.
So I ordered from them several Arduino Uno boards plus sensors and relay boards – took about 4 weeks to turn up. Note: In Australia a genuine Arduino Uno board costs around $15 each plus delivery, the same thing from this supplier was around $4 delivery inc. Yes, it takes 4 weeks to turn up, but I wasn’t in any great hurry. BTW the RS485 interface boards cost around $1.5 AUD each – nice.
So once I had the boards I set up a test rig to get a proof of concept off the ground, the set up was as follows:
- 1 EtherTen to ‘head’ the network, this was connected to a RS485 interface board.
- 1 Arduino Uno clone connected to the RS 485 interface board and to a temperature sensor.
- The two RS485 boards wired together on the A and B channels.
- Both Arduino’s powered from the lap top.
My design was based on several resources I found:
- Arduino RS485 primer and details.
- Nick Gammon’s RS485 Library with error checking.
- The DHT11 library
Basically what I did was put the RS485 Master on the EtherTen, and RS485 Slave on the Uno, then I ‘split’ the DHT11 example down the middle using a C struct to form the message to send back containing the temperature measurements.
You can see the prototype running in the above picture. The top left window shows the temperature output as read via RS485. You can just see the Red LED’s on the RS485 boards showing they are powered.
BTW: If you are wondering what the black tape on the laptop is doing, this Viao has a rather annoying WiFi on/off toggle right on the front, which with age has become rather unreliable – hence the tape to ensure it always remains on.
- The clone Arduino Uno has a ‘bug’ – if you upload a program to it, it runs fine, but unplug and replug the USB, it seems to get confused and not run the program you upload. Yet if you power it from the power jack, it works fine…
- The clone Arduino uses a cheap USB interface chip, the CH304G; you need to install a specific serial driver to get this to work, see this page .
- Be very careful on your power wiring, each RS485 should be powered via 5v from its respective Arduino, yet they must shared a common 0v line – that is the line in the middle of the board with all the black wires coming off it.
I want to get this running off a separate power to the laptop and make it possible to query the EtherTen via its Ethernet connection. A few things I need to resolve first:
- 0v on my power supply, is not the same as 0v on my laptop – there is a 50v difference.. Now this might just be things ‘floating’ as the power supply wasn’t under load – but I need to be very careful about this. My ‘lab’ power supply is an Altronics power supply kit which I built which I’m quite sure is floating.
- Making sure the DHT11 library will work fine with multiple sensors on the one Arduino.
- Adding a sensor and controller addressing scheme.