How long a wire can you use to connect two arduino's before you get data loss?

I have two ardunio megas connected via serial3 and the grounds are connected. Everything works fine with short wires (about a foot) however I need this to work over at least 300 ft. Should I add a transistor to the serial lines or will it be ok? If I need a transistor how would I go about getting the correct voltage out of it?

You might be able to use a high power line driver or buffer, but if you need to add an external device, I would use RS485 transceivers. They are easy to connect, relatively inexpensive and will be reliable.

It all depends on:

  1. The quality (and type) of wire
  2. The communication speed
  3. The communication style
  4. The voltage levels used.

All wires have capacitance, inductance and resistance. These combine to create a low-pass filter. The longer the wire, the lower the cut-off frequency. If the frequency gets too low, then it will interfere with the cleanliness of the signal.

Cables are also subject to interference. Differential signaling (RS-485, for example) goes a long way towards alleviating this.

The resistance of cables also causes the voltage to drop. If the voltage drops lower than the receiver can reliably cope with, then it won't be able to receive the data properly. Increasing the voltages (RS-232, for example) used helps to combat this.

You can use a simple pair of MAX-232 chips to convert your TTL signals into RS-232 signals at +/- 12V, which will give a much better distance. If you are in a noisy environment (lots of industrial machines, etc) then using RS-485 is a must. There are MAX chips for that too, but it is harder to set up that RS-232.

TTL signals over long distances just won't work. They are too low voltage.

best way is to test it and see, i tested a 45m run 1mm stranded wire, screened worked fine, i was switching 0v's, i measured a 5v, and i got 4.98v out the other end, id use a 100m run of cat5 screened to guard from interference.

Thanks all for your replies. To clear things up some I will post some extra information. This will be used across an empty field (it is a remote fireworks launcher) using probably 16-20 gauge braided wire (whatever my friend said he could find free from his work). The baud rate is set to 4800 which I believe is as low as it can go. As far as communication there is nothing fancy just straight and Serial.write commands that send an integer, then a verification code, then the same integer of the firework to launch. The arduino used as a transmitter will be running off usb and the reciever arduino will be run from a nine volt battery.

I should clarify that I am a programmer who occasionally does electronics like this. But my electrical skills aren't fantastic. What I think (correct me if I'm wrong) I need is to use the MAX-232 as suggested by majenko, but I'm not sure how I would go about wiring this with my setup. Can someone please clarify how to make the MAX-232 work. I looked at RS-485 but honestly I didnt understand it at all sorry, can someone explain if I need this in an empty field and how I could use this also if I did?

You would use it the same, except the rs485 lines will have a pair each, so instead of one wire send or receive it will be one pair send or receive so for bidirectional signaling you need two pairs, but if your just gonna be sending codes and don't need confirmation or any data back then one pair is enough

300ft, I'd say RS-485 is the only way to go. RS-232 may work but it wasn't designed for that distance.

Of course there are extra wires but the transceivers are actually easier to set up because you don't need the capacitors that most 232 drivers use.


I stand by my earlier recommendation for RS485, but do you really need 4800 baud?

For fireworks, I assume at most you will do things a few times per seconds and you don't need to transfer much information. You can probably bit-bang it at 100 baud with no line driver. For reliability and noise immunity I would use 2 differential lines i.e. Pin1 High & Pin2 Low = 0, P1 Low & P2 High = 1, Both Low or High = idle. The receiver just polls the lines at a fixed time frame. If you need bidirectional comm, you can use open-drain configuration with a pull-up. Then either end can pull the lines low.

Especially since its an open field with probably no interference it may work

FULL RS232 (+/- 12V) Will work with twisted pair wires (Important that there be about 3 turns/meter) on a 100 meter link in an open field and should work well. In a noisy environment the lower impedance (higher current) RS485 true differential signalling is really required although for small runs '232 might work, both use 'differential' signalling. The RS232 does so by using a 24Volt supply (+/- 12V) and the RS485 with a 5V much higher current type of true differential signalling (RS232 Can be grounded, RS485 usually isn't except in VERY high noise environments the RS485 ground is usually a split pair of 100 to 220 ohm). Neither one sends 'clock' data, rather requiring a uart (Universal Asynchronous Receiver Transmitter) to extract the data from a clock generated locally (thus some of the issues about crystals vs resonators for timing accuracy at high data rates). Both methods require a uart, one (RS485) requires a special driver (true differential) and the other (RS232) requires only a level shifter (RS232 Can be used directly to drive a 5V uart input with a current limiting resistor and a diode to clip the -12V excursions of the input signal... like the Picaxe) but isn't recommended... for anything but local 'low noise' twisted pair applications. Once Again IMO


For fireworks (and other pyrotechnics) you need to keep safety in mind. That means reliable communications and a way to "make safe" by killing power.

I have a system that would solve this that I used for another project. I used MAX485 chips and some voltage regulators with cat5. Send data over one pair, enable (with a manual key switch at the control end and a relay at the launch end. Supply power via the last 2 pairs (combine one for 12V+ and the other for Common.

At the launch end the 12V gets regulated down to 5v for the Arduino and maybe used to light the fuses, I am not sure on the current needed for that. The enable relay is wired such that the power to the launch fuses is cut with out that enabled. You could also have the Arduino monitor that signal but you still need the relay for safety.

I would also use a charge pump. They monitor a pulsed output from a mcu to make sure it is still running its program. The way I would do this is your Arduino at the control end needs to send a code on a regular interval. The Arduino at the launch end receives this code and pulses an output pin. That pin feeds the charge pump. If the pulses stop for any reason, the charge pump kills power to the launch fuses. An example of a pre built safety

The charge pump (External Watchdog Timer) sounds like a great idea. However it does require extra components. If you created a routine that every 100 ms or so asked the remote Arduino to send a response by perhaps echoing the last command sequence to your local controller you could prove the comm link and the remote controller were operating properly. The remote device could also return local temperature and battery voltage as well… All for a few extra lines in a sketch. A Squib (Device for “Igniting” a pyrotechnic device) will draw .5 to 1A… Local Battery for ignition is a must and should be a part of a watchdog timer associated with the remote controller. If or when there is a problem with the remote controller this timer should shut down the Squib Power source, unconditionally and use a pair of wires that are separate from any other function to Unconditionally indicate problems with the remote controller. I wouldn’t recommend running any kind of supply power on Cat5 wiring. If the wires are split into a pair consisting of 3 wires each the resultant (for 24Ga wire) is about the equivalent of 18 Ga Zip cord (lamp wire) and probably 10 to 20 ohms of dc resistance. As to the choice of RS232 Vs RS485 there is little difference in a 100 meter run between the two, both are specified for that distance and the +12V / -12V excursions were done just for long wire runs. This is why the RS232 protocol uses a bi-polar 12V supply and will work well when the available voltage at the end of a long wire run is in the order of 7 - 8 volts and why it is possible to connect a “Full RS232” device to a TTL input and have data exchange, remember the Picaxe?, it interfaces well with a “Full RS232” device with the protection diodes internal to the chip and a current limiting resistor, the rx data just uses a voltage divider. So apparently the RS232 sensing protocol was designed to sense less than +/- 12V (actually about 4 volts). In all the BS above I am not trying to say that the RS485 comm protocol isn’t the best method, it is, BUT it is best with wire runs from 500 meters to 1 KM (at normal to medium < 1 Mhz) baud rates). The drawback is that it requires regular RS485 transceivers, different code and Proper termination at both ends of the wire… Again read the data sheets… carefully and read the IEEE specifications for each comm protocol, Don’t EVER guess especially where human safety is involved and whenever and where ever you design a device… of any kind it is a very good idea to totally understand the components, their required uses and how best to use them. It is as common a fault in many to over engineer from a lack of knowledge as it is to engineer properly and have the user exceed the stated specifications of the device.
Or stated differently pseudo differential RS232 works because of the extremes of applied voltage, True differential RS485 use a different comm protocol and they can be grounded… it takes a pair of 220 ohm terminating resistors in series placed across the comm bus the center connection is grounded, the ground helps to eliminate non common mode noise pick up. RS485 comms that cover any distance at all (>100 Meters) should also have pull-ups on them to increase both to noise rejection and to improve data transmission speeds. The methods I describe here were things I did about 20 years ago (1992-93) and while it is possible/likely that things have changed, I really doubt that the changes are very big if at all. Again in my direct experience and Strictly IMO


Edited, for an 2 errors and a couple of typo’s… Doc

OK I just want to say thank you to everyone for your help and I got it working, using 20 gauge speaker wire that I twisted, over 200 ft without having to use any RS232 or such. However I did notice at one time that I had to send a signal twice because it didn't register it the first time so I would definitely say this is about the furthest range I would go with no modification to the signal. I did change the baud rate to 100 which I think is why I was able to get away with this. So for now I'm just going to leave it however I will definitely use your suggestions if I need to use a longer cord for bigger shells. Thanks everyone!