Introduction: Halloween Cheerlights

Picture of Halloween Cheerlights

In the last halloween I decided to create a project for the season. Using a 3D model of a ghost that i printed on the Prusa i3 and the Cheerlights project i created a Halloween decoration that changes color randomly.

The Cheerlight project is an open-source project that synchronizes all light devices that use’s it. Through Twitter, using the #cheerlight hashtag, we chose a color from the Cheerlights project color palette. All devices that are connected to the project Cheerlights read the color through the api and change their color to that. Through a tweet it is possible to change the colors of all the devices of the planet connected to the project.

Step 1: Materials and Tools

Step 2: Assembly

Picture of Assembly

First it was necessary to create the support for the connections. This was created using a protoboard, female sockets for the ESP-01 and solder. The female sockets allow to easily remove the ESP-01 for use in another project or to replace it in case of failure. The solder was used to fix the components and create connecting tracks. The protoboard comes pre-drilled and with connections around each hole. It is only necessary to fix the components and join the various holes to create the tracks.

Then the battery holder was soldered. At the same time, the base that will houses the components was printed. This consists of a square base, with enough space to house the various components, a led ring opening and enough space for the printed ghost.

After the base was ready, the led ring was installed and connected to the support of the remaining components. The support and the battery holder were fixed to the base with thermal glue.

Step 3: Code

The code will connect the ESP-01 to the wireless network and then connect to the cheerlight project and check the current color. It then changes its color to the color of the cheerlight project.

For the code to work, three libraries are required:

  • ThingSpeak - to connect to Cheerlights project
  • ESP8266WiFi - to use the ESP-01
  • Adafruit_NeoPixel - to use the led ring

Code (you can find it at my GitHub Account)

#include < ThingSpeak.h >
#include < ESP8266WiFi.h >
#include < Adafruit_NeoPixel.h >

#define PixelPin 2
#define PixelNum 12
const char* ssid = "dev";
const char* password = "RatoRoeuRolha";
unsigned long cheerLightsChannelNumber = 1417;
int delayval = 500;
String colorName[] = {"none","red","pink","green","blue","cyan","white","warmwhite","oldlace","purple","magenta","yellow","orange"};</p><p>// Map of RGB values for each of the Cheerlight color names
int colorRGB[][3] = {     0,  0,  0,  // "none"
                        255,  0,  0,  // "red"
                        255,192,203,  // "pink"
                          0,255,  0,  // "green"
                          0,  0,255,  // "blue"
                          0,255,255,  // "cyan",
                        255,255,255,  // "white",
                        255,223,223,  // "warmwhite",
                        255,223,223,  // "oldlace",
                        128,  0,128,  // "purple",
                        255,  0,255,  // "magenta",
                        255,255,  0,  // "yellow",
                        255,165,  0}; // "orange"};
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PixelNum, PixelPin, NEO_GRB + NEO_KHZ800);
WiFiClient wclient;
void setup() {
  Serial.begin(9600);
  WiFi.begin(ssid, password);
  WiFi.mode(WIFI_STA);
  Serial.println(".");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Ligado a ");
  Serial.println(ssid);
  Serial.print("Endereço IP: ");
  Serial.println(WiFi.localIP());
  pixels.begin();
  ThingSpeak.begin(wclient);
}void loop() {
  String color = ThingSpeak.readStringField(cheerLightsChannelNumber, 1);
  setColor(color);
  //Serial.println(color);
  delay(5000);
}void setColor(String color)
{
  for(int iColor = 0; iColor <= 12; iColor++)
  {
    if(color == colorName[iColor])
    {
       for(int i=0;i < PixelNum;i++){<pixelnum;i++){  ="" pixels.setpixelcolor(i,="" pixels.color(colorrgb[icolor][0],colorrgb[icolor][1],colorrgb[icolor][2]));="" moderately="" bright="" green="" color.="" pixels.show();="" this="" sends="" the="" updated="" pixel="" color="" to="" hardware.="" }="" return;="" }<="" p=""></pixelnum;i++){></p><p>        pixels.setPixelColor(i, pixels.Color(colorRGB[iColor][0],colorRGB[iColor][1],colorRGB[iColor][2])); // Moderately bright green color.
        pixels.show(); // This sends the updated pixel color to the hardware.
      }
      return;
    }
  }
}


Step 4: Final Steps

Picture of Final Steps

The ghost was printed on the Prusa i3 using transparent PLA to allow the passage of light.

Finally the battery was installed and the ghost placed.

Sendind a tweet with "#cheerlight red" switch the color to red.

Comments

About This Instructable

234views

3favorites

License:

Bio: https://about.me/tiago.santos
More by TiagoSantos:Halloween CheerlightsLightbox With Controller and StorageAquarium Controller Using NodeMCU and MQTT
Add instructable to: