# Level Shifting 3.3V microcontrollers and NeoPixels

## Shifting Levels

## Welcome to The...how do you say?...Ah yes....NeoPixels

Sometimes, meaning can get lost in translation. It can happen to regular people like you and me, it can happen to actor Antonio Banderas, and it can even happen between&nbsp;microcontrollers and NeoPixels!

There are lots of great microcontrollers that speak the language of 3v3 (3.3 volts) which&nbsp;can make it difficult for them to communicate with&nbsp;NeoPixel LEDs, which speak 5V. Thankfully, along comes a bi-lingual translator, the logic level converter -- or level shifter -- to save the day.

![components_banderas.jpg](https://cdn-learn.adafruit.com/assets/assets/000/039/370/medium640/components_banderas.jpg?1487289185)

![components_74AHCT125.png](https://cdn-learn.adafruit.com/assets/assets/000/039/376/medium640/components_74AHCT125.png?1487290244)

## First, The Problem

Let's&nbsp;start with&nbsp;the three inputs on a NeoPixel: **GND** , **DIN** , and **+5V**. (For greater detail, check out the excellent [NeoPixel Überguide](../../../adafruit-neopixel-uberguide/basic-connections).)&nbsp;

Two of those -- **GND** and **+5V** -- connections&nbsp;to the power supply used to light up the strip. **GND** needs to be tied in to the microcontroller and the power source, **+5V** should be the connection to a dedicated power source in most cases (unless you're using a small strip or ring of NeoPixels which can be run directly from a&nbsp;5V source on the microcontroller).

The third connection -- **DIN** -- is the data line, which also runs at a 5V logic level on the NeoPixel drivers. And this is where the&nbsp;confusion&nbsp;lies.

Some microcontrollers, such as the Arduino Uno and Adafruit Metro 32u4, run at 5V logic levels, and so their data pins can speak directly with the NeoPixel. Other microcontrollers, such as the Adafruit Feather boards, Arduino M0 Pro, Teensy 3, and others, run at 3.3V logic levels. This means there can be a communications mismatch when one of their data pins tries to talk to the NeoPixel's DIN input.

When the 3.3V board tries to talk to the 5V NeoPixel, a variety of strange behaviors can be exibited, including incorrect&nbsp;colors, flickering, dimness, and seemingly "dead" pixels.&nbsp;

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/039/299/medium800/components_Screen_Shot_2017-02-14_at_6.08.56_AM.png?1487089881)

## Next, The Solution

Logic level converters are the perfect solution to this problem. they have one job, which they do flawlessly: Listen to 3.3V microcontroller data, translate it to a 5V-compatible message, and pass that along to our 5V NeoPixels.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/039/375/medium800/components_74AHCT125.png?1487290177)

A super easy way to shift your logic levels is to use the [**Adafruit Pixel Shifter**](https://www.adafruit.com/product/6066). This has the benefit of being a no-solder solution -- just use a small flat head screwdriver to connect your wires to the screw terminal blocks, add an external power source and you're ready to roll!

See the [full guide](https://learn.adafruit.com/adafruit-pixel-shifter) here for more details.

![](https://cdn-learn.adafruit.com/assets/assets/000/134/375/medium800/components_6066-03.jpg?1736267481)

![](https://cdn-learn.adafruit.com/assets/assets/000/134/376/medium800/components_6066-05.jpg?1736267640)

This is the [74AHCT125](https://www.adafruit.com/products/1787), a quad level shifter that can connect 3.3V and 5V devices of up to four channels.&nbsp;

I've got a project that will use a 3.3V microcontroller, and six channels of NeoPixel strips running at full brightness from a large 5V power brick, so I decided to go with the [8-channel LXB0108 logic shifter](https://www.adafruit.com/products/395) seen here.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/039/296/medium800/components_Screen_Shot_2017-02-14_at_6.21.41_AM.png?1487083470)

Info: 

## Connections

When connecting the level shifter, you can think of it&nbsp;as having two halves. On the left side you'll make connections your microcontroller, on the right side to your NeoPixels.

On each side you'll make a connection between the device's operating voltage and the relative VCC pin on the level shifter. This acts as a reference voltage to tell the level shifter what to expect from the data pins on that side.

So, for the Feather&nbsp;M0 Basic Proto, for example, the microcontroller's **3.3V pin** connects to **VCCA** on the level shifter's left side. The NeoPixel's **+5V** power source connects to the **VCCB&nbsp;** pin on the level shifter's right side.

Ground on all devices must be tied together, including a connection to&nbsp; **GND&nbsp;** on the level shifter.

Now, you can use any of the eight level shifting channels to do your translations. Connect, say, digital&nbsp;output&nbsp; **pin 6** of the Feather&nbsp;to pin&nbsp; **A1&nbsp;** of the level shifter's left side. Then connect the corresponding pin **B1&nbsp;** of the level shifter to the **DIN&nbsp;** pin of the NeoPixels. The data flowing out of the Arduino at 3.3V logic levels will be translated by the level shifter to 5V logic levels and then passed along via the&nbsp; **B1&nbsp;** pin to the NeoPixel. (You can optionally add a resistor at the beginning of the NeoPixel data line as per our "[best practices](https://learn.adafruit.com/adafruit-neopixel-uberguide/best-practices)" guide.)

![](https://cdn-learn.adafruit.com/assets/assets/000/044/018/medium800/components_levelShiftLayers02.jpg?1500515721)

## Permanence

Once you're happy with your circuit on a breadboard, you can move it over to a more permanent home, a PermaProto board!

The PermaProto board has the same layout as the breadboard, so you can move the circuit directly from one to another. But on the PermaProto board you can solder the wires and pins of your components, so it's much more secure than the breadboard.

![](https://cdn-learn.adafruit.com/assets/assets/000/044/019/medium800/components_levelPerma02.jpg?1500517151)


## Featured Products

### 8-channel Bi-directional Logic Level Converter

[8-channel Bi-directional Logic Level Converter](https://www.adafruit.com/product/395)
Because the Arduino (and Basic Stamp) are 5V devices, and most modern sensors, displays, flashcards, and modes are 3.3V-only, many makers find that they need to perform level shifting/conversion to protect the 3.3V device from 5V.  
  
Although one can use resistors to make a divider,...

In Stock
[Buy Now](https://www.adafruit.com/product/395)
[Related Guides to the Product](https://learn.adafruit.com/products/395/guides)
### Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0

[Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0](https://www.adafruit.com/product/2772)
Feather is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Feather M0 Basic Proto** ,&nbsp;it has a bunch of prototyping space...

In Stock
[Buy Now](https://www.adafruit.com/product/2772)
[Related Guides to the Product](https://learn.adafruit.com/products/2772/guides)
### Arduino M0 Pro - 32 bit Cortex M0 with Debug Interface

[Arduino M0 Pro - 32 bit Cortex M0 with Debug Interface](https://www.adafruit.com/product/2417)
With the new **Arduino M0&nbsp;Pro** board, the more creative individual will have the potential to create one’s most imaginative and new ideas for IoT devices, wearable technologies, high tech automation, wild robotics and other not yet thinkable adventures in the world of...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2417)
[Related Guides to the Product](https://learn.adafruit.com/products/2417/guides)
### Adafruit NeoPixel Digital RGB LED Strip - White 60 LED

[Adafruit NeoPixel Digital RGB LED Strip - White 60 LED](https://www.adafruit.com/product/1138)
You thought it couldn't get better than [our world-famous 32-LED-per-meter Digital LED strip](http://adafruit.com/products/306) but we will prove you wrong! You wanted **twice the LEDs**? We got it (well, its 1.875 times as many but that's within a margin of...

In Stock
[Buy Now](https://www.adafruit.com/product/1138)
[Related Guides to the Product](https://learn.adafruit.com/products/1138/guides)
### 5V 10A switching power supply

[5V 10A switching power supply](https://www.adafruit.com/product/658)
This is a beefy switching supply, for when you need a lot of power! It can supply 5V DC up to 10 Amps, running from 110V or 220V power (the plug it comes with is for US/Canada/Japan but you can use any plug adapter for your country, or just replace the cable with a standard computer/appliance...

Out of Stock
[Buy Now](https://www.adafruit.com/product/658)
[Related Guides to the Product](https://learn.adafruit.com/products/658/guides)
### 4700uF 10v Electrolytic Capacitor

[4700uF 10v Electrolytic Capacitor](https://www.adafruit.com/product/1589)
This Big Freaking Capacitor is just the trick when you have a lot of current sloshing around your project. They'll help smooth out voltage spikes by providing a little buffering. We use these to help stabilize solar panels on our [solar Lipoly...](http://www.adafruit.com/products/390)

In Stock
[Buy Now](https://www.adafruit.com/product/1589)
[Related Guides to the Product](https://learn.adafruit.com/products/1589/guides)
### Adafruit Perma-Proto Half-sized Breadboard PCB - 3 Pack!

[Adafruit Perma-Proto Half-sized Breadboard PCB - 3 Pack!](https://www.adafruit.com/product/571)
Customers have asked us to carry basic perf-board, but we never liked the look of most basic perf: its always crummy quality, with pads that flake off and no labeling. Then we thought about how people **actually** prototype - usually starting with a solderless breadboard and then...

In Stock
[Buy Now](https://www.adafruit.com/product/571)
[Related Guides to the Product](https://learn.adafruit.com/products/571/guides)
### Female DC Power adapter - 2.1mm jack to screw terminal block

[Female DC Power adapter - 2.1mm jack to screw terminal block](https://www.adafruit.com/product/368)
If you need to connect a DC power wall wart to a board that doesn't have a DC jack - this adapter will come in very handy! There is a 2.1mm DC jack on one end, and a screw terminal block on the other. The terminals are labeled with positive/negative assuming a positive-tip configuration...

In Stock
[Buy Now](https://www.adafruit.com/product/368)
[Related Guides to the Product](https://learn.adafruit.com/products/368/guides)

## Related Guides

- [Adafruit Pixel Shifter](https://learn.adafruit.com/adafruit-pixel-shifter.md)
- [CircuitPython Hardware: LIS3DH Accelerometer](https://learn.adafruit.com/circuitpython-hardware-lis3dh-accelerometer.md)
- [Debug Header for the Feather [M0]](https://learn.adafruit.com/make-a-simple-debugging-featherwing-for-the-m0.md)
- [OOZE MASTER 3000: NeoPixel Simulated Liquid Physics](https://learn.adafruit.com/ooze-master-3000-neopixel-simulated-liquid-physics.md)
- [Remote Control with the Huzzah + Adafruit.io](https://learn.adafruit.com/remote-control-with-the-huzzah-plus-adafruit-io.md)
- [CircuitPython I2C and SPI Under the Hood](https://learn.adafruit.com/circuitpython-basics-i2c-and-spi.md)
- [Using ATSAMD21 SERCOM for more SPI, I2C and Serial ports](https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports.md)
- [Cyber Cat MIDI Keyboard](https://learn.adafruit.com/midi-cyber-cat-keyboard.md)
- [Digital Circuits 2: Some Tools](https://learn.adafruit.com/some-digital-tools.md)
- [Overwatch Prop Gun: Lucio's Blaster Pt. 3](https://learn.adafruit.com/overwatch-prop-gun-lucios-blaster-pt-3.md)
- [Mystery Box: Crypto Countdown Case](https://learn.adafruit.com/mystery-box-crypto-countdown-case.md)
- [Mad Science Test Tube Rack](https://learn.adafruit.com/mad-science-test-tube-rack.md)
- [Using MPL3115A2 with CircuitPython](https://learn.adafruit.com/using-mpl3115a2-with-circuitpython.md)
- [CircuitPython Hardware: PCA9685 DC Motor & Stepper Driver](https://learn.adafruit.com/micropython-hardware-pca9685-dc-motor-and-stepper-driver.md)
- [DAC Hacks for Circuit Playground Express & other ATSAMD21 Boards](https://learn.adafruit.com/circuit-playground-express-dac-hacks.md)
- [Adafruit Feather M0 Basic Proto](https://learn.adafruit.com/adafruit-feather-m0-basic-proto.md)
