Level shifting 3.3v data to 5v? (Interfacing Neopixels with an ESP8266)

Thread Starter

dheadrick1618

Joined Aug 23, 2017
3
Hello all reading this, thanks for taking the time to look into my current situation, this is my first post so if I am doing something wrong or there is a previous post (that I am unable to find) which addresses this problem please let me know.

The goal of my project is to use an ESP8266 wireless microcontroller to control a strip of 8 Adafruit Neopixel LEDs (ws2812). Right away I realized this micro operates with 3.3v while the Neopixels require 5v, thus I am using a 5V supply to power the LED strip and a 'Huzzah' breakout board version of the ESP8266 which has an onboard regulator allowing it to be powered by the same supply as the LEDs. (For prototyping purposes I'm using a bench power supply so that current draw is not an issue).

After doing some research online I determine that data being sent from the ESP8266 to the LEDs will not produce the desired effects because the LEDs require approx. 3.5v to register a logic high ( 0.7 * 5v = 3.5v), and the Huzzah board in use outputs 3.3v logic highs.

Many forum posts and discussions exist cover how to handle this problem, and after reading through many of them I decided the 74AHCT245 would operating at a high enough frequency (more than the LEDs required 800kHz baud rate) to properly level shift the 3.3v data up to 5v without skewering it. After ordering some from Digi key I set up my breadboard circuit as described online, whereby the 74AHCT245 is powered by the same 5v supply as the LEDs and the ESP8266 Huzzah breakout, and the huzzah output pin is connected to the first input (A0) of the 74AHCT245 chip. The first output of 74AHCT245 (B0) is then connected the data in of the Neopixel LED strip

*** See attached photo of circuit on breadboard ***
ESP8266 Huzzah with 74AHCT245 and Neopixel strip.jpg

Below is a simple sketch using Adafruits Neopixel library which shows a red three pixel-long chasing sequence on the LED strip is then uploaded to the Huzzah micro via 5v USB to FTDI cable.

Code:
#include <Adafruit_NeoPixel.h>

#define LED_PIN 5

Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, LED_PIN, NEO_GRBW + NEO_KHZ800);

//***********************************************************************************
void setup() {
  pinMode(5, OUTPUT);
}

//***********************************************************************************
void loop() {
  chase(strip.Color(250, 0, 0)); // Red

}

//***********************************************************************************
static void chase(uint32_t c) {
  for (uint16_t i = 0; i < strip.numPixels() + 4; i++) {
    strip.setPixelColor(i  , c); // Draw new pixel
    strip.setPixelColor(i - 3, 0); // Erase pixel a few steps back
    strip.show();
    delay(100);
  }
}
I used my digital oscilloscope to compare the data input and output of the 74AHCT245 chip. As the waveform capture attached suggests the chip is operating properly because the 3.3v logic level highs coming from the Huzzah board are shifted to 5v without producing any noticeable effects on the data itself.

*** (See attached JPG of my waveform capture showing the data before and after level shifting. Channel 1 is yellow and represents data going into the 74AHCT245 from the ESP8266 while Channel 2 is blue and represents the level shifted data output from the 74AHCT245 that is used to control the LED strip)***
Waveform Capture (Yellow is 3v3 input).jpg


Unfortunately, despite assumed proper operation of the level shifting chip, the LED strip does not show the intended sequence
***(see attached .gif)***
LED not working with 3v3.gif

I have no idea what could be causing the fault or where it might be as my scope measurements seem to suggest the 74AHCT245 chip is working as intended. I would greatly appreciate any help from someone who may have experienced similar issues or might be able to point me in the right direction as to how I might solve this issue.
 

ebeowulf17

Joined Aug 12, 2014
3,307
Are you sure you have RGBW parts? Could they be just RGB? In other words, do they have a fourth, white LED?

In the line:
Code:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, LED_PIN, NEO_GRBW + NEO_KHZ800);
you might need to change "NEO_GRBW" to "NEO_GRB" (possibly also ...rgb or rgbw.)
 
Top