Introduction: Halloween NodeMCU (ESP8266) Cheerlights Project
Here is a simple (as in easy) project for this Halloween (or any other holiday for that matter).
So what is Cheerlights?
Taken from the website:
"CheerLights is an “Internet of Things” project created by Hans Scharler that allows people’s lights all across the world to synchronize to one color set by Twitter. This is a way to connect physical things with social networking experiences."
About this project:
Each year I try to make something to display cheerlights color. I use to make things using RGB LEDs, lots of wire, and time to wire things up. A few years ago I discovered "Neopixel" strips - Neopixels are a Adafruit brand, just about any WS2812/WS2811 strip or ring should work for this project. Neopixels are individually addressable RGB LEDs that come in various size "pixels". Anywhere from one to 60.
Step 1: What You Need to Make This.
1) NodeMCU board (the one I'm using is a v.9 board) Mine is a older model - Any of the NodeMCU boards should work, just watch where you hookup the wires, the boards changed the pins slightly.
2) If you want the sound you'll need a MP3 player - I used a Catalex Serial (TTL) MP3 player, these are simple needing just a couple of wires to make them work. But again, any MP3 player that the arduino can use should work with the NodeMCU board. (Code changes of course if you use something different).
3) An Adafruit Neopixel ring, Mine has 16 pixels a smaller ring will also work. (for that matter you don't have to use a ring at all, a Neopixel strip will work too). That being said, the ring produces a neat effect.
4) A small breadboard, wire, a amplified speaker, and a container to hold the electronics. (I found a cheap $1.00 clear pumpkin bucket, this worked amazing for this).
(I'll leave what you put it in up to you)
Step 2: Wiring
This is pretty simple.
You will want to make sure you pay attention to the voltages if you use a different board.
MP3 - 5v to 5v on NodeMCU board (I've read these also work at 3.3v but I've not verified that for myself)
MP3 - Ground to Ground on NodeMCU board.
MP3 RX to NodeMCU D1
MP3 TX to NodeMCU D0
NeoPixel - 5v + to 5v on NodeMCU board (again, I've read these work at 3.3v, and again I've not verified that)
NeoPixel Ground to Ground on NodeMCU board
NeoPixel Signal IN to NodeMCU D4
That's it as far as hookup goes. - See pretty simple.
Step 3: Pictures and Programming
If you haven't already done so, download the Arduino IDE (at the time of this writing version 1.6.12)
https://www.arduino.cc/en/Main/Software (Follow the instructions on Arduino.cc to install)
Also if you haven't already installed the ESP8266 boards into the Arduino IDE you'll want to do that now.
Instructions can be found here:
The sketch requires a few libraries as well.
ESP8266WiFi.h - this is included what you add the ESP8266 boards to the Arduino IDE.
Adafruits_NeoPixel.h - you will want the latest version of this library because it supports the ESP8266. The easiest way to get it is to goto the "Library Manager" in the IDE. and in the search type NeoPixel.
If you'd like to install it the old school way - https://github.com/adafruit/Adafruit_NeoPixel
TimedAction.h - Honestly I can't remember if this is in the Library Manager or not (I think it is...but?) so here is the link to it. http://playground.arduino.cc/Code/TimedAction If I remember right, I did have to change one line of this library. In the TimedAction.h file - line 33 change to #include <Arduino.h>
Lastly you need.
SoftwareSerial.h - Look in the Library Manager I think it is there.
For sound effects, I just searched for "Free halloween sounds" and download 9 or 10 wav files.
The MP3 player uses the old file name format of 8x3 -so you'll need to rename any long file names.
Put your sound files on a SD card,and put the SD card in the player.
It should be noted my sounds are all 15 secs or less - I am using the TimedAction library to trigger changing the sounds every 15 to 16 seconds. This way I can try to keep the LED animation going. The only time the animation stops is when the sketch has to check for a updated color. (I'm working a better version)
That's all that is required.
My github project page:
You'll want to select your NodeMCU board in the IDE, the serial port, change the line for your SSID (wireless) and if you have a password, add that. And upload the sketch.
Hopefully all goes as it should and you now have a Halloween Cheerlights display.
Next - A video of mine, a few more pictures, and some ideas and thoughts.
Step 4: Pictures, Video, and Final Thoughts.
After playing around with this for awhile, we decided it looked better having the pumpkin uncovered.
In the video, we did try it both ways, covered,and uncovered - It's up to you how you like it.
From time to time and for no reason I can see, the ESP8266 locksup, I'm not sure how to fix this.
So if you run into this issue and you have a fix, please let me know!
Final thought - This is a fun project, that can be used for just about any holiday simplely by changing the sounds on the SD card, and the container the board is in. (I'm thinking a Christmas Angel playing Christmas music)
Thanks for visiting my instructable.