0

I'm building a single master multiple slave RS485 network for remote sensors on test equipment. I have the hardware built and working, and I can do a Serial.print on the master and have the slaves display the values received on their attached OLED screens. The goal is for the master to cycle through the slave addresses one by one and request data, then wait for the slave to respond (or timeout and register as a fail on the master's GUI).

The issue I have is that to work out if a packet is intended for a slave device I have to parse the entire packet, wait for start and end packets, and check the address. This means every device has to capture and check every packet on the network for its own address byte. If I compare on the fly I can exit the serial loop as soon as I know which device the packet is intended for, but the next received packet will just re-open the serial loop part way through transmission.

Other than disabling the RS485 transceiver between packets, is there an elegant way to solve this issue without massive overheads?

My hardware uses Arduino Nanos (master is currently an Uno but will be a piece of National Instruments hardware) and MAX13487 transceivers.

Thanks!

  • Have you looked into BACnet / MS/TP (Master-Slave/Token Passing) or TDMA (Time Division Multiple Access) protocols? I don't know enough about your project to recommend one or the other. – StarCat Feb 24 at 15:53
  • @StarCat Those look like they'd help avoid collisions, but I'm not so worried about that. I'm not sure they avoid the slaves having to listen for a request packet destined for them. – Joe of Loath Feb 24 at 16:18
  • Are you using modbus? – haresfur Feb 25 at 4:17
  • @haresfur no, should I be? – Joe of Loath Feb 25 at 10:05
  • RS485 is the hardware layer and MODBUS is a software layer for communicating over RS485 that is commonly used for sensors so it may have done some of the heavy lifting for you. I don't know enough to say if it will help or not. – haresfur Feb 25 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.