1

Most of the sensors available in the market requires 3.3V-5V. The GPIO of the Raspberry Pi is 3.3V max only and not 5V tolerant. I have seen tutorials around the internet that they supply the sensors from 5V from the Raspberry Pi then connecting sensor's output pin to GPIO by using voltage dividers such as resistors in series to reduce it to 3.3V. My main concern is:

  1. Will it affect the transmission of sensor data to raspberry pi or affect the performance of the data transmission when decreasing voltage (as the sensor output voltage is reduced) ?

I am trying to compare the sensor performance if we connected the same sensor to Arduino for which we would not require a voltage divider/level shifter.

ui2020
  • 11
  • 2
  • 1
    in such a setup, the 5v sensor will still be getting 5v power and sending 5v signals – Jaromanda X Feb 09 '21 at 21:55
  • 1
    But 5V signals will cause damage to Raspberry Pi as GPIO pins have maximum voltage of 3.3V right? – ui2020 Feb 09 '21 at 22:03
  • 1
    I thought you said there are voltage dividers – Jaromanda X Feb 09 '21 at 22:03
  • If done properly the Pi will receive 3.3V digital signals. Point being a digital signal is composed of binary pulses, high or low, and the line between them is what's important. Ie., the high does not have to be exactly 3.3V and the low doesn't have to be exactly 0V. Although voltage dividers should work, you might want to consider a logic level shifter: https://raspberrypi.stackexchange.com/questions/49772/how-to-use-arduino-devices-with-raspberry-pi/49775#49775 – goldilocks Feb 09 '21 at 22:04
  • 1
    Yes but my main concern is if it will be able to read data the same, as it would, if we connected the same sensor to Arduino. (as there is voltage reduction when connected to RPI) – ui2020 Feb 09 '21 at 22:09
  • 1
    digital data transmission does not depend on absolute voltage levels for accuracy ... it depends on there being discrete levels in the signal .... think of this ... you can transmit blink code using a small flashlight with the same accuracy as using a 100 W lightbulb ... as long as the receiver can discern between the two levels in the signal, data will be accurately transmitted – jsotola Feb 10 '21 at 01:00
  • 1
    If the sensor requires 3.3-5V, what stops you from giving it 3.3V? – jkp Feb 10 '21 at 10:56

2 Answers2

1

I've had pretty good luck with these opto-coupled voltage shifters. In addition to shifting the voltage from 5V to 3.3V they provide some protection and voltage reference isolation. They also have LEDs that light when an adequate voltage is sensed. Not sure what the frequency response is. I think they also come in single or four lead versions and also with different voltages (e.g. 12, 24, etc).

Al-Zard Voltage Shifter

gorlux
  • 266
  • 1
  • 6
1

In general, any level shifter reduces the performance of a digital data line. For digital signals, it's often convenient to characterize a level shifter by the maximum frequency it can pass though.

Mechanical relays are very slow, working only at single-digit Hz frequencies. General-purpose optocouplers and MOSFET-based bidirectional level shifters are usually OK for up to 100kHz. Resistive voltage dividers are unidirectional by nature (you can only get lower voltage, not higher), and work up to a 1-2 MHz if the resistance values are sufficiently low. Specialized chips or RC voltage dividers can support frequencies of tens of MHz.

In practice, R voltage dividers work fine with standard I2C speeds and slow SPI.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144