0
\$\begingroup\$

I am trying to build a "daisy chain" using several Arduinos and MAX485 transceivers. All boards have a temperature sensor attached to it. A 9V battery supply all boards in the chain.

I am trying to figure out a way to identify the physical location of the different boards in the daisy chain, for example, boardA = first, boardD = second, boardB = third, etc.

I could do this manually by being aware where I connect each board in the line. However, this is prone to human error and I want to do this automatically. Besides, I will like to take boards randomly to build networks whenever and wherever I want.

In order to identify the boards in the network I could create a query loop in the master board to call all possible names and get an answer of those boards connected. What I am looking for is also an answer of where they are located in the network.

I was thinking to measure voltage/current drop as an indicator of how close/far they are from the master. However, I am not sure if the drop is big enough or the ADC in the Arduino is accurate enough.

I guess someone has thought about this before, maybe there even are ready-made chips for this. I am not an Electronic Engineer, sorry for my limited knowledge.

Edit, 2018-10-14

More clarification; say that you have the following example:

Bus topology example

All the slave boards are set to “listen” mode and wait to be called by the master. The master run a query loop to identify which slaves are on the bus. It asks for A,B,C,D,E, etc. The slaves will verify the call of the master. For this to work, I will have to assign an unique name/address in software to each slave, which is totally fine.

What I want to avoid is to check the name of each slave when I am placing them in the field. Therefore the need to figure out their relative position in the bus line with respect to the master and the other slave boards.

Is this something similar Maxim DS28EA00? Note that it is not only temperature that I am interested. I use temperature sensors as my proof of concept. I could used it to measure pressure, acceleration, etc.

@Transitor In this case daisy chain = party line or bus topology. I don’t know if I can connect the RS-485 in series. If so, could I collect the name of each device as the data goes across them? This has the disadvantage that if one slave board dies, the rest of the line does too.

From TI RS-485 Design Guide

TI RS-485 Design Guide

@stark Can you elaborate more the digital pin idea? Note that all boards are separated between 1-3 meters.

@Andy aka Can you elaborate more? Could this work in bus topology?

@TimWescott It is a bus topology. Maybe I used the daisy chain term wrong? Is it possible to do a true daisy chain with RS-485?

\$\endgroup\$
  • 1
    \$\begingroup\$ Please edit your question to explain if the devices are connected in parallel on the network or serially. If the data is passed through each device in series then it is possible to auto-address them. If not then you have to add some means of setting a unique address on each. \$\endgroup\$ – Transistor Oct 14 '18 at 12:06
  • \$\begingroup\$ Can you use the digital input pins? Have two connectors at each station. Second is hardwired physical location. \$\endgroup\$ – stark Oct 14 '18 at 12:06
  • \$\begingroup\$ Construct a signal that represents the physical location; make that signal available to each slave; read the slave data; interpret the location. \$\endgroup\$ – Andy aka Oct 14 '18 at 12:08
  • \$\begingroup\$ RS485 implies a bus, to me. Is it a bus, or a true daisy chain? (I.e., in a bus, all the transceivers are connected to the same pair of wires. In a daisy chain, each processor has an "upstream" port and a "downstream" port and handles communications between ports). \$\endgroup\$ – TimWescott Oct 14 '18 at 15:45
  • \$\begingroup\$ (almost seriously) attach a videocamera to each device and a bar code in front of it. Simplify the system if you find simpler way to read things from environment that is not prone to errors. \$\endgroup\$ – Gregory Kornblum Oct 14 '18 at 17:35
1
\$\begingroup\$

It is a bus structure. By definition is does not matter where each device is physically placed.

If you need geographical addressing you could try this approach:

  1. Connect the master node at one of the ends of the bus

  2. Each node must have an extra wire (ie. one input and one output wire) that goes to its neighboring nodes (a simple GPIO will do).

  3. When that wire has a specific (default) state - the node stays silent and ignores all traffic.

  4. At power-on each node does not have an address. The master pulls the extra wire low (or high) enabling the first node on the bus. Sends a "set address" command on the bus (that does not have a destination address) - of course only the first node acts upon this message.

  5. The master sends a "enable control line" to node 1 (that now has an address), this makes node 2 listen to the bus.

  6. The master sends again a "set address" command (that is ignored by node 1 - because it has an address already) that sets the address of device 2.

  7. Rinse and repeat for all nodes.

\$\endgroup\$
  • \$\begingroup\$ Great idea! No extra hardware, just one more cable. 1) Do you think that the distance between the boards could be a problem for the GPIO signal? 2) In step 5, do you mean the master tell node 1 to set the GPIO connected to node 2 to low (or high) and the master set high (or low) in the GPIO to node 1? Again great answer, I have to try it. \$\endgroup\$ – Gabriel Oct 16 '18 at 10:48
  • \$\begingroup\$ 1. If it is a slow GPIO the distance should not be a problem. Just take care to protect the input and output somehow (eg. resistors), because otherwise noise from the cable can couple to your Vcc (via built-in ESD protection diodes). 2. In step 5 I mean that the master tells node 1 to enable node 2 control line, then configures address of node 2, then tells node 2 to enable the control line of node 3 etc. You can implement the logic in various ways eg. "ignore all" or "accept any address". \$\endgroup\$ – filo Oct 16 '18 at 11:10
0
\$\begingroup\$

Look for 1Wire if you are interested in measuring temperature, with a lot of sensors here and there! https://www.maximintegrated.com/en/app-notes/index.mvp/id/148 It is not RS485 but easier to implement. And use a small program to enable each 1Wire node one by one and read its ID, then you have a table of physical Ids versus logical ones, of course you can do the same with RS485 but you will require more wires! In this case you should have a small circuit beside each sensor so every time you power up your circuit such explained table is built in the master.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.