Twitter Mood Lamps With ESP8266

by The Screwed Scientists in Circuits > LEDs

8745 Views, 99 Favorites, 0 Comments

Twitter Mood Lamps With ESP8266

57bd20782e7fb6161f000815.jpeg
mushroom lamp
1.jpg
wave lamp

One day I was browsing through Thingverse and came across these awesome looking lamps made by Markellov.I decided I wanted to make something out of them and settled on a Twitter Mood Lamp. The idea was to parse tweets and assert the general mood of the tweets which then gets translated to a color displayed by the lamp. I looked around and found this Instructable. However , it was quite outdated and the REST request to Twitter doesn't quite work the same way anymore. So I decided to create my own version.

Material

1463-00.jpg
2821-01.jpg
1138-00.jpg

I made two versions of the lamp. One in the wave shape and another one in the mushroom shape.Both shape needs to be 3D Printed

Wave Lamp :

Mushroom Lamp

  • Adafruit Feather Huzzah ESP8266
  • 5V Power Supply 1-2A

  • Micro USB cable

  • Neopixel ring 16

Schematics

schematics_wave_bb.png
schematics_mushroom_bb.png

The schematics for both lamps are very simple and require only a few soldering points.

The schematics shows a ESP8266 Huzzah instead of the Feather Huzzah but the principle is the same.

The one with the led strip is for the wave lamp and the one with the neopixel ring is for the mushroom lamp

3d Printing

DSC_9166.JPG
DSC_9171.JPG
DSC_9212-2_3000.jpg
1.jpg
lpp-47-l_preview_featured.jpg
y_preview_featured.jpg

Wave Lamp

  • https://www.thingiverse.com/thing:774456
  • Scaled down to about 80%
  • Make sure the led strips and esp8266 can fit in the middle hole
  • There should be a led strip with the leds facing inwards on each side of the square hole.This will maximize light coverage

Mushroom Lamp

Software Software Software

Get the the source code here

Since Twitter's REST API changed in V1.1, we cannot directly to request without authentication. I've looked into it and it seemed to be a lot of work. Instead , I found a 3rd party analysis website that does the the hard part for us

http://wefeel.csiro.au/#/

This website has its own REST API which we can easily access from our EPS8266. There are 6 emotions : Joy (green) , love (pink) , sadness (blue) , anger (red) , fear (orange).

So the general idea is the following.

When the ESP8266 boots up, we try to connect to the WiFi, if connection has not been made after 1 minutes, the lamp will display random colors and retry the WiFi every 5 minutes.

If WiFi has been established, we make a REST call to wefeel, and parse the results for each emotion and calculate the percentage of each emotion. Since joy is the dominant emotion, the lamp is going to display green. 30 minutes later, we do the same thing , but this time we evaluate what's the percentage of change for each emotion by subtracting the previous emotion percentage from the current emotion percentage. Then, we show the color with the biggest positive delta.

For the wave lamp, there are 4 animations available chosen at random , but only 1 for the mushroom lamp.