This page is all about logic level converters that allow you to easily change between different logic voltage levels.
You know when you just bought that nice shiny new chip to play with, you get it in the post and only then do you think: What about voltage levels? Then you see that the new chip only works at 3V3 and the only microcontroller you have works at 5V! See this project for an example of using the logic converter circuit.
First of all you think that's easy, I'll just use a voltage divider and problem solved. Maybe it is but if your device is an I2C device where you need bidirectional communication on the data line using a divider on the high side won't allow the voltage to go the other way at a reliable level.
For a 4 wire SPI interface there is no bidirectional requirement (data out: SDO, and data in: SDI use separate pins) so you could use the divider method and that requires 3 dividers with a total of 6 resistors (Data in from the lows side driver is usually high enough in a 3V system to signal a logic one to the 5V high side). To go from 5V to 3V needs a resistive divider with 22k and 33k (which drops the output to 3V) (or you can replace the 33k with 39k for a drop of 3V2 (for a 3V3 system).
A 3 wire SPI interface requires a bi-directional data I/O conversion - the data I/O uses bi-directional signals.
There is a clever way to use a MOSFET that relies on the parasitic diode to allow full bidirectional communication with low and high side voltages. The advantage of this is that if your device uses I2C (which is bi-directional) the 5V system can communicate properly with the 3V3 system easily allowing the 3 wire SPI interface to operate correctly with only one level converter..
This is a super spectacular bit of electronics that also happens to be extremely simple but extremely clever. It lets you easily convert between different voltage level systems using only a simple enhancement mode logic level MOSFET and a couple of 10k resistors.
wrt = with respect to.
When the high side outputs a '1' (5V) drain and source are pulled towards
the high voltage so the source is high wrt. gate (reverse Vgs voltage) so the
MOSFET is off so the low side pullup is active and pulls the low side to
When the high side outputs a '0' (0V) the source is pulled low wrt gate, so the gate is higher than the source and the MOSFET is on (Vgs is positive). The MOSFET then conducts the zero through to the low side pulling down the low side.
When the low side outputs a '1' (3V3) the gate source voltage is zero so the
MOSFET is off. The high side pullup is active and pulls the high side to 5V.
When the low side outputs a '0' (0V) the gate source voltage is 3V3 and the MOSFET is on. The MOSFET then conducts the 0V through to the high side pulling down the high side.
Arduino EEPROM: How to use it and How to presrve the life of EEPROM. Two examples sketches to save multiple values to EEPROM.
A tutorial on using the ADS1115 precision 16 bit ADC for low power use.
Learn how to use the TP4056 properly. There's a right, and a wrong way, to use it to safely charge Lithium Ion batteries.
The DW01A chip is a Lithium Ion battery protector commonly used on TP4056 boards. Find out Exactly how it works and how to use it the correct way.
For Arduino string operations you can use Object Class Strings or C style strings but which should you use? Also find out how to decode commands and control variables in your programs using strings.
Real Time Clock Design (FREE): A Free and Complete RTC design using the DS1307 and a PIC micro (16F88) also re-targetable. This PIC project uses an I2C Clock chip and 7-segment display to create a fou…