Hope you like this Instructable.
I have reused both hardware and ideas/code from this:
https://www.instructables.com/id/Automatic-IoT-Sta... . Part of the animation code is by Adafruit (their strandtest example in the Neopixel library). The Larson effect code is inspired by:
https://github.com/technobly/NeoPixel-KnightRider Getting the outside temperature with openweather was inspired by:
Those stairs are in turn inspired by an older, less featured, less efficient and less stable version of this lamp, which can be seen at:
The first version of the lamp (dating back 1 year ago) was using an Arduino Uno + ESP8266. Both the stairs and the new version of the lamp use a Wemos D1 (R1 for the stairs, R2 for the lamp). In both these two last cases, the code is much more efficient and there is no lag between pressing a button and applying the effect. Stairs and lamp have slightly different functionalities.
Arduino-based connected ambient light. As for my first Instructable, I wanted to build a project having in mind three objectives: 1) it must be useful: many projects we can find on Internet are scientifically challenging, and many times they are cool&fun. But they may miss the long-term usefulness, or large audience impact. I wanted to build something me and my family would use everyday, so that readers would find it useful too. 2) it must look cool: I didn't want to end up with something which looks patchy, ugly, that nobody would like to show in his/her own house. Something as close as possible to a real product. 3) it must be fun: this is really for the builder :) something which you'd enjoy replicating and playing with, while meeting the criteria above. I tried to fulfill the above as much as possible, you're the judges, your views, favorites, and votes will be my measure of success! :) enjoy!
I like the idea of a "green" ambient light that I can control from the couch, so I made one and added a few features: a clock, an inside and outside thermometer, and a fireplace simulator :)
I used the following components, scroll down for the building steps:
1) 1m ws2813 rgb LED strips:
get the 60 leds/m version, either waterproof or non-waterproof. Note you can do this with ws2812 and ws2812b LEDs as well, the light will be exactly the same and these are cheaper. The ws2813 are just more reliable, as they have a redundant data connection, so if you break one LED, the rest of the strip will keep working.
2) an Ikea Dudero lamp:
This was 15€, roughly 18$.
3) as wifi-enabled micro-controller, I have used a Wemos D1 R2:
4) one 5v, 6a power supply, though you could probably find a much cheaper 4a one that would just do the job as well:
This was 28 euros, roughly 30 dollars.
5) a DHT11 thermometer for Arduino:
Roughly 2.50$, or 2 euros.
Step 1: Some Wiring
You need to realize the following connections, using some spare dupont cables:
1) Arduino -> Power supply: connect the positive of the power supply to the 5v of the arduino-based board. Connect the negative of the power supply to the GND of the arduino-based board.
2) LED strip -> Power supply: connect the positive of the LED strip to the positive of the power supply. Connect the negative of the power supply to the negative of the LED strip. Place a capacitor (I used a 1000uf one) between the positive and the negative (respect the polarity!) of the power supply.
3) LED strip -> Arduino: connect the data pin of the LED strip to pin D4 of the Wemos D1 R2. If you are using another Arduino-based board, check which pin(s) you can connect the LED strip to. They don't always support all the pins.
4) DHT11 thermometer -> Arduino and power: connect the VCC pin of the DHT11 to a 5v pin of the Arduino, the GND to a GND of the Arduino, and the OUT (or Signal) pin of another digital pin of the Arduino, I used D5.
Lastly, use a power cord to power the power supply.
Step 2: Fit the LED Strip
With some scotch tape, stick the power supply to the bottom of the body of the Dudero, and start going up in circle with the LED strip, fixing it with scotch tape, or with a few of those little cables made by iron and rubber normally used to close small packages like bread or fruit.
Step 3: Program the Wemos
Upload the attached sketch to your Arduino-based board via the Arduino IDE.
Replace the following strings as appropriate:
and also change the CityID with the one of your favorite place.
You're done :)
Check out the video for all the animations implemented on the lamp.
To control the lamp, I'm using a mobile app that I made myself with Ionic/Cordova, which is out of scope for this tutorial.
You can also control it via http using the c, m, s, v, and b parameters (check the code to learn what each of these does).
For example, opening the following url:
sets the lamp to display the outside temperature. For simplicity, I have limited the temperature display between 0 and 30 Celsius.