Introduction: Wave Lamp - Weather and Alerts

While browsing through thingiverse, I saw this absolutely amazing Wave Lamp and I HAD to build it.

https://www.thingiverse.com/thing:774456

The lamp is very well designed and prints without any supports (needs to be printed on the side)

Also, there is a lamp base that takes LED strips https://www.thingiverse.com/thing:904653

And of course, I couldn't simply leave it to be a bedside lamp. I had to make it wifi and show the weather. So, I'm using an ubiquitous ESP8266 module with WS2812B LEDs to control the colour of the lights based on today's forecast. Also, the light switches off automatically at 10:00 PM and switches ON at 6:00 AM.

Step 1: Requirements

You'll need the following items to create this wave lamp:

Tools:

  1. 3D printer - one that can print at least 30-35cm
  2. USB-TTL module to program the ESP-12E
  3. Hot Glue Gun
  4. Soldering Iron

Consumables:

  1. PLA - white for the lamp and another colour for the base
  2. 30 WS2812B Addressable RGB LEDs
  3. ESP8266 - 12E
  4. 74HCT245N
  5. 5V Power supply
  6. 5V-3.3V Power converter
  7. A few header pins and resistors
  8. Solder

Step 2: 3D Print

3D Print the following pieces

The Lamp

  1. Print using the white PLA rotated on the side
  2. Supports and Rafts are not required
  3. Though I did use a 5mm brim to ensure it stays stuck to the bed while printing
  4. I used the following settings:
    • 0.8mm volcano nozzle and 0.3mm layer height.
    • 2 perimeters
    • 100% infill (this doesn't really matter as the pieces are so thin, they get filled in anyways)
  5. Be warned - this is a HUGE print and takes a lot of time. So, if you're not comfortable leaving your printer overnight (or over several nights) this is not for you. Get it printed using 3Dhubs. Mine took ~30 hours

The stand

  1. I modified the stand using TinkerCAD to create a cavity in the base for the electronics. You can download it here: https://www.tinkercad.com/things/aYns42p1j8Q
  2. Print using the coloured PLA (I used woodfill):
    • 0.8mm volcano nozzle and 0.3mm layer height.
    • 2 perimeters
    • 20% infill
  3. Be warned though - the cavity I've created doesn't have any supports and the inside gets a little messy (especially with the woodfill PLA that doesn't bridge well)

The Top

This is an optional piece. I created it in TinkerCAD to hide the hole at the top of the lamp. It's nothing great, but works.

  1. https://www.tinkercad.com/things/5aD6V4O0jpy
  2. Supports and Rafts are not required
  3. I used the following settings:
    • 0.8mm volcano nozzle and 0.3mm layer height.
    • 2 perimeters
    • 30% infill

Step 3: Electronic Circuit

The circuit used for this lamp is extremely simple and if your WS2812Bs (some do, some don't) work at 3.3V signal, it's even simpler as you can then avoid the 74HCT245N.

The main circuit (see schematic above):

  1. ESP-12E (you can skip these steps if you use one of the pre-built modules from Adafruit, Sparkfun, etc):
    • Connect pins 3 and 8 to 3.3V
    • Connect pins 1, 11 and 12 to 3.3V through a 10k resistor
    • Connect pins 9 and 10 to GND
    • Connect pin 12 to GND through an open 2-pin connector. These pins can be connected together to program the ESP-12E
    • Connect pins 15 and 16 to header pins (these are RX and TX pins used to program the ESP-12E)
  2. 74HCT245N (ignore this if your WS2812B LEDs work directly at 3.3V)
    • Connect pins 1 and 20 to +5V
    • Connect pins 10 and 19 to GND
    • Connect pin 2 to pin 13 of ESP-12E
  3. WS2812B
    • Connect +5V and GND to the +5V and GND pins respectively
    • Connect the DIN to pin 18 on the 74HCT245N
    • If you're skipping the 74HCT245N, connect the DIN to pin 13 of the ESP-12E

Make sure all GNDs are connected together. Make sure you don't connect +5 or +3.3 to GND.

I had a couple of boards lying from an earlier project and simply used those (images above)

https://github.com/dushyantahuja/ESP8266-RGB-W-LED...

Step 4: Programming the ESP-12E

I used the Arduino IDE to upload the code to the ESP-12E. It needs some setup before you can do this.

Setting Up the Arduino IDE

The latest version of the Arduino IDE has made it easier to program these boards and you no longer have to go through multiple hoops to get it to work with the ESP8266 boards.

The steps are as follows:

  1. Download the latest IDE from https://www.arduino.cc/en/Main/Software
  2. Open the IDE and go to Tools -> Boards -> Boards Manager...
  3. Search for ESP8266 and click install (see image above)

Programming the Module

This module does not come with a USB interface, so you need to use a USB-TTL module / arduino to handle the USB communication with the computer. You can buy any one of the cheap modules available on ebay (http://www.ebay.com/sch/i.html?_from=R40&_sacat=0&...) - all work the same - only caveat being finding the correct drivers so that your computer detects the module.

The connections are pretty simple:

  1. Connect the GND from USB-TTL to the pin marked GND on the ESP-12E
  2. Connect the 3.3V from the USB-TTL to the pin marked VCC on the ESP-12E
  3. Connect the TX from the USB-TTL to the pin marked RX on the ESP-12E
  4. Connect the RX from the USB-TTL to the pin marked TX on the ESP-12E
  5. Short the Program header so that PIN 12 connects to GND

The module is now ready to be programmed.

Step 5: The Code

The code is heavily dependant on the tutorial on Random Nerd Tutorials https://randomnerdtutorials.com/esp8266-weather-fo... - as a matter of fact the weather bits are purely copied from there.

  1. Install the following libraries:
  2. Get a OpenWeatherMap API (https://openweathermap.org/api)
  3. Download the code from the github: https://github.com/dushyantahuja/Wave-Lamp-with-we...
  4. Make the following changes:
    • Wifi and Password on lines 56 and 57
    • City and API Key on lines 23 and 24
  5. Upload to ESP-12E

If all went well, the code is uploaded, your module connects to the wifi router and shows the weather. Currently, I've set up so that:

  1. If it's going to cloudy / rain - Blue
  2. If it's going to snow / thunderstorms - Red-Blue
  3. If it's clear - Green
  4. Else Rainbow - to account for special conditions / errors

You can make changes to lines 365-377 to change these. The Palettes used are on lines 70-82

Step 6: Assemble

Assemble the following pieces:

  1. Wrap the LED strip to the LED stand and stick with hot glue
  2. Insert the circuit module at the bottom and affix with hot glue
  3. Slide the wave lamp on the top of the LED stand
  4. Place the top on the top

Plug into a 5V power supply and enjoy

Step 7: Future Plans

It's working for now, however I plan to add the following features:

  1. Incorporate MQTT so that it can be linked to OpenHAB
  2. Maybe create some kind of notification feature for missed calls / messages
  3. Wake up light

Suggestions welcome. And if you create one, make sure to post an image here.

LED Contest 2017

Participated in the
LED Contest 2017

Epilog Challenge 9

Participated in the
Epilog Challenge 9

Arduino Contest 2017

Participated in the
Arduino Contest 2017