OK, here is the short and sweet build write-up. The assumption here is that you have some basic Arduino knowledge.
Starting with a Strip of WS2812b’s that I had and an ESP8266 that has a voltage regulator and serial adapter already attached. https://www.amazon.com/dp/B01N3P763C/ is the exact one I have.
This chip uses a CH340 serial adapter. Instructions for installing drivers can be found below
https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all
Once the drivers are installed, the Board needs to be added to IDE.
Start Arduino and open Preferences window. And Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Boards Manager URLs field. You can add multiple URLs, separating them with commas.
Open Tools Board Boards Manager and install esp8266 by ESP8266 Community
Then you will need to install the following libraries
then install and code below.
The LEDs need to be hooked up to 5v Ground and the pad labeled D2.
// Load libraries
#include <ESP8266WiFi.h>
#include <Adafruit_NeoPixel.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
// Replace with your network credentials
const char* ssid = "WifiName";
const char* password = "PASSWORD";
// Set web server port number to 80
AsyncWebServer server(80);
//Setup for Strand
#define PIN 4
#define NUMPIXELS 30
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void notFound(AsyncWebServerRequest *request) {
request->send(404, "text/plain", "Not found");
}
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi network with SSID and password
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// Print local IP address and start web server
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain", "Hello, world");
});
pixels.begin();
pixels.clear();
pixels.setBrightness(50);
pixels.show();
server.on("/clear", HTTP_GET, [] (AsyncWebServerRequest *request) {
request->send(200, "text/plain", "clear");
pixels.clear();
pixels.show();
});
server.on("/led", HTTP_GET, [] (AsyncWebServerRequest *request) {
String getled;
String getr;
String getg;
String getb;
if (request->hasParam("LED")) {
getled = request->getParam("LED")->value();
} else {
getled = NUMPIXELS + 1;
}
if (request->hasParam("R")) {
getr = request->getParam("R")->value();
} else {
getr = "0";
}
if (request->hasParam("G")) {
getg = request->getParam("G")->value();
} else {
getg = "0";
}
if (request->hasParam("B")) {
getb = request->getParam("B")->value();
} else {
getb = "0";
}
request->send(200, "text/plain", "set " + getled + getr + getg + getb);
pixels.setPixelColor(getled.toInt(), pixels.Color(getr.toInt(), getg.toInt(), getb.toInt()));
pixels.show();
});
server.onNotFound(notFound);
server.begin();
}
void loop(){
}