You might have come here because you’re thinking of running a really long sensor cable around your house, to a robot or who knows what. Depending what sensors you use, you could be fine, you could get readings that are slightly off, or you could get completely bogus results. The best thing to do is use a wireless device like the SBC installed where you want to do the sensing, which allows you to use short sensor cables. However, long cables don’t affect all sensors equally, so let’s explore why some sensors function fine and others don’t.
What happens when you run a long sensor cable? The longer the cable, the greater the resistance, meaning more power is consumed over the wire. Sensors all require a different amount of power, and current, to operate. The power dissipation could mean they’re not getting what they need, but all sensors are different.
Sensors with higher power consumption will cause more of a voltage drop. If the peak power consumption exceeds the power that the cable is able to supply, then the sensor will be useless to you. We found this problem in the light sensor. In low-light situations, the sensor returned the same results on the long and short wire. However, in bright situations, where the light sensor requires more power, readings were about 150 SensorValues off, with an average 30mV drop in the wire.
In this video, the 1103 IR distance sensor is on the end of the 100 foot cable and the control panel is open on the computer. The panel shows jumpy readings that don’t reflect the constant presence of an object. The problem with infrared sensors on the ends of long cables is that they consume power in short pulses, as the infrared light is emitted and the sensor waits for how long it takes for the light to come back. In the following plots, you can see the resistance in the wire jump up when a pulse happens.
Compare those to the readings when the IR distance sensor is connected over a 6-inch cable, where you don’t see any jump in resistance:
For most sensors, the effect of the long wire is quite minimal, and practically negligible with low-power sensors. Testing with sensors like the slider (current consumption max of 150 μA) and temperature sensor (current consumption max of 3.9mA), there was only 1 SensorValue difference between the test with a 6-inch cable and a 100-foot cable. With these low-power sensors, when we measured the voltage drop between the ground on the interface kit and the ground on the sensor at the end of the 100-foot sensor cable, we only found an average 2mV difference, which is less than 1 SensorValue (1 SensorValue is 5mV). As you can see with a test on the slider, the resistances are practically identical in both situations:
What’s happening here? The ground voltage acts as a reference for the sensor. Since the voltage drops, this reference changes for the sensor, and the voltage it sends back (the value the sensor is reading) is skewed.
It’s important to note that wire resistance changes with length, material, gauge and temperature. So, what worked for us, might not work for you and vice versa.
In addition to increased resistance and power consumption in the cable, another problem that arises with long cables is electromagnetic interference. A ferrite bead clamped on a cable will block most forms of unwanted energy. Experimenting with different configurations, we found that an extra loop through the ferrite bead is very helpful, but additional loops will degrade protection. For best results, clamp the ferrite bead near the end of the cable (as opposed to the middle or near the sensor) to ensure the least amount of noise affects the cable at that end. You can get your own ferrite beads on Digikey.
If you’ve chosen a low-power, non-IR sensor and have committed to using a long sensor cable, one way to get around misreadings is to calibrate the sensor. All this means is that you’re taking into account the change in readings caused by the long wire.
As said at the beginning, the best solution is finding a way to use short sensor cables (i.e. under 350cm). This length of cable will not have enough resistance to impede the sensor from functioning properly. Many customers choose to use a wireless device, like an SBC, in these cases. However, some low-power sensors won’t be affected by the long cables at all. Now that you understand what causes the problems, you can figure out the best solution for you project.