Level shifter using 74HC4050
by Khaled Raed Sharaf on Jan.09, 2010, under GSM/GPRS
Some people will say that we can reduce the voltage of the PIC18F452 or any type of PIC to 4.1v as it operates from 2.0V to 5.5V. But sadly this is not possible because to run the USART of the PIC18F452 it needs a minimum voltage of 4.9 volt (as far as I know). And we are not allowed to put the 5v input directly to the GM862 because this will ruin the whole module. What need now is a level shifter.
There are many techniques out there that enables you to make a level shifter. I used the 2 of 74HC4050 (Datasheet) and it worked fine with baudrate 19600. When you use these level shifter, one will be from low to high (4.0v ->5.0v) and the other will be from high to low (5.0v -> 4.0).
First we need to test everything is working fine before making any connections. In the IC that is used as a high to low converter; insert 5.0v as an input and check with a voltmeter the reading of the output. If its not 4.0v then you did something wrong with the connections and you need to revise the 74HC4050 connection. And do the vice versa to the second IC.
After the test, you are now ready to connect the PIC18F452.



February 9th, 2010 on 9:59 AM
Looking at the datasheet for the GM module it says that the voltage on the serial port should be 2.8V you are saying 4.0V, i have 2 diodes supplying the 74HC4050 Chip on the txd line to drop the supply from 4 to around 3, but its not working, is it definately ok to feed the 4050 with the same supply voltage as used for the GM module.
Thanks in advance for your help.
February 9th, 2010 on 11:06 AM
Hello Derek,
The 2.8v is written in the Pin-out table, but if you open page 23 of the hardware manual (Power Supply Requirements), you will see that the GM862 can operate from 3.8v to 4.2v.
You need to connect the Vdd of one 4050 to 5v while the other connect it to 4v. I think this picture below will be helpful:
http://www.embed21.com/wp-content/uploads/2010/01/2.jpg
February 9th, 2010 on 2:48 PM
This is great, I now have the GM862 responding to text messages as commands, Now will tackle monitoring via the internet.
I will open a gprs connection to a pc with a web server on it and try and get some data transmitted in both directions.
Thanks very much for the confirmation.
February 9th, 2010 on 7:18 PM
Hello ,
I am using a MSP430 which has a 3.3 V UART line.
So now I am doing a conversion from 3.3 V to 2.8 V CMOS. Do you have any suggestions as to how to go about this ?
Thanks.
February 9th, 2010 on 7:25 PM
Hello Somnath,
You didn’t mention the voltage that you are running on the GM module.
Yeah, it is obvious that you are running it on 2.8v as you want to convert from 3.3v to 2.8v. But my question now is, if you were running it on 2.8v did it register successfully to the network??
February 9th, 2010 on 7:49 PM
No I am running the GM862 on 3.7V Lithium Polymer Battery. It did register on the network. The 2.8 V I was talking about is the voltage on the GM862 RX, TX lines.
The Msp430 runs on 3.3 regulated power supply and operates on 3.3 V logic on the Rx and Tx pins.
So for one side that is from the 3.3 V to the 2.8 V I can use a Voltage Divider (MSP430 Tx). But what about the other side the 2.8V GM862 Tx to the 3.3 V logic on the MSP430 Rx ?
February 9th, 2010 on 8:07 PM
The same issue that Derek had (Comment #1). I know that in the Hardware manual it is written 2.8v in the Pinout table, but for me it didn’t work at all. I actually interfaced it with the same voltage that is given to the GM module (4v) and it works fine.
In your case it will be 3.7 volt. So incase of the Rx of the GM (Output Pin) you should connect it to the input of a level shifter (Vdd=3.3v)
And for the Tx of the GM (Input Pin) you should connect it to the output of the level shifter (Vdd=3.7v)
I think this schematic will be helpful:
http://www.embed21.com/wp-content/uploads/2010/01/2.jpg
February 9th, 2010 on 9:15 PM
Ok. Thanks for your reply. I see what you are saying. Thats so weird for the data sheet to mention the 2.8 V and that not happening in reality. This must be some kind of errata.
Anyway will get back to you with my progress.
March 29th, 2010 on 2:34 PM
Hello Khaled,
I’m using a Pic ( 18F97J60 ) powered with 3.3V .
My GM862 module is 3,8V powered.
So it looks that i’m in the same case as Somnath.
But i have a question regarding high to low conversion with U4A :
C104-RXD (GM) is output and goes to 74HC4050 .
This chip will be 3.3V powered to suit the Pic level.
But C104-RXD is about 3,8V input and it is HIGHER than 74HC4050 power voltage …
Is this not a problem to have 74HC4050
input voltage > 74HC4050 Vdd ?
The low to high conversion will not get any trouble because input voltage will be lower than 74HC4050 Vdd voltage.
Many thanks for your help,
April 22nd, 2010 on 10:01 PM
Hi Khaled!
Can your PIC read the data sent by the GM862 module using this level shifter configuration?
April 25th, 2010 on 1:01 PM
Hello Diego,
Sorry for my late reply!
Yes, my pic was able to read the data from the PIC very easily. What is the problem that you are facing??
April 25th, 2010 on 11:27 PM
Well, I tried several USART level converter configurations, including yours, and the problem is always the same: my PIC18F4431 can’t read data from GM862. From PIC to GM862 works always. I’ve tested the communication from a PC with no problems.
Maybe I’ll try with a 16F877A…
April 26th, 2010 on 3:05 AM
No I am running the GM862 on 3.7V Lithium Polymer Battery. It did register on the network. The 2.8 V I was talking about is the voltage on the GM862 RX, TX lines.
The Msp430 runs on 3.3 regulated power supply and operates on 3.3 V logic on the Rx and Tx pins.
So for one side that is from the 3.3 V to the 2.8 V I can use a Voltage Divider (MSP430 Tx). But what about the other side the 2.8V GM862 Tx to the 3.3 V logic on the MSP430 Rx ?
April 26th, 2010 on 8:28 AM
The same issue that Derek had (Comment #1). I know that in the Hardware manual it is written 2.8v in the Pinout table, but for me it didn’t work at all. I actually interfaced it with the same voltage that is given to the GM module (4v) and it works fine.
In your case it will be 3.7 volt. So incase of the Rx of the GM (Output Pin) you should connect it to the input of a level shifter (Vdd=3.3v)
And for the Tx of the GM (Input Pin) you should connect it to the output of the level shifter (Vdd=3.7v)
I think this schematic will be helpful:
http://www.embed21.com/wp-content/uploads/2010/01/2.jpg
April 26th, 2010 on 11:27 AM
@Eric,
From the 2.8v to the 3.3 volt use 74HC4050. Connect its Vcc to 3.3 volt such that, whenever we have a 2.8v input it will give us an output of 3.3 volt.