Introduction: 2017 Halloween Cheerlights Ghost (Simple Hardware, Simple Software) & Spooky

Picture of 2017 Halloween Cheerlights Ghost (Simple Hardware, Simple Software) & Spooky

This years Halloween project is based on some of my previous Halloween displays.

My previous published "Halloween NodeMCU Cheerlights (Pumpkin) Project" - https://www.instructables.com/id/Halloween-NodeMCU...

What makes this different, Simplified the hardware, by using a D1 mini, and the D1 mini shields - Meaning Less wires are need, and a small lipo battery can be used.

I made some major changes to the software, the biggest is being able to use a MQTT stream of the cheerlight colors - this really got the software simpler, and lets the display have more of a steady flashing. This is done because of simpler hardware (only one pixel), and the code now uses the "Blink without delay" example code.

I have two different versions of the code/hardware pairing: One version does not have sound (But as an option a second controller can be used with a MP3 player and speaker for sound). The other has sound added to it.

A little history - I've been doing "Cheerlights" displays for years - My previous Halloween (Pumpkin) Project above, the "Cheerlights - Lightsaber" https://www.instructables.com/id/Cheerlights-Light...

And others, and over the years I've learned a lot about writing code, and in just the last year - learned a number of things about the ESP8266.

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."
http://www.cheerlights.com

Let's get started...

Step 1: Hardware - Simple Seriously....

Picture of Hardware - Simple Seriously....

This year, things have been keep simple. (The only real skill you may need is to solder pin headers on the boards)

1st We need something to put the electronics in - I found this small "electronic" Ghost at the Dollar store - Cost $1.00 U.S. When turned on, this made one "scary" sound, and flashed a RGB led a few times, and stopped. It really wasn't that scary. This was also almost the prefect size for the D1 mini, on a dual shield board to fit in.

2nd We need a D1 mini, a WS2812 shield for the D1 mini, a Battery/Charger Shield, and a dual base shield. You may even have these sitting around. :-) I have found that I get a bit better pricing on Aliexpress, but I usually have to wait long for the stuff to arrive (Tradeoff I guess)

D1 Mini Dual Base Shield - 0.48 cents - https://www.aliexpress.com/item/Double-Socket-Dual...

D1 Mini WS2812B Shield - $0.55 cents - https://www.aliexpress.com/item/Smart-Electronics-...

D1 Mini Battery Shield - $1.10 - https://www.aliexpress.com/item/WeMos-D1-Mini-Batt...

(An alternative to the Battery Shield - is the D1 Mini DC Power Shield $2.10 - https://www.aliexpress.com/item/DC-Power-Shield-V1... ) It is more expensive but can use a AC adaptor that is 7 to 24v DC. Some Batteries are expensive.

The D1 Mini (ESP8266, NodeMCU board) - $2.55 - https://www.aliexpress.com/item/1pcs-Smart-Electro...

Most of the prices listed here are best prices found at the time I am writing this instructable.

3rd we need a MP3 player - A Serial MP3 player works great, and I found one on AliExpress. $2.30 - https://www.aliexpress.com/item/UART-TTL-Serial-Co...

Lastly, we need a micro-SD card 1 or 2gb should work great with this player, and a small amplified speaker. We also need a few dupont wires (I used Female to Male and only 3 wires to hook the MP3 player up).

A small LiPo battery, or AC adapter. I used a small quad copter battery, the connector isn't the right one for the shield, but with a little work it does fit, just watch your Positive and Negatives. A AC adapter that works with the Arduino Uno should also work with the DC shield. Another option is to use a 2amp USB cell phone charger, and just plug that into the USB port on the D1 mini.

The D1 mini and shields will need to have the pins soldered to them, I used the pins that are stackable, so I could expand later if needed.

Step 2: Put It Together.....

Picture of Put It Together.....

The Ghost from the dollar store, just has some small "push pin" type things to hold it together. There is one big one in the head, this was the hardest one to get to loosen up the 1st time. I used a small screw driver the 1st time, and just slowly started to pull the two halfs of the Ghost apart starting on the bottom, and slowly working up.

It didn't take much for the small "tabs" to let loose.

Take the old electronics out, you may or may not want to save it (?) It has a RGB LED, a small on/off switch, and a photo resistor. The sound chip is "blobbed" out, so probably not worth messing with, the RGB LED is a SMD type, and looked like it might be a pain to get off the board. The switch and photo resistor looked usable thou.

NEW ELECTRONICS (PROGRAMMABLE TOO):

As you can see in one of the pictures above the D1 Mini and shields are stack able. So it really is as simple as solder the stack able headers and stack the shields. You'll notice that I have the WS2812 shield stacked on the battery shield, I could have just as easy stacked it on the D1 Mini and plugged the MP3 into the battery shield.

The Dual base shield, just fits with the shields stacked like the picture above. I left the MP3 hanging out the back of the ghost.

The MP3 play is a UART device - it operates at 9600 baud, and just needs the RX pin connected to pin D1 of the D1 mini (see pictures above). VCC connects to the 3v of the D1 mini, and Ground connects to ground.

A amplified speaker plugs into the MP3.

This current version, I do have to open the Ghost up to both charge the battery, and plug the battery in to be used. (This is a limitation of the battery shield, it doesn't have a on/off switch, and I considered cutting the one of the wires of the battery and adding a switch - I decided I didn't want to do this because I can still use the battery for the quad copter)

Step 3: Programming....

Picture of 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: https://github.com/esp8266/Arduino

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/esp8266/Arduino

And PubSubClient.h for the MQTT which I beleive is in the library manager, but can be found here https://github.com/knolleary/pubsubclient

Finally SoftwareSerial.h - pretty sure that is in the library manager as well.

The Code can be found here: https://github.com/kd8bxp/2017-Halloween-Cheerligh...

You will see there are two sets of cheerlights codes, one with sound and one without.

Other than adding sound, the code is the same. You'll also see code for the mp3_player - An option would be to use a 2nd micro controller to play sounds - it's really not need. But the Mp3_player code would run on the 2nd controller.

Open the "cheerlights_d1_mini_1_neopixel_mqtt...." sketch, and near the top, after the license you'll see where you need to change your SSID, and password for your WIFI. Nothing else should need to be changed.

In the Arduino IDE select the D1 mini from the boards list, select your serial port, and upload the code.

*A special note:

// Attempt to connect
uint32_t chipid=ESP.getChipId(); char clientid[25]; snprintf(clientid,25,"CheerlightGhost-%08X",chipid); if (client.connect(clientid)) { client.subscribe("cheerlights");

The code above attempts to create a unique client name for the MQTT server, it is using part of the MAC address of ESP8266.

* Another special note: For a little more on MQTT see my ESP32/ESP8266 WIFI Display Using MQTT Protocol

Instructable https://www.instructables.com/id/ESP32ESP8266-WIFI...

Step 4: Sounds & Usage

Picture of Sounds &  Usage

I googled for free halloween sound effects, and found a bunch, you'll want to grab 9 or 10 mp3s and put them on the SD card. Safely eject the card from your computer, and put it in the MP3 player.

That is pretty much it, plug the battery in, put the board inside the Ghost, and close the Ghost back up. In a few minutes you should be seeing a colorful display, and hearing spooky sounds.

Step 5: The Video --- Spooky!

Step 6: Update for D1 Mini and MP3 Player

Picture of Update for D1 Mini and MP3 Player

I wasn't real happy with the MP3 player hanging out of the back of the Ghost.

So I took a small proto-board, cut it down to the size of the D1 mini, and soldered some pin headers on it.

I then used a female to male header, bent the pins 90 degrees, and using some short wires, soldered the 3 volt, ground, and RX to the proto-board.

In the Ghost, the D1 mini dual board now sits up right, with the custom shield at the bottom, The LED is facing the front of the GHOST. I used a sharp knife and cut a small hole in the back of the Ghost for the speaker wire.

The big draw back is that it also covers at least part of the neopixel.

There are a lot of pictures above. I'm happy with the fact that the MP3 isn't seen, I'm not happy because it covers too much of the LED.

Step 7: Even Simpler Hardware...

Picture of Even Simpler Hardware...

About a month ago I ordered a X-8266 and a X-Ring. (I also ordered a X-battery, and X-OLED - I ordered the wrong X-Battery shield, and wrong X-OLED) These were for a different project, but since I have to wait for the new OLED and Battery charger to arrive. I figured I would make a slightly different LED pattern, and put this in the Ghost. It works very nicely.

A X-8266 is just another ESP8266 device with special "shields", the X devices (I have seen) can be configured to use different pins by dip switches on the device.

The X-Ring is has 12 WS2812 pixels and is in a ring, the dip switches are in the center of the device. I set mine to use pin D3 (A small change from the D1 Mini).

I found these for a good price on Aliexpress:

X-Ring - https://www.aliexpress.com/item/Aihasd-WEMOS-X-rin...

X-8266 - https://www.aliexpress.com/item/X-8266-ESP-WROOM-0...

I did make a mistake when I soldered the header pins the X-8266, and ended up putting the upside down (backward). I ended up putting a double male connector in the female connect on the X-Ring, so I could plug my X-8266 in the correct way (so simple fix really - and no unsoldering :-) )

I also added the code for the MP3, with the MP3 RX pin needing to be hooked to D8 on the X-8266.

Step 8: Updated Videos.....

I posted a video of the X-Ring and X-8266, and a Video of some of the sounds it makes with the D1 mini just sitting on my desk (not in the Ghost).

Comments

About This Instructable

645views

6favorites

License:

Bio: I am a Ham Radio operator, computer geek, currently a service tech, robotic hobbyist. I've been "playing" with microcontrolers for the last several years ... More »
More by kd8bxp:Using a Raspberry PI Zero W As an Access Point and MQTT BrokerWemos D1 Mini WIFI Robot (MQTT & UDP)ESP32/X-Project Cheerlight Badge Using MQTT
Add instructable to: