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!
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
Step 1: The Enclosure
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.
Step 2: Code...
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.
Step 3: Make the Connections
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.
Step 4: Setup Blynk
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.
Step 5: Setup IFTTT
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.8.131.52
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!
Step 6: Power On!
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!
Participated in the