I'm building small project where I need to connect a few sonar sensors to an Arduino. Each of these sensors are connected via 3 wires to the arduino. My problems is that I need to place these sensors quite far from the main box, and since they need to moved easily I would like to use a pre-made 3 wires cable with plug and sockets.

I'm was wondering if I could use a standard stereo audio cable for that, and then on the sensor's side solder the wires from the 3 sonars's pins to an audio socket, and the same on the arduino's side, and then connect the two with a standard audio cable. They should have 3 wires, right? Ground, left and right signal. I need to transfer ground, 5V and analog signal.

The sensor I'm using is a Maxbotix MB1000 LV-MaxSonar-EZ0

If audio cable is not a good solution, what should I use?

Thank you and sorry if this might be a stupid question, but I'm just a programmer starting to explore the microcontrollers' world, and quite newbie for all things electrical.



You can probably use a stereo cable. Make sure you use the external shielding for ground, the analog signal as oe of the shielded lines, and power for the other line. You probably need to add some decoupling capacitor close to your sensor. If the output impedance of your sensor is high and/or the analog value fluctuates quickly the cable will act as a low-pass filter. You did not provide enough information to guess whether this could be a problem.

  • \$\begingroup\$ +1 for decoupling. You probably need a 100 uF capacitor at the sonar end of the cable between the power and ground. Is one already mounted on the sonar? My sonar didn't work right -- the power voltage sagged and reset the sonar every time I tried to transmit a pulse -- until I added a big capacitor at the sonar end of the cable. \$\endgroup\$ – davidcary Jan 28 '12 at 17:22
  • \$\begingroup\$ I'm using the maxbotix ultrasonic sensors, LV EZ0. The signal should not change quickly, and it's not a real time application, so even if reaction is a second later it's not a big deal. For the fluctuation, I'm filtering them via code on the Ardino, but probably adding a capacitor might help. \$\endgroup\$ – CodeClimber Jan 29 '12 at 13:55
  • \$\begingroup\$ Or, what other solution would you suggest? I'd like to avoid making my own cable with 3 wires :) \$\endgroup\$ – CodeClimber Jan 29 '12 at 13:58

The analog line is the one which needs special attention. Depending on the signal level and frequency the following trick may be useful. Apply the analog signal to the central (shielded) wire. Also apply it to the input of an opamp used as a buffer (voltage follower). Put the output signal of the opamp to the shielding of your analog signal wire.

voltage follower

Since the signal on the shielding is the same as on the central wire there's no capacitance between the two (since they're the same potential), and the physical properties of the wire are not that important. But, while you keep the impedance of the signal's input, the impedance of the shielding is very low (it's the output of the opamp), and thus very well suited for dissipating external noise.
So you get high noise immunity together with non-critical wiring and your input may be high impedance.

  • \$\begingroup\$ But he has 3 wires and 3 lines to pass where would you put the ground and +3V? \$\endgroup\$ – clabacchio Jan 28 '12 at 14:55
  • \$\begingroup\$ @clabacchio - If the stereo cable has insulated shieldings this should work: 1 wire + its shielding for the signal, the other wire for Vcc, its shielding for ground. \$\endgroup\$ – stevenvh Jan 28 '12 at 16:07
  • \$\begingroup\$ But then you have to modify the connectors, separating the two shieldings and connecting together one channel with its shielding; doable of course, but I don't like so much working on audio cables, there is plastic to cut and it's never a clean work. But I admit that I'm not so good in these things. \$\endgroup\$ – clabacchio Jan 28 '12 at 16:22
  • \$\begingroup\$ @clabacchio: which other solution would you suggest? \$\endgroup\$ – CodeClimber Jan 29 '12 at 14:02
  • 1
    \$\begingroup\$ @clabacchio: the device is a Maxbotix LV-1000 EZ0. The signal is a continuous current that changes based on the distance of objects from the sonar. \$\endgroup\$ – CodeClimber Jan 29 '12 at 14:45

Sounds like it might work, but: What does the analog signal look like? Audio cables are designed for the audible range (< 20 kHz). You can get specifications for the capacitance per meter that let you guess how the low-pass filter built with the driver's impedance and the cable's capacitance will act together. If you have high requirements for the signal frequency or if you need to detect sharp edges (sonar?), then good coax cables like RG58 might be a better choice. With such cables, you can build good transmission lines, where all the impedances match well and fast signals will travel nicely. If you could provide oscilloscope screenshots, data sheets of your sensors or a schematic, I am happy to edit this answer to your needs.

BTW: No stupid question at all. You'd be surprised how much trouble would be saved if all the 'pro' engineers in industrial automation would ask questions like this beforehand...

  • \$\begingroup\$ Thank you for the answer: the sonar is the MaxBotix LV-1000 EZ0. Aren't coax cables just two wires? I have 3. \$\endgroup\$ – CodeClimber Jan 29 '12 at 14:06

I see you have already gotten some good answers, so I am just going to add one point that was left out.

Presumably the three lines are Power, ground, and signal. As Wouter said, tie the audio cable shield to the ground and use the two inner wires for power and signal. However, this means there can be significant capacitive coupling between the power line and the signal line. To avoid problems from this, make sure the power is well filtered before driving the cable at the base station. As long as the power line is a nice clean DC level, it contains no frequencies that can couple to the signal line accross the inevitable capacitance between the two over the long cable run.

Hopefully you have a reasonably well regulated supply already at the base station, and I'll assume your remote sensor draws relatively little current (a mA, maybe even a few 10s of mA, but not 100s of mA). In that case I'd probably use a couple of ferrite "chip inductors" in series with the supply, each followed by the largest reasonable ceramic cap to ground you can find. For example, if the sensor needs 5V power, then you can can easily get two 20 µF ceramic caps.

If the sensor needs more significant power, then it would be better to send a bit higher voltage and then linearly regulate it down at the sensor. In either case, you still filter whatever goes onto the power wire as described above.

  • 1
    \$\begingroup\$ The sensors draws 2mA, uses 5V. Power source is an Arduino \$\endgroup\$ – CodeClimber Jan 29 '12 at 14:50

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.