Using a PWM sensor at longer distances

I would appreciate the community’s help.

I have a 5VDC PWM sensor that will be approximately 70 feet away from a Photon. Only one wire from that sensor goes to the Photon board’s pin. This is no problem supplying power to that sensor but the Photon board needs to be about 70 feet away from the sensor.

I understand I may need a line driver like the one below:

I have searched the net but could not find a reliable wiring diagram.

GND Proton GND
VCC Proton VIN
SIG Proton Pin

VIN +5VDC (external) ? (not sure)
GND -5VDC (external) ? (not sure)

V+ ? Where does this go?
V- ? Where does this go?

How can this line driver (or any other one) be wired to the Photon?

Thanks in advance.

You have to change your thinking on this one a bit. The sensor is the source of the signal and so the sensor is driving the line. So in that case, the sensor is the control source and the Photon is the motor. This is a decent document:

You would have to hook up the signals as such:
GND = Shared common ground.
Sig = Sensor PWM output
VCC = Sensor +5V (could be a common +5 from Photon Vin but at 70 feet that voltage will drop)

V+ = Photon analog in pin (i.e. any of the “A” pins)
V- = Probably not needed since you can’t “reverse” the Photon like a motor.

VIN = +V
GND = Shared common Ground.

Now with that out of the way, I don’t think this is the driver that you need. At 70 feet, you want a higher voltage than even +5 volts. The driver you have selected is a motor control driver which will provide a higher current drive… not higher voltage. I suggested some line transmitters/receivers in this post.

EDIT: see notes from @ScruffR on pin usage. Choose “A” pins wisely. Your PWM signal will probably be read from a sensor library or some other means so I was mistaken on analog readings.

Just be careful when using A pins with analogRead() or using A3 or A6/DAC in any mode since they are not 5V tolerant. But you seem to send 5V signals to the Photon.

If you intend to read the (pseudo) analog signal (actually a digital PWM signal) with analogRead() you’d also need to filter it.

Thank you @ninjatill. Makes sense, I will try both approaches. BTW, I am currently using the sensor with a Digital input on the Photon (per vendor’s example).

Since I already have that module, I will try it first. So the module will be sitting next to the sensor and 70 feet away from the Photon. Per your post,

VIN = +V
GND = Shared common Ground.

Are these pins above going to Vin and GND on the Photon?

Thanks again.

Thanks @ScruffR. I am using a Digital pin (D6) per vendor’s example. There is also a resistor between D6 and D7.

No, the V+ is the output to your digital pin (D6 as you describe); in that linked document, this was one of the lines connected to the motor. GND can go to the Photon GND and in fact the Photon, the driver board, and the sensor should all have the same ground reference. For +5V power, VCC, VIn and the Photon VIn could all be interconnected for the same VCC reference. If the Photon Vin is providing the power to the sensor and driver board, then like I said, at 70 feet that will likely drop because of the resistance on the wire. You probably need to provide a separate +5V supply at both the Photon and the sensor.

1 Like

Thanks again @ninjatill. Please see attached.

If I provide separate 5VDC for both Sensor and Photon, in a sense, it will be like two power supplies connected in parallel. Correct? This way the VCC and GND will be common …?

@Jimmie I think you have it. Since this driver board will be on the sensor-side, the Vin on the driver board can be the same as the sensor Vcc. You shouldn’t interconnect the independent +5v supplies… they should remain independent. But your ground references from both power supplies MUST be interconnected. That’s why I would use something like Cat 5 Ethernet cable and twist the V+ output with the ground wire on a single pair. The other 3 pairs can go unused. Make sense?

Edit: changed the wording about +5v based on @peekay123 comments below.

1 Like

I would not consider the +5v as a “reference”. That is what GND is for. You should absolutely NOT connect the +5v lines together as they “compete”, causing unwanted current to flow from one supply to the other. @ninjatill’s suggestion of Cat5 wiring is good and his direction of connecting grounds also.


Thank you for your time. Yes, all makes sense now.