Introduction: Twitter Mood Lamps With ESP8266

Picture of Twitter Mood Lamps With ESP8266

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.

Step 1: Material

Picture of Material

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

Step 2: Schematics

Picture of Schematics

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

Step 3: 3d Printing

Picture of 3d Printing

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

Step 4: 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.

Comments

FredrikL11 (author)2017-01-22

Really nice project, trying to do something similar but when i try to connect to wefeel ESP just return TIMEOUT... You dont have any tips how to resolve this?

Hi,


Are you sure the ESP is connected to your WiFi properly?

There are 2 versions of the code on github

1. SSID and PASSWORD are hard coded
2. Connects to WiFi using an onboarding process with WiFiManager. https://github.com/tzapu/WiFiManager

Yes, I could connect to google and arduino.cc but not wefeel. Apperently it fixed it self when I ran a different library to test. Some setting in the esp probobly?

Now I got another problem, when I request the data, my "reply" is always the first row. eg. "HTTP1.1 200 OK" it looks like it skipps the whileloop to remove the headers. I tried with a delay before the loop but then I get a time out error. Maybe some loop to wait for client.available to be true and some timeout break? Gonna try that when I get home

ScoobyJ (author)2016-10-16

Hi!

Nice project! I have one question regarding libraries. Where can I get

"WiFiClientSecure" library?

Saltygal (author)2016-08-28

Beautiful!

DylanD581 (author)2016-08-24

Nifty WiFi mood lamps. I love the mushroom lamp!

TechMartian (author)2016-08-24

That is awesome!

About This Instructable

4,901views

89favorites

License:

More by The Screwed Scientists:Twitter Mood Lamps with ESP8266PiTank - A web controlled tank with cannon and live video streamScrewed Scientists' Air Cannon
Add instructable to: