You probably have heard the saying that necessity is the mother of all inventions.
I was recently sent a GPS module to make a project with and when I started exploring the module, I immediately noticed in the datasheet that the module only worked with a voltage of 1.8V.
In terms of the module, this is all great because of its extremely low power usage, but for me, this was a problem because I don't have a microcontroller that operates at that voltage. My typical use of NodeMCUs and Arduinos only operate at 3.3V or 5V so connecting the GPS sensor directly to them would definitely damage it.
There are commercial ICs (TXS0108E) and modules that allow you to shift voltages for this purpose but at the moment I do not own any of them so I decided to give it a go and make a logic shifter with what I had on hand.
The module communicates over UART so, in order to be able to send proper commands and also receive data from it, we need to have a way of first lowering the voltage from 3.3V down to 1.8V, but we also need to do the opposite and step up the 1.8V to 3.3V so the NodeMCU can recognize it as a logical high.
In similar cases when we need to reduce some voltages, we can use a voltage divider. When connecting two same value resistors in series, the voltage at the midpoint will be exactly half of the input voltage. Since our input voltage is 3.3V, the midpoint will be at around 1.65V which is close enough for it to be considered a logical high.
Now, for the other part of the communication, we need some sort of an active circuit that can output a higher voltage than what we have on the input. I found online that a typical circuit for this purpose is done with a BSS138 N-channel MOSFET, but, yet again, I did not have that MOSFET on hand so I decided to try and replicate the circuit by using a 2N2222 transistor.
To my surprise, the circuit worked without any issues and I was also able to make a module for it on a piece of perfboard to make it more permanent. You can see the full test and build video below.
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...