emersonbottero
Posts: 1
Joined: Thu Oct 18, 2018 10:22 pm

connect an 5V sensor in microusb port instead of gpio pins?

Thu Oct 18, 2018 10:33 pm

Hi all, I have an Raspberry pi zero W and a sensor 5V and would like to connect it to the microusb instead the gpio pins, i'm using node to read the data.

Is it possible and how can I achieve it? :D

Rigth now i'm using the gpio and onoff library on nodejs to read the signal from the sensor, but it would look so much better connecting it ni the microusb. 8-)

scotty101
Posts: 3185
Joined: Fri Jun 08, 2012 6:03 pm

Re: connect an 5V sensor in microusb port instead of gpio pins?

Fri Oct 19, 2018 8:28 am

No. The sensor is not a USB device and the USB ports cannot act like GPIO pins.

If you are dead set on connecting it to the USB port, you'll need a separate device to convert the signal from the sensor to something that the USB ports can understand. You could do this with a small Arduino clone or a Teensy.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

boyoh
Posts: 1175
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: connect an 5V sensor in microusb port instead of gpio pins?

Sat Oct 20, 2018 7:07 pm

Be more explicit on the type of sensor you are using ,what is it sensing,

Some sensors have different out /put signals 4/20ma / 0/5v / 0/10v,
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

PhatFil
Posts: 518
Joined: Thu Apr 13, 2017 3:55 pm

Re: connect an 5V sensor in microusb port instead of gpio pins?

Sat Oct 20, 2018 9:33 pm

with such sensors you can provide the 5v vcc feed from the 5v pin on the gpio header and protect the 3.3v level gpio pin you connect to the sensor data/signal wire with a voltage divider (2 x resistors google the config/circuit). so that the 5v signal from the sensor drops to 3.3v so your pi can safely read its state.

You could also employ a logic level shifting circuit supplied on a PCB with 2 4 or 8x bidirectional inputs which are generally used with more sophisticated sensors and devices

However imho its worth a suck n see if the sensor will perform adequately with a 3.3v vcc supply after all its not exactly anything complex. just a light sensitive resistor..

Return to “Advanced users”