Go Down

Topic: How to use a 74HC4050N Level Shifter? (Read 4984 times) previous topic - next topic

Zealot

Apr 30, 2015, 12:40 pm Last Edit: Apr 30, 2015, 03:05 pm by Zealot
I have seen on a sketch something like this:



A 5V Arduino connected to a 3,3V RF module.

I understand this connection: RX -> 1Y, 1A -> TX
5V TX gets to 3,3V RX.


But I don't get this connection: TX -> 2A, 2Y -> RX
I mean the 3,3V TX from the RF module won't get shifted to 5V by the 74HC4050N, right? So what's the point of this connection?

mcufan

#1
Apr 30, 2015, 01:38 pm Last Edit: Apr 30, 2015, 01:54 pm by mcufan
Arduino will receive and interprete correctly 3.3V signal.

Did you connect GND as well? It should work.

Zealot

#2
Apr 30, 2015, 01:55 pm Last Edit: Apr 30, 2015, 03:07 pm by Zealot
Arduino will receive and interprete correctly 3.3V signal.
I know that the Arduino works perfectly well with 3,3V signals. That's why I don't understand the sketch.

Point is: I don't think the 74HC4050N works the way the creator of this sketch thinks it works (TX -> 2A, 2Y -> RX). What do you think?

mcufan

#3
Apr 30, 2015, 02:07 pm Last Edit: Apr 30, 2015, 03:33 pm by mcufan
Where you placed 74HC4050? Breadboard? Check first breadboard lines are correct.
Breadboard is often problematic, easily break connectors and similar.
Be sure you use header for IC to get reliable connections when push it down.
If not, you risk to break some pins of the IC when push it directly on breadboard.

Check jumper wires are conductive.

The schematic is perfectly correct. I would just additionally ground all unused input pins of it (xA) to avoid any possible source of problem...

You do not have to wire TX of the module to the RX of the arduino through IC, but this is good protection measure.

Grumpy_Mike

Quote
I mean the 3,3V TX from the RF module won't get shifted to 5V by the 74HC4050N, right? So what's the point of this connection?
You are quite right it is a totally useless circuit designed by an idiot.

It will not protect the 3v3 system.

Zealot

How would I make a I2C connection between one system running 5V and one running 3V3?
5V SDA <-> 3V3 SDA
5V SCL <-> 3V3 SCL

How can this be done?

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

Another way is to turn off the Internal pullup resistors in the Uno after starting Wire:
Code: [Select]

Wire.begin();
digitalWrite (A4, LOW); // turn off internal pullup
digitalWrite (A5, LOW); // turn off internal pullup

and then add 2.7K pullups to 3.3V on SCL & SDA

On the Mega, the pullups to 5V are part of 8-pin package RN1, so you'd have to remove it. It's a 4 resistor package, the other 2 resistors are not used according to the R3 schematic.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Zealot

#8
Apr 30, 2015, 08:13 pm Last Edit: Apr 30, 2015, 08:14 pm by Zealot
Thanks CrossRoads.

I just stumbled upon "... Connecting the 5V Arduino directly to a single 3.3V-powered I2C chip usually works, even though it violates official specifications in multiple ways. In practice, Arduino's internal pullups are so weak that ESD protection diodes inside the 3.3V chip limit the voltage."
(from http://playground.arduino.cc/Main/I2CBi-directionalLevelShifterr)

But since I have an Uno I will do as you said (turn off internal pullups).

P.S.
I'm seriously thinking about converting my Uno to 3,3V, since all modules I'm talking to are 3,3V.

MarkT

Just use 4k7 pullups to 3.3V, forget about the internal pullups they are far weaker
than the external pullups.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

mcufan

#10
May 01, 2015, 08:37 am Last Edit: May 01, 2015, 09:06 am by mcufan
You are quite right it is a totally useless circuit designed by an idiot.

It will not protect the 3v3 system.
1. Explain how shown simplified connections "will not protect the 3v3 system". It generally missed few bypass caps and looking in datasheet for allowed maximum current for the BT module pins and possible ESD protection.

2. If the datasheet of the IC is "incorrect", what for the 74HC4050 is designed?

3. How would you design OPs BT module using 74HC4050 with your expertise and academical degree?

4. What IC to use "properly" for UART signal level-shifting between 3.3V and 5V within OPs requirements?

5. If you hold PhD in electronic and ready to insult people (without reaction of moderators), would you call designer of this board using 74HC4050 for an "idiot":
https://www.sparkfun.com/products/11018

6. If you hold PhD in electronic, why spend your valuable time on this forum answering on questions way under your academical level?

All upper is rather rhetorical...

Grumpy_Mike

So if it is rhetorical then it does not need an answer and I would suggest that you go and do some learning about what an analogue data selector actually does.

runaway_pancake

I thought that it was just a hex buffer, but NXP states:
The 74HC4050 is a hex buffer with over-voltage tolerant inputs. Inputs are overvoltage tolerant to 15 V which enables the device to be used in HIGH-to-LOW level shifting applications.

http://www.nxp.com/products/logic/level_shifters_translators/series/74HC4050.html
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Zealot

#13
May 01, 2015, 02:23 pm Last Edit: May 01, 2015, 02:25 pm by Zealot
... which enables the device to be used in HIGH-to-LOW level shifting applications.
Yes, and this is why I understand the two connections RX -> 1Y and 1A -> TX (HIGH-to-LOW level shifting) in the sketch - but not the two connections TX -> 2A and 2Y -> RX (because this would mean LOW-to-HIGH level shifting as well).

runaway_pancake

The output of a "3V" device can (or may or should) go directly to an Arduino "5V" input.
An Arduino "5V" output should not go directly to a "3V" input, there should be a "level shift" stage between the two. (Caveat - If the "3V" device has "over-voltage tolerant inputs", then such is unnecessary.)

With a 3V Vcc, the 74HC4050 provides no "low to high level shifting".

Maybe someone will get upset my saying so, it's inevitable, but I'd have a small-value resistance (33-100ohms) between a 5V output and a 3V input ("over-voltage tolerant" notwithstanding.)
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Go Up