Homemade Single Transistor Voltage Level Shifter

by erintse01 in Workshop > Tools

20 Views, 1 Favorites, 0 Comments

Homemade Single Transistor Voltage Level Shifter

make a proof of concept.jpg

When we are connecting multiple devices and sensors to a microcontroller, it is very important to ensure that the sensor's voltage is compatible with the microcontroller. Most microcontrollers operate on 5V or 3.3V, and many sensors and modules follow the same voltage. However, I recently got hold of a RYS8830 GPS module to make a project and it only works with 1.8V.

Supplies

2N2222 transistor

Resistor Kit

prototype board

Soldering Stations

mini breadboard

Mini Breadboard Jumper Wires

multimeter

NodeMCU board

RYS8830 Mini GPS Board

Circuit

circuit.png

I searched for level shifter circuits online and one of them was interesting and simple enough, specifically using a BSS138 n-channel MOSFET.


Again, this was a component I didn't have on hand, so I decided to try and replicate the circuit using a 2N2222 transistor as a replacement.


In theory, this shouldn't be a problem since for the application I need it doesn't need to carry much current so the transistor should be fine.


Since the communication should be bi-directional, we also need a way to step down the microcontroller's 3.3V to 1.8V, so for this, I added a simple voltage divider from two 3.6K ohm resistors.

Make a Proof of Concept

make a proof of concept.png

Before I make the whole setup more permanent, I want to test the circuit and make sure it works as expected.


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


After I verified that the output of the circuit is 3.3V when 1.8V is supplied at the input and 0V when supplied with 0V, I connected it between the GPS module and the NodeMCU microcontroller with a simple sketch which is just The command is forwarded back and forth.


To my surprise, the two boards were able to communicate with each other immediately, so I went ahead and made the whole setup more permanent.

Define the PCB Layout

define pcb layout.png

To transfer the design from the breadboard to the PCB, I first use Altium Designer to add all the components and design a PB in order to understand the layout and how to efficiently place the components on the perf board. Once that was done, I used that design as a guide and started building the circuit on the protoboard.

Make a Prototype

make a prototype.png

To make the final protoboard, I used a 2x8cm protoboard and started soldering components to it.


To be able to wire things up to it later, I used female headers on both ends and soldered 4 resistors and a 2N2222 transistor according to the schematic and PCB layout I created earlier.


The whole thing takes about 10 minutes, after which I'm ready for one last final test.

Final Test

final test.png

To make sure everything is fine with the level shifter, I connected it again with the NodeMCU board and started connecting the relay sketch here.


With it, I'm again able to write commands in the serial monitor, then send to the GPS module via the NodeMCU, and the module is receiving them and replying with a confirmation message.


With this I now have a working voltage level shifter and I can focus on getting the GPS module to work for the project I have in mind.