A whole year.

It has been a long time since I have posted anything here so I thought I would update my site with a new ESP8266 based project. This is not meant to be a tutorial, you will probably kill your ESP8266 if you don’t know what you are doing, though if you have any questions I would be glad to answer them in the comments. I wanted to be able to control a LED strip over WiFi, so I chose to use Blynk an IoT API which will work great for this project. They have an iPhone and Android application which you can use to control your electronics over an API.

I have an ESP-12 I picked up early last year, that I soldered to a breakout board made by Baoshi though I don’t believe he sells them any longer. The Adafruit HUZZAH, would be a very similar breakout board or a NodeMCU development board. You will need to program it over an “FTDI” connector using UART.

DSC04517DSC04514

To power the LED strip, I am using a 10A 5v power supply I picked up years ago. I am also using a cheap 5v USB to 3.3v power supply made by Canton to power the ESP8266. I flashed the chip with an Arduino firmware to maintain compatibility with Adafruit’s library for the WS2812. Then I connected the ESP8266 to a WS2812 based LED strip, basically the equivalent of a Neopixel strip. Because of the difference in voltage between the ESP8266 and WS2812 I used a Adafruit BSS138 Logic Level Converter to convert the 3.3v logic of the ESP8266 to the 5v logic needed by the WS2812 LED strip.

The project is basically setup on a breadboard with two power rails. I used one rail for 5v logic and the other for 3.3v. The power for the 5v side comes from the 10A 5v power supply I had, which I use to power the LED strip and also the Canton 5v-3.3v power supply to power the ESP8266. After that I connected the logic level converter to the GPIO pin on the ESP8266 that I chose.  I uploaded some code and it works great! I will be transferring this project to a protoboard so it is a little bit more permanent.

No one had working code for this specific project so I used Flopp’s and db3’s code from an Arduino and tweaked it to run on the ESP8266.

 

#include <Adafruit_NeoPixel.h>
#include <SPI.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WiFi.h>

#define PIN 0 // GPIO pin
#define NUMPIXELS 143 // Number of pixels in strip
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “AUTH TOKEN HERE”;

void setup()
{
Serial.begin(9600);
Blynk.begin(auth, “SSID HERE”, “PASSWORD HERE”);
pixels.begin();
}
BLYNK_WRITE(V1) // Widget WRITEs to Virtual Pin V1
{

int R = param[0].asInt();
int G = param[1].asInt();
int B = param[2].asInt();
Serial.println(R);
Serial.println(G);
Serial.println(B);
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(R,G,B)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

}
}

void loop()
{
Blynk.run();
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *