This is an Arduino sketch which implements an Open Pixel Control server for controlling NeoPixels from an ESP8266, such as the Adafruit Feather HUZZAH.
Here is an example circuit:
Bill of materials:
- Adafruit Feather HUZZAH ESP8266
- 74AHCT125 - Quad Level-Shifter
- 470 ohm resistor
- Big Freaking Capacitor - 4700uF
- NeoPixel stick
You will need to edit the sketch to set the number of pixels you have, and your WiFi SSID and password.
Once the sketch is running, you'll need to figure out which IP address it has been assigned. Generally, your router's web interface will have a way to look at DHCP leases, and you can find it from there.
It may also be useful to call WiFi.hostname() to assign a
hostname to your ESP board. This may show up as hostname.lan
in
your DNS, although it depends on your router.
Once you know the IP address or hostname, you can connect with any Open Pixel Control client. The openpixelcontrol repository has some clients in Python, and I have a client in Haskell.
This example is a nice proof-of-concept, but there are a couple of reasons it isn't a robust solution.
First, interrupts are disabled while writing to NeoPixels. Interrupts are necessary for WiFi to work, so the server may eventually crash and need to be rebooted, especially if you have a lot of NeoPixels. (This problem could be alleviated by using DotStars instead of NeoPixels, because DotStars are not timing-sensitive and do not need to disable interrupts.)
Second, Open Pixel Control runs over TCP, and TCP is not the best for real-time applications. If a packet is lost, TCP will retransmit it, delaying the packets after it. UDP would be more suitable for this application.