PWM Sensor Cable Length

I have a PWM sensor that will be located about 70 feet away from a Photon. I cannot place the Photon next to that sensor due to operational requirements.

What needs to be done to ensure that the signal from the sensor to the Photon is not degraded due to that distance?

I would appreciate the community’s input.

Over 70 feet, due to the resistance of the wire, you may experience significant voltage drop. Enough to make this not work. Also, if you are running the sensor at 3.3V you could experience a lot of noise introduced by the environment. Driving cables at that distance typically requires a higher voltage to guard against noise and voltage loss. I’m experimenting with long distace I2C communication and I found some line driver chips that will convert my 3.3V signal to 12V. You could look for a similar solution. Or, you could use a MOSFET or transistor to drive the line without a dedicated chip. The capacitance of the cable also comes into play. If the capacitance is too high, your PWM square wave may start to look like a triangle wave.

If you’re trying to get by without a hardware change, test your setup as-is. An oscilloscope would be helpful you analyze the signal at the sensor.


Thank you @ninjatill.

I am not worried about the main power because I will be sending 12V and converting to 5V at the sensor.

As I am limited in the use of oscilloscope, can you refer me to a commercial board that can accomplish what you have described?

For example, how can one use this:

Thank you very much in advance.

I took a quick look at those boards and while they might work, I’m not sure that’s what you are looking for. I’ll take a look at Mouser to see what’s out there. But first, what are we talking about here? What sensor? How fast is the PWM signal in kHz? What type of cable are you using for your interconnect?

I’m not the best at this electrical engineering stuff, so if anyone else has suggestions, please chime in.

Without knowing your specifics, I think the key is that you want to take the 5V PWM output from the sensor and convert it up to your 12 volts before transmitting it on the cable. On the MCU side, you want to take that up-converted PWM signal and translate it back down to 5V or 3.3V. To do that, you need a logic level converter.

Here is a resource for Digital Buffers that should be helpful. The bottom of that article has some suggested chips. While looking at Mouser, you might use a TI CD4050B Non-Inverting Buffer that is specifically used for logic level conversions. The CD4050 would take your 5V and convert it up to 12V on the cable. When trying to find a chip that would do the reverse (12V to 5 or 3.3V) I stumbled upon the datasheet for a TI DS26LV32AT Quad Differential Line Receiver. I think the application notes on page 7 show exactly what you are trying to do. The DS26LV32 receiver is paired with a DS26LV31 transmitter using a twisted pair cable (Cat 5 ethernet patch cables for example). Those DS chips approch $2 each but are well worth it so you don’t have to design the driver circuits yourself.

1 Like