Weather Lamp - Changes Colour With Temperature

by Arpan Mondal in Circuits > Arduino

1514 Views, 6 Favorites, 0 Comments

Weather Lamp - Changes Colour With Temperature

IMG_20190627_191342.png

Hello! How many times it happened that you were chilling under the air conditioner in your room, not knowing how hot it is outside. Imagine the condition of your pet. Neither it has an AC nor a fan. May be it's not quite common, but does happen few times. So I present to you the weather lamp!
This is actually an updated version of the ISS lamp that I built a few days ago. This project will show you how easy it is to build and customise the lamp. Enough of talking. What does the lamp actually do? Well It's simply a mood lamp that glows in blue. If the temperature outside rises above a set threshold, the lamp turns red. As simple as that. If you think it's too basic, you can customise it with RGB led to do anything and everything, almost. I've kept it simple for beginners. So let's get making!

Supplies

NodeMcu (esp8266)

Red and blue Led

Female to female jumper wires (optional)

Black chart paper Diffusion enclosure (or you can 3d print it)

5v DC adapter with micro usb cable

Blynk and ifttt apps

The Enclosure

IMG_20190606_120728.jpg
IMG_20190606_121315.jpg

Building the structure is easy. I used the same which I made the ISS lamp out of. Basically, I just popped open an old led room light and used the top diffusing portion. For the base, I cut a circular ring from chart that fits perfectly to the top enclosure.

Code...

Capture11.PNG

The program is actually quite simple. Use my code and change the part saying "Auth" with the Auth token that you'll receive after creating a blynk project. Replace "ssid" with your WiFi name and "password" with your WiFi password.
All it does is connects to blynk app. When ifttt app gets a trigger from weather underground (service), it triggers blynk, which in turn triggers the selected pin of the NodeMcu. Did it become an overdose? No worries, you can just download my code and upload to your NodeMcu. It should work fine. Oh and make sure you have the esp8266 and blynk libraries installed.

Not sure how to install those libraries? Click here for nodemcu and here for blynk

Downloads

Make the Connections

IMG_20190606_114115.jpg
IMG_20190606_114719.jpg

This is simple. Connect pin D1 to D7 and D2 to D4. Now connect the positive pin of the red Led to D5 and the positive pin of blue Led to D6. The negative pins of both LEDs can be connected to gnd of the node mcu. Done. See, easy.

Setup Blynk

IMG_20190606_125747.jpg
IMG_20190606_125826.jpg
IMG_20190606_125842.jpg
IMG_20190606_125901.jpg

Make sure you've signed up for blynk and logged in to the app. Create a new project and the Auth token will be mailed to you.. In blynk, click anywhere on the black screen to see the widget box appear. In the widget box, click on "button". You'll find that a button widget has been added. Click on it and select "PIN". Select gp5 from the list. Similarly create another button but this time select gp4.

Setup IFTTT

IMG_20190606_125522.jpg
Screenshot_2019-06-06-12-51-33-838_com.ifttt.ifttt.png
IMG_20190627_181754.jpg
IMG_20190627_181842.jpg
Screenshot_2019-06-27-18-17-11-628_com.ifttt.ifttt.png
IMG_20190607_141952.jpg
IMG_20190606_125635.jpg
Screenshot_2019-06-06-12-53-56-275_com.ifttt.ifttt.png
IMG_20190627_185902.jpg
Screenshot_2019-06-27-18-58-28-869_com.ifttt.ifttt.png
aed3bc36e9bd838b883040f72a29ccd997e7e148.png

Login to ifttt. Click on the 3rd tab (bottom right) and select the "+" symbol on top right. From there, click on "this" which should be in blue colour. Click on weather underground. Click on "current temperature rises above" and enter the temperature (say 35) and select Celsius. Then select your location.


Now click on "that" and search for "webhooks" on the search bar. Click on "make a web request" and enter the URL. Select "put" in the method section and select "application/json" in the content type. In the body, type ["1"]

The URL format is https://IP/Auth/update/D5 , Replace Auth with the Auth token of the blynk project and IP with blynk cloud IP of your country. To get the IP, open command prompt and type "ping blynk-cloud.com". For India, the IP is 188.166.206.43

Similarly, Create another applet, only this time select "current temperature drops below" in Weather underground. Also, the URL this time is https://IP/Auth/update/D4 All set! We're done!

Power On!

IMG_20190627_183904.jpg
IMG_20190627_183748.jpg
IMG_20190627_183729.jpg
IMG_20190606_123704.jpg

Just connect the 5v supply to the nodeMcu that's all. It is not instantaneous though. Weather underground takes quite a while to update the temperature. Anyway, if you leave the lamp powered on, it should work fine. This project is an update to the ISS lamp that is built earlier. My intension of making this was to show how easy it is to customize the lamp according to your needs. For example, I added another LED and now it glows red at hot temperatures, blue at cold and yellow in normal temperatures. You will surely start enjoying IOT once you start making these projects and playing around with the code. So this time I am not doing a code walk through. In case you're confused, you can have a look at the ISS lamp I built earlier where I did a walk through of a similar code.

I hope I could inspire you to try such diy projects out. Thank you!