Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Connecting TTL with different voltages

Fri Mar 09, 2018 7:12 pm

Hello all,
i have to connect two devices:
- a pzem-004t module (TTL @ 5V)
- a hm-10 module (TTL @3.3V)

This is a remote (BLE) voltage current sensor so i have to limit as much as possible space used. The only cable i'm giving is a cut USB cable sourcing 5V for power.

Now, the easiest thing to do would be adding a level converter module, where i only need to add the 3.3V level reference. i could create this with a couple of resistors.

But, just to take advantage of the problem to learn something new, can you think to a different (better?) way of managing this?

Or would you only manage the TX line of the PZEM module, with a resistive divider to the RX line of the HM-10?

thanks

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5087
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Connecting TTL with different voltages

Fri Mar 09, 2018 7:30 pm

Massi wrote:
Fri Mar 09, 2018 7:12 pm
Hello all,
i have to connect two devices:
- a pzem-004t module (TTL @ 5V)
- a hm-10 module (TTL @3.3V)
This is a remote (BLE) voltage current sensor so i have to limit as much as possible space used. The only cable i'm giving is a cut USB cable sourcing 5V for power.
Now, the easiest thing to do would be adding a level converter module, where i only need to add the 3.3V level reference. i could create this with a couple of resistors.
But, just to take advantage of the problem to learn something new, can you think to a different (better?) way of managing this?
Or would you only manage the TX line of the PZEM module, with a resistive divider to the RX line of the HM-10?
thanks
Are these modules being connected to a Pi? It's unclear from what you've written. Is communication with them uni- or bi-directional? Can you post more detail (or a link to more detail) about them. (From the point of view of a Pi's 3.3V GPIO's: Tx'd data from the Pi to a 5V device would require a level converter. Data from a 5V device to the Pi could be either via a resistive divider or a level converter. In practice typical level converter modules have 2, 4, or 8 bi-directional channels: http://www.cpmspectrepi.uk/raspberry_pi ... dules.html )
Trev.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

Idahowalker
Posts: 445
Joined: Wed Jan 03, 2018 5:43 pm

Re: Connecting TTL with different voltages

Fri Mar 09, 2018 8:01 pm

I been using these:
Image

Bi-directional, compact, and fast.
Without knowing why you are deleting my postings, I will not know how...

Moe
Posts: 230
Joined: Sun Jan 25, 2015 2:44 pm

Re: Connecting TTL with different voltages

Sat Mar 10, 2018 12:22 am

Having spent ages pondering the same sort of questions, I now just factor in a bank of bi-directional level converters to my Pi projects. They're cheap, and life is short.
Submarine communication systems engineer and amateur robot enthusiast.

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: Connecting TTL with different voltages

Sat Mar 10, 2018 4:41 pm

sadly i have no 3.3V power source where the sensor is located, so i can't use those cheap level shifters..
i tried with some resistors on TX line, but it's only working a little better, it freezes after a while
so i need to put something more. probably i'll try to take the 5V to 3.3 with some diodes and than using a level shifter..

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5087
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Connecting TTL with different voltages

Sat Mar 10, 2018 5:34 pm

Massi wrote:
Sat Mar 10, 2018 4:41 pm
sadly i have no 3.3V power source where the sensor is located, so i can't use those cheap level shifters..
...
The Hobbytronics ones I've used have an on-board 3.3V regulator/supply powered from the 5V "high-level" supply
see "B" and "C" here: http://www.cpmspectrepi.uk/raspberry_pi ... dules.html
Trev.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

drgeoff
Posts: 9814
Joined: Wed Jan 25, 2012 6:39 pm

Re: Connecting TTL with different voltages

Sat Mar 10, 2018 5:58 pm

Massi wrote:
Sat Mar 10, 2018 4:41 pm
sadly i have no 3.3V power source where the sensor is located, so i can't use those cheap level shifters..
Put the level shifter at the RPi end, where you do have 3.3 volts on the GPIO header.

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: Connecting TTL with different voltages

Sun Mar 11, 2018 11:29 am

drgeoff wrote:
Sat Mar 10, 2018 5:58 pm
Massi wrote:
Sat Mar 10, 2018 4:41 pm
sadly i have no 3.3V power source where the sensor is located, so i can't use those cheap level shifters..
Put the level shifter at the RPi end, where you do have 3.3 volts on the GPIO header.
the sensor is connected to the PI through the hm-10 BT module (bluetooth side)

Return to “Beginners”