Single Transistor Voltage Level Shifter

by taste_the_code in Circuits > Electronics

3910 Views, 9 Favorites, 0 Comments

Single Transistor Voltage Level Shifter

thumb instructables.jpg
The simplest voltage level shifter that you can actually make yourself
Main Edit.00_00_13_28.Still001.jpg

When connecting multiple devices and sensors to a microcontroller it is very important that we make sure that the voltages of the sensors are compatible with the microcontroller.

Most microcontrollers work at either 5V or 3.3V and many of the sensors and modules also follow the same voltages.

However, I recently got an RYS8830 GPS module from Reyax to make a project with and the module only works with 1.8V.

At the moment, I do not own any commercial voltage level shifters so I decided to make my own using what I had on hand.

Supplies

The Circuit

schematic.png

I've searched online for level shifter circuits and there was one that was interesting and simple enough, in particular, using the BSS138 n-channel MOSFET.

Again, this was a component that I did not have on hand, so I decided to try and replicate the circuit by using the 2N2222 transistor as a replacement.

In theory, this should not be a problem because, for the application that I need, it is not necessary to carry too much current so the transistor should be fine.

Since the communication should be two way, we also need a way of reducing the 3.3V from the microcontroller down to 1.8V so for this, I've added a simple voltage divider out of two 3.6K ohm resistors.

Making a Proof of Concept

Main Edit.00_03_07_18.Still002.jpg
Main Edit.00_03_17_05.Still003.jpg
Main Edit.00_03_54_17.Still004.jpg
Main Edit.00_04_44_18.Still005.jpg
Main Edit.00_05_54_27.Still006.jpg

Before I made the entire setup more permanent, I wanted to test out the circuit and make sure that it will work as expected.

To do this, I first built the circuit on a breadboard, and I initially test the output voltage without the module connected.

After I verified that the output of the circuit is 3.3V when 1.8V is provided on the input and 0V when 0V is provided, I hooked it up in between the GPS module and the NodeMCU microcontroller with a simple sketch that just relays the commands back and forth.

To my surprise, the two boards were immediately able to communicate with each other so I continued to make the entire setup a bit more permanent.

Defining the PCB Layout

PCB.png

To transfer the design from breadboard to a PCB, I first used Altium Designer to add all of the components and design a PB just so I can get a sense of the layout and how to place the components efficiently on the perf board.

Once that was done, I used that design as a guide and I then set to build the circuit on a prototyping board.

Making a Prototype

MVI_0269.MP4.00_00_56_24.Still001.jpg
MVI_0269.MP4.00_01_57_23.Still002.jpg
MVI_0269.MP4.00_03_42_21.Still003.jpg
MVI_0270.MP4.00_04_35_28.Still001.jpg
MVI_0272.MP4.00_00_11_05.Still001.jpg
MVI_0272.MP4.00_00_15_00.Still002.jpg

To make the final prototype board, I used a 2x8cm prototyping board and I started soldering the components onto it.

To be able to later attach things to it, I used female pin headers on both ends and soldered the 4 resistors and the 2N2222 transistor based on the schematic and the PCB layouts that I have created before.

The entire process took around 10 minutes and after that, I was ready for one last final test.

Final Testing

MVI_0273.MP4.00_01_03_25.Still001.jpg

To make sure that everything is OK with the level shifter, I once again connected it with the NodeMCU board and started the relaying sketch which is attached here.

With it, I was once again able to write commands in the serial monitor that were then sent to the GPS module via the NodeMCU, and the module was receiving them and replying back with confirmation messages.

So with that, I now had a working voltage level shifter and I can focus on making the GPS module work for the project that I have in mind. If you are interested in seeing that, be sure to subscribe to my YouTube channel and in the meantime, you can also check out my other Instructables.

Downloads