1
\$\begingroup\$

Please note that I'm a beginner in electronic...

Hello, I've got myself some RS485 modules to test with Arduino and i managed to get them working in half-duplex.

From this post I've seen that for raspberry PIs the module would be different because it can only supply 3.3V on the GPIOs pins.

So the question i have is, can i use an external 5V power source for VCC and GND of the RS485 module and send data with 3.3V? Because if so i could avoid buying a specific module just for the Pi and that would be good...

\$\endgroup\$
5
  • \$\begingroup\$ RS485 isn't something you "get"; it's a communications standard, not an object. \$\endgroup\$
    – Hearth
    Jul 19, 2021 at 1:29
  • \$\begingroup\$ I meant the module, sorry will edit \$\endgroup\$ Jul 19, 2021 at 1:29
  • \$\begingroup\$ which RS485 module? some work with 3.3V some do not. \$\endgroup\$ Jul 19, 2021 at 1:40
  • \$\begingroup\$ You have to look at the logic thresholds in the module's manual. \$\endgroup\$
    – DKNguyen
    Jul 19, 2021 at 3:17
  • \$\begingroup\$ This is the module. I only know that is uses the max485 chip \$\endgroup\$ Jul 19, 2021 at 21:36

2 Answers 2

1
\$\begingroup\$

Compatibility between 3.3Volt and 5Volt logic has two directions. The logic thresholds for log.0 and log.1 are the same 0.8V and 2.4V) = that alone is compatible. As a result, using the output of a 3.3V line driver as an input to a 5V line receiver should "just work". The other direction is more problematic, as a 5V line driver does satisfy those decisive thresholds, but can also overdrive and blow a 3.3V receiver input. This is what "5Volt-tolerant" is about, in the datasheets of many modern chips.

Looking at the ultra-classic SN75176 RS485 transceiver, I can see that it nominally runs on +5V. Among its 8 pins, the TTL side has a dedicated pin for the TX direction (a permanent input labeled D for Drive) and a dedicated pin for the RX direction (a permanent output labeled R for Receive). And it's the RX direction TTL driver that is dangerous to your Arduino.

The fact that the signal is permanently in the same direction (driver/receiver roles) makes your life easier. Kartman has already suggested two resistors as a level shifter. If you ever needed something more posh, take a look at the 74LVC logic family - this can run on 3.3V and is 5V-tolerant. Namely, if you need to cater for just a single signal, you might appreciate the 74LVC1G125 or 74LVC1G126 - a single channel of the classic 74125/74126 quad parallel bus buffers. There's also a dual-channel version starting with 74LVC2Gxxx .

Yes you're right, the GPIO pins on the RPI are apparently not 5V-tolerant. And, they can probably work in both directions, depending on software configuration. A resistive level-shifter for your RX line should work just right with that - actually I guess it would work for both directions too :-) if your signals are not too fast, so that parasitic capacitances don't matter. The official RPI webpage that I have linked to actually mentions some ready-made level-shifter modules. Not sure what they are... do I see transistors on the module? Whatever...

There's one last thing to beware of: if you're using some complete RS485 interface module (board), and you're going to supply that by 5V, make sure that you don't mistakenly wire the same 5V power rail (network of PCB traces) to the 3,3 Volt supply pin (output) in the RPI's GPIO connector. Feeding the RPI's 3,3Volt rail by +5V would do the RPI no good :-)

RS485 can be a fairly rich topic in its own right. As its differential and common-mode RX level tolerance is fairly broad, I can well imagine a practical working setup with the line drivers powered by just 3.3 Volts. As long as the logic of the transceiver chip can work on that voltage, the bus itself should be principally working fine, even mixing nodes powered by 3.3 and 5 Volts. You can interconnect the signals and the reference ground, but do not interconnect their power rails! along the bus :-) You just give up some "attenuation budget" along the bus transmission line.

Happy tinkering :-)

\$\endgroup\$
0
\$\begingroup\$

The obvious and most robust solution is to get the correct module. As others have mentioned, some rs485 transceiver chips will ‘work’ on 3V3. This may not be guaranteed. Alternately, if the Pi only needs to transmit data, then you can use a 5V transceiver. The problem comes with the receive data as the transceiver will output a 5V signal that the pi will not appreciate. You could use a resistor divider to drop the voltage. Say 2k2 in series and a 3k3 to 0V. There should be worked examples on the interwebs.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.