Introduction: IOT Weather Cloud - Using OpenWeatherMaps
This is a cloud that hangs from the ceiling of a room and plays certain patterns based on the result returned from the internet. It retrieves the weather data from OpenWeatherMaps. It can be controlled manually through a web interface or automatically based on the data received from OpenWeatherMaps.
I have also set it up so that if you ever want to update the software to the cloud (i.e. if any new patterns are added or bug fixes are done) you can update the software over WiFi without having to plug into your computer. Just turn on the cloud and connect to it through the Arduino software. Press the upload button and enter the password and it's done.
There are ten patterns:
- Clear Clouds
- Spring Day
- Sunset
- Sunrise
- Cloudy
- Rain
- Snow
- Lightning Storm
- Rainbow Cycles
- Seizure Mode (this is a joke pattern that was a bug I decided to keep at my friends' suggestions)
Step 1: Materials and Tools
Materials:
Electrical:
- Wemos D1 Mini ESP8266 microcontroller
- Wemos D1 Mini female and male headers
- Wemos D1 Mini protoboard shield
- WS2812B RGB LED strip (5 meters of the 60 LED's per meter variant)
- 3 pin JST connector (1 pair)
- 2 pin JST connector (2 pairs)
- XT-60 connector (1 pair)
- 2.5 x 5.5 mm DC barrel jack
- 5V 4A wall-wart style power supply
- 10K resistor
- pushbutton with led
- 1000uf 25V polarized capacitor
- right angle pin headers
- 4 pin female dupont connector cable
- 4 pin .96" OLED display for Arduino SPI
- 2 core LED wire (16 AWG is what I would recommend)
Other:
- White PLA 3D printer filament (either 1.75mm or 3mm depending on the printer you use)
- White paper lanterns of various sizes
- Polyester stuffing for pillows
- Fishing line
- Eye hooks
- Cable anchors
- Zip ties
Tools:
- Hot glue gun
- Hot glue (a lot of it)
- Soldering iron
- 60/40 Lead flux core solder wire
- Knife
- Scissors
- Wire cutters
- Pliers
- 3D Printer
Step 2: Make the Cloud Shaped Frame
Plug in your hot glue gun and get out the paper lamps. Arrange about 10 or so of varying sizes into a shape resembling a cartoon cloud. Hot glue it all together making sure that it is possible to wire the LED strip though the lanterns without having to snake too much on the outside. Use lots of hot glue here. The more the better since it will hold together better.
Step 3: Putting in the Lights
String the lights throughout the "cloud". You don't need too many of the LED's in each of the lanterns. You just need enough of the strands to light it up. I had it so that it came in and looped around the bottom, exiting to go into the other parts of the cloud. Make sure to pull the LED strip tight so that you have just a tiny bit more length to lead through the lanterns. It might take a little bit of time to figure out how you want to string your lights. Not every lantern needs lights in it
Step 4: 3D Print the Case for the Microcontroller
Print the files for the case for the microcontroller. This case will hold the D1 Mini, the protoboard shield, display, button, and dc jack. Assemble it later once the electronics are done. The only setting that matters for this print is that you print it with just a skirt or a brim, don't use a raft. I found that .2mm layer heights worked great for me.
Step 5: Assemble and Install the Electronics
Assemble the electronics as shown in the images up above. Paying careful attention not to short the pins and make sure that everything is wired correctly before plugging it in. When connecting the lights to the control board make sure that the lights have a direct connection to the power supply using a thicker gauge wire to handle the higher current that they require (like the kind connected to the XT60 connector shown in the picture). Put the electronics in the case and screw it closed using M3 screws.
Step 6: Upload the Code
Plug the D1 Mini into your computer and open the Arduino software. Make sure that you have the D1 Mini board selected (if its not installed add it through the board manager). Choose the following setting as shown up above in the picture and then upload the code to the D1 Mini. This will take a little bit as the code takes a while to compile.
- Board: Wemos D1 R2 & mini
- Upload Speed: 115200
- CPU Frequency: 80Mhz
- Flash Size: 4M (1M SPIFFS)
- Debug Port: disabled
- Debug Level: none
- IwP Variant: v2 Lower Memory
- Erase Flash: all contents
Attachments
Step 7: Hang Up the Cloud
Attach fishing line to two or three points on the cloud, ideally spaced on opposite sides, Put the eyehooks in the ceiling where you plan to mount it and hang the cloud from the eyehooks using the fishing line. It is a good idea to have a cable run planned out before doing this as you will need some way to plug the cloud in and power it.
When setting up the cable make sure to chop the dc jack off of your power supply and solder it to the end of the cable used to power the cloud. Solder the other end of this cable to the power supply where you cut off the dc jack. Make sure to check all of the polarities so that you don't plug it in wrong and kill the LED's or board.
To hang the control box in the cloud connect a zip-tie to the ring at the top and hang it off of the inside of one of the lanterns where the LED strip starts.
Step 8: Making the Cloud Look More "Cloudy"
Cover the cloud in the polyester stuffing. It is easier to cover the cloud with the lights inside of it turned on, so as to see where there needs to be more added to cover the cloud. Use plenty of hot glue, I probably used around 50 sticks of hot clue attaching the stuffing to the lanterns. Use plenty of stuffing, and if it feels like it is off you can pull it off very easily.
Step 9: Setup the Cloud
Upon powering up the cloud it will create a WiFi network called, IOT-WEATHER-CLOUD. Connect to it, and it will redirect you to a setup page. If it doesn't redirect you go to the web page at 192.168.4.1
Press the configure WiFi button and login the cloud into your WiFi network. The cloud will kick you out of the portal once it is setup and tell you to log into the control page. After logging into your network, log your computer onto the same network as the cloud.
Step 10: The Website
To access the control page for the cloud, log onto the same WiFi network as the cloud. Press the button on the control box to turn on the display and show the IP address. Enter this IP address into the search bar to access the website. (Your IP address for the cloud will most likely be different than mine). To have the screen display the IP address simply press the button. I included this feature so that the screen won't be on all the time and suffer burn-in.
The website has three pages:
- The home page that shows the current pattern, and is the landing page for when you first log on
- The control page allows you to manually change the pattern or put the cloud into automatic mode, which plays patterns based on the weather data
- The config page allows you to change the location, username, password, and OpenWeatherMap API key
To access the control or config page you must enter the password and username in the pop up that shows up when you click on the link to either page. The default username is: admin and the default password is: password. These can be changed later if you so wish
To enable automatic mode you must enter in your city id and also create and enter in an OpenWeatherMap API key. The city id list can be found here: https://raw.githubusercontent.com/ZGoode/IOT-Cloud... Set the cloud to automatic mode on the control page to enable it. (I would recommend downloading the text file for the city ID list. It is massive and will lag your browser)
Step 11: Updating the Software Over WiFi
Turn on the cloud and ensure that it connected to the same network as your computer. Ensure that you have python 2.7 installed. You can download it here if you don't have it. This is what makes OTA work for Arduino. Without it OTA won't work. OTA is Over The Air (meaning uploading code over WiFi). This means that you won't have to remove the ESP8266 from your cloud to update the software.
To update the cloud open the Arduino software with the program, and under port select the network port. After this is selected you can upload the code by pressing the upload button like you normally would. That is all there is to OTA.