I have an idea that I could keep a number of Arduinos in sync if I could have one of them send a pulse to the others at regular intervals - I suspect 10 pulses per second would be more than enough, maybe only 1 pulse per second would be needed.
At its very simplest I just need to set the master as OUTPUT and send a short HIGH-LOW pulse and set the others as INPUT on one of the external interrupt pins and string a piece of wire (and GND of course) between them.
What I don't know is what length of wire is feasible - I think I need about 15 metres. Or whether the system would be hopelessly confused by noise picked up by the wire.
Would twisted-pair wire improve matters? Or the sort of co-ax that is used for microphones?
Its dirty, but at that distance 10hz should be fine on twisted pair, go for shielded if you can.
If it starts being problematic try putting a comparator onto the inputs to clean up the signal a bit (actually, since you're multidropping, a comparator at each node would make sense anyway).
What is the source of the noise? Impulse noise like big DC relays clicking on and off might be the worst. White noise (radio frequency interference) may not be a big issue.
For most uses, I would say that 15m won't need any special treatment. Just a basic piece of 'bell wire' (speaker wire, figure 8 or 2-conductor wire) would do just fine for that.
RS485 is only needed when you get to hundreds of feet inside an industrial plant with big motors, solenoids etc. and your data rates go over 9600 baud. 1-10 baud should be no problem.
Robin, 15m should not be a problem for "any" wire like e.g. telephone cable for your needs. A time ago I found "1-wire Design Guide v1.0" on internet. There is detailed description of an action inside of wire. I think it is applicable not only for 1W and in any case it worth for reading.
Thanks for all the replies. I really wanted to be confident that it could work at longer range before I start experimenting with short range - all the Arduinos on the same table.
I don't want to use wireless because of possible latency. I want to create a single pulse that will raise an interrupt on several Arduinos at the exact same time.
Robin2:
However from a brief read it is not clear if I must send serial data over an RS485 link or whether I could just send a simple
digitalWrite(pin, HIGH);
// some interval
digitalWrite(pin, LOW);
RS485 addresses the problems of sending a digital signal over long cable runs (up to a kilometer or more) with multiple drops. It doesn't much matter whether that data is a serial sequence or pulses. It certainly is the safest approach to your problem and is what I would do if I had one chance to get the application running in a harsh environment.
knut_ny's picture in post #6 illustrates one of the hazards of signalling over long cable runs, that is, ringing due to improper termination manifest as undershoot on the falling edge of the signal. If, for instance, one were edge triggering on the received signal, this could be a problem. A termination resistor at the far end of the cable would help suppress that effect.
rs-485 is fine, but don't try to hard-wire tx-enable to 'active' on for the 'master' transceiver; youll likely fry the transceiver IC if you do. not all material published for rs-485 makes this risk clear.
Hi,
Twisted pair with typical PVC insulation has an impedance of about 100 ohms. At distances of tens of meters there will be signal reflections on the lines causing under and overshoot as shown:
(Thanks knut_ny )
This can be improved a lot by "Back Matching" your twisted pair (AKA "Transmission Line"). Use a 100 ohm resistor in series with the sending Arduino output. You can also parallel 2 or 4 Arduino outputs for more current capability (but use I/O in the same register and use register commands).
The receiving Arduino has a threshold voltage and a little hysteresis that should receive OK..
I will probably try some table-top tests in the next week or two but it could be a few months before I need to do any long range tests. And I think I will just go with rs485 for the certainty it gives.
One other question that I probably should have mentioned earlier. I presume it won't make any difference if the cable is divided into a few segments with interconnecting plugs. Something like this.
And I think I will just go with rs485 for the certainty it gives.
If you only require to transmit a sync pulse, don't overlook the Schmitt Trigger Logic Output Otocoupler option. Very fast, lower cost than rs485, higher reliability (IMHO). Complete isolation.
Well if you want to lean toward perfection, you could send the signal out on 15 cables (pseudo star configuration) for 15 Arduinos, all cables the same length.
The slack in a cable at an Arduino is simply role up.
Robin2:
I have an idea that I could keep a number of Arduinos in sync if I could have one of them send a pulse to the others at regular intervals - I suspect 10 pulses per second would be more than enough, maybe only 1 pulse per second would be needed.
At its very simplest I just need to set the master as OUTPUT and send a short HIGH-LOW pulse and set the others as INPUT on one of the external interrupt pins and string a piece of wire (and GND of course) between them.
What I don't know is what length of wire is feasible - I think I need about 15 metres. Or whether the system would be hopelessly confused by noise picked up by the wire.
Would twisted-pair wire improve matters? Or the sort of co-ax that is used for microphones?
All suggestions are welcome.
...R
I have a vision of the Borg! What will your slave units do when they don't get the sync pulse?
Paul_KD7HB:
I have a vision of the Borg! What will your slave units do when they don't get the sync pulse?
They will just keep going and probably drift out of sync.
But the whole purpose of this Thread was to get advice about how to avoid that problem
dlloyd:
If you only require to transmit a sync pulse, don't overlook the Schmitt Trigger Logic Output Otocoupler option. Very fast, lower cost than rs485, higher reliability (IMHO). Complete isolation.
I don't see any reference in the documentation to the distance over which the signals can be delivered reliably.
LarryD:
Well if you want to lean toward perfection, you could send the signal out on 15 cables (pseudo star configuration) for 15 Arduinos, all cables the same length.
The slack in a cable at an Arduino is simply role up.
.
If you roll up (loops of) the wire then you make an inductor that will make your nice sharp pulse edges warp and maybe delay the pulse as well... I'm not sure about the latter. Make no loop!