Skip to content

Different voltage level coexistence


The problem background

A few years ago a 5V voltage level was a standard in electronics. This meant that 5V was used to pover a device and the same voltage level was used to signal HIGH logic level (logic value true or 1). LOW logic level (logic value false or 0) was signal by GND. Today things changes: more and more devices are powered with 3.3V or sometimes powered with 5V but uses 3.3V as logic level value.

We might face the following problems (or their mixture)

  • We want to use two devices powered with different voltage levels.
  • We want to send logic signals from 3.3V device to 5V device.
  • We want to send logic signals from 5V device to 3.3V device.
  • We want to send logic signals from/to 3.3V device to/from 5V device (bi-directional communication on the same wires).

Let's discusse all of them.

Two devices powered with different voltage levels

Some devices can operate with 5V but also have a pin with 3.3V on output. Keep in mind that very ofthe this output has some maximum current limitation. Look into excerpt from Arduino Uno documentation

The power pins are as follows:

  • Vin. The input voltage to the Arduino/Genuino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.
  • 5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.
  • 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
  • GND. Ground pins.
  • IOREF. This pin on the Arduino/Genuino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs to work with the 5V or 3.3V.


Saying the truth, in most cases we can forget about this 3.3V pin. Fortunately there is a very simple solution to our problem. We can use linear voltage regulator, switching converter or use a voltage divider which is a passive linear circuit that produces an output voltage that is a fraction of its input voltage.
Todo (id=voltage_level_coexistence:add_links_in_section_1): Add links to switching converters and a voltage divider when materials will be ready.


Although voltage divider is widely used in many home made application and works quite well you have to remember that the current and voltage across divider produce power, which is dissipated in the form of heat. If that power exceeds the rating of the resistor, the heat begins to become a major problem and potentially may destroy resistor. Another aspect is efficiency or rather inefficiency of a voltage-divider-power-supply. The preffered solution, if you need to drop down a voltage to use it as a power supply, is a voltage regulator or switching converter.

Send logic signals from 3.3V device to 5V device

In most cases this is not a problem, because 3.3V is accepted as a HIGH level for 5V logic level devices. If for some reason case would be different and our 5V device doesn't accept 3.3V as a HIGH level, look into further solutions.

Send logic signals from 5V device to 3.3V device

This case is a little bit difficult. Solution seems to be simple: we can use a voltage divider. We will not dive into details about voltage divider here and give only a sample solution to give an idea. For details look into Voltage divider tutorial.
Todo (id=voltage_level_coexistence:add_links_in_section_2): Add link to a voltage divider when materals will be ready.


Generally speaking, formula used to calculate $V_{out}$ takes a form
$$V_{out} = \frac{V_{in}R_{2}}{R_{1}+R_{2}}$$
Be careful: I have found some cases when this approach doesn't work. I didn't have time to investigate this but my theory is that this might be a case for high speed communication (high sped switching from one logic state to other).
Todo (id=voltage_level_coexistence:voltage_divider_speed_test): Voltage divider speed test
In such a case we can use ready to use (bi-directional) logic level converter (see next section).

Bi-directional communication

The real problem is when on the same wire sometimes we want send some data but other time receive them. In such a case a bi-directional logic level converter (BD-LLC for short) would be very helpful.


From technical point of view BD-LLC is a very simple device. There is basically one level-shifting circuit on the board, which is repeated four times to create four level-shifting channels. The circuit uses a single N-channel MOSFET and a couple pull-up resistors to realize bi-directional level shifting. Below ther is one the bi-directional level-shifting circuit used on all four channels of the Sparkfun BD-LLC

Sparkfun bi-directional logic level converter

Let's take a closer look into pinouts of a Sparkfun BD-LLC. The smallest version of the Sparkfun BD-LLC which has 12 total pins – six headers arranged in two rows. One row contains all of the high voltage (e.g. 5V) inputs and outputs, the other row has all things low voltage (e.g. 3.3V).

To make things simple, the pins are labeled on both sides of the board, and organized into groups.

Voltage input pins group

The pins labeled HV, LV, and two GND’s provide high and low voltage references to the board. Supplying a steady, regulated voltage to both of these inputs is required.

Data channel pins group

There are four separate data channels on this BD-LLC, each capable of shifting data to and from high and low voltages. These pins are labeled HV1, LV1, HV2, LV2, HV3, LV3, HV4, and LV4. The number at the end of each label designates the channel of the pin, and the HV or LV prefix determines whether it’s on the high or low side of the channel. Quite logic, isn't it?

A low-voltage signal sent in to LV1, for example, will be shifted up to the higher voltage and sent out HV1. Something sent in HV3 will be shifted down and sent out of LV3 .


Keep in mind that these level shifters are purely digital. They can’t map an analog voltage from one max voltage to another. Other words, we can't use it instead of voltage regulator or switching converter.


Example

In this example we will show how to use bi-directional logic level converter connecting Bluetooth HC-05 with Arduino Uno. As we can see on the back side of HC-05 module, it uses 5V as a main power voltage while 3V to communicate (pins RX and TX).
Left image: HC-05 -- front side. Right image: HC-05 -- back side.

HC-05 and Arduino Uno with Logic-Level Converter wireing