Single Transistor Voltage Level Shifter
by taste_the_code in Circuits > Electronics
4842 Views, 9 Favorites, 0 Comments
Single Transistor Voltage Level Shifter
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
Tools and materials used in the video:
- 2N2222 transistors - https://s.click.aliexpress.com/e/_A6IA8V
- Resistors Kit - https://s.click.aliexpress.com/e/_A0BF1T
- Prototyping board - https://s.click.aliexpress.com/e/_AgOEgN
- Soldering station - https://s.click.aliexpress.com/e/_9GGw8V
- Mini breadboards - https://s.click.aliexpress.com/e/_A65RUD
- Mini breadboards jumpers - https://www.tindie.com/products/taste_the_code/mi...
- Multimeter - https://s.click.aliexpress.com/e/_ApbVBJ
- NodeMCU board - https://s.click.aliexpress.com/e/_Alnqvr
- RYS8830 Mini GPS board - https://www.techdesign.com/market/reyax/product-d...
The Circuit
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
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
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
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
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.