IoT Weather Indicator

The IoT Weather Indicator is a cloud in a jar that retrieves information from the cloud to change colors according to the weather outside.


Karen Li

Area of Interest

Computer Engineering


Homestead High School


Incoming Senior


Demo Night Presentation

Final Milestone

For my final milestone, I made several more modifications and put everything together for a finished final product. I switched from the 16×2 LCD to a 20×4 LCD for a larger display, added different modes of display on the LCD that can be switched through with a button, and created a webhook so that, through Twilio, a text message is sent to my phone at 7 am every day with the daily weather report. I also added a sensor so that if I wave my hand in front of it, the device will turn either off or on. Then I soldered all the components onto a perfboard to make all the wiring more neat and compact. I filled the jar with cotton balls, placing the NeoPixel ring in the middle so that it would give the appearance of a lit up cloud. I hot glued the LCD on top of the lid and hid all the electronics inside the lid for nicer presentation.    The transition to a larger LCD was simple, and I just had to switch up the initialization and some syntax in the code. I wanted to display more than just the weather, so I added different modes on the LCD to display the time and date, a random inspirational quote of the day, and a random joke of the day. For the quote and the joke, I used webhooks to get them from a quote API and joke API, as I did to retrieve the weather information. Once the web request is triggered, the quote or joke is returned to the Photon, and I coded in Particle to parse and display it. To be able to switch between the different displays, I created a variable to represent the mode, with 1 representing the first display, and so on. Then I used a series of if statements in the code to print only the text corresponding with the mode. I connected a button to the Photon and coded in Particle so that when the button is pressed, the mode variable is incremented until it reaches the last mode, upon which it switches back to the first one. I added another webhook that uses Twilio to send me a text message from my Twilio number. In this way, the user can switch through all the modes. In this case, I used a POST request, since I am sending information rather than receiving it. In the form data on the webhook, I specify the number that’s sending, the number that’s receiving, and the text to be sent, which is retrieved from the code. I also added an ultrasonic sensor for an easy way to turn it on and off. The sensor returns the distance that an object is away from it. I created a boolean variable to keep track of whether the device is currently on or off. If the object is very close (since I don’t want it to accidentally be turned on or off), the variable switches to the opposite value. If the variable is false, the NeoPixel is turned off and the LCD cleared. If true, the code is run.  I learned about the capabilities and limitations of an LCD screen, since I needed to work a lot with the display of the different modes. I learned how to use the C++ array equivalent, the vector. I didn’t know C++ before this project, so I’ve been teaching it to myself along the way. I also worked with an ultrasonic sensor for the first time. It sends a pulse and then receives an echo if it bounces off an object. The echo pin on the sensor receives this, and then calculates the distance using the time between sending and receiving the pulse.   Surprisingly, I had the most difficulty with the display on the LCD. Getting the information from the webhooks was relatively simple, since I had already gone through all the trial and tribulation with getting the weather information. However, displaying it onto the LCD was more of a challenge than expected. The LCD prints from line 1 to 3 to 2 to 4, so the quote and joke appeared jumbled. I had to split up the text into lines and set the cursor to print line by line. Also, most of the time the quote or joke would be too long to fit on the screen, so I created an array to store the lines as Strings and used a for loop to scroll through the entire text.   If I were to make more modifications, I would make it more interactive. For example, instead of only receiving a text message weather report at 7 am every day, I could set up a server so that if I text a certain message to the Twilio phone number, it will respond to me with the current weather information. It’d also be fun to add a voice control feature.

Third Milestone

For my third milestone, I used a webhook to connect the Particle Photon to the DarkSky weather API to get current weather information and for more specific weather data, such as temperature and chance of precipitation. I also added an LCD screen to display all this data. I combined my code for lighting up the NeoPixel ring with my code to display weather data on the LCD so that the ring changes colors according to the weather condition displayed on the LCD.    Using the weather API allows weather information to be displayed at all times instead of waiting for the first weather change for any data to be shown. I also realized that it is impractical for the weather data to update only with each weather change, since the weather doesn’t change much but the temperature is constantly changing, so I updated the code so that the Photon receives current weather data from the weather API every 15 minutes and updates the LCD screen with the new data.    Webhooks are used to send info to and get info from services and apps on the Internet. I used a GET request type, since I want to get data from the weather API. The webhook listens for an event published by the Particle Photon, which then triggers a web request to the weather API URL. This tells the API to send the requested information back to the Particle Photon. I parsed the data to get the weather information I wanted and displayed the data on the LCD.    Through this process, I learned how to use webhooks, which was really interesting because they gave me access to a lot more information than IFTTT did, which I could use for more advanced modifications. I also learned how to use an LCD and display text on it.   One challenge that I faced was figuring out how to get the information from the API. When making the webhook on Particle, I had to make sure to input the correct query parameters to get the correct information as well as to code in Particle to trigger the webhook and receive/handle the data correctly.    My next step is to add some more modifications before putting it all together for a finished product.

Second Milestone

For my second milestone, I set up my IFTTT functions so that the NeoPixel ring changes colors when the weather changes and also transferred the components from the breadboard to a perfboard and soldered them on. The IFTTT functions link the Weather Underground app to the code in Particle so that a change in the weather condition will trigger a color change on the LED. To make it more compact and presentable, I got rid of the momentary switches, since those were simply for testing, and attached the Photon pins directly to the ring through the perfboard.    I created an IFTTT applet for each possible weather condition. Then, when the weather condition changes to any one of these, the IFTTT applet is run, which calls the function that is registered in the code in Particle. In the code, I created a variable to represent the weather condition, with each one represented by an integer value. When the applet is triggered, the code sets the weather variable accordingly, and then this value is used in a series of if statements to set the color of the NeoPixel ring. Transferring the components from the breadboard to the perfboard strengthened the connections and made everything more neat and compact.    Through this process, I learned how exactly the Photon transfers data through a single pin to a single hole in the NeoPixel ring to light it up. It uses PWM, or pulse width modulation, to communicate the color dictated by the code. In the Particle code, I defined colors by their RGB values, and then the Photon sends either a 0 or 1 through the D4 pin over different intervals of time to convey the color. The differing time distinguishes between the RGB number values. The LEDs on the NeoPixel ring are connected in a line in a certain order, so the data is sent to the first LED and so on until the entire ring is lit up.    One challenge I faced was figuring out how to test the NeoPixel ring once I set up the IFTTT applets and made the connections between the NeoPixel and Particle Photon, since I am unfortunately unable to change the weather at my will. However, I figured out that I could directly input the argument into the function to make sure the NeoPixel changes colors when the weather condition changes. For example, if I type “RAIN” into the “Led” function on the Photon, the NeoPixel ring lights up indigo, which is the color corresponding with rain.    The technical parts of my project are finished now, and I only have to put it all together to be finished with the original project. I finished much earlier than expected, so I plan to dedicate the rest of my time to making modifications and making the project more advanced and personalized.    My next step is to add some more modifications before putting it all together for a finished product.

First Milestone

My first milestone was connecting all the electrical components and lighting up the NeoPixel ring. I used a breadboard to connect the Particle Photon to the NeoPixel ring so that the Photon can send information from the cloud to control the ring lights. I used two momentary switches so that I could manually change the LED colors and turn it off. One circuit connects the VIN pin on the Photon to the PWR hole on the NeoPixel ring, powering the LEDs. The D4 pin is directly connected to IN on the ring, which receives data from the Photon. The third circuit connects the 3.3 V pin to the two momentary switches to power them, and these are connected to the D2 and D3 pins, which sends data from the Particle code to control what happens when the momentary switches are pressed. One switch changes the LED colors and the other turns the ring off. After connecting the physical components, I connected the Photon to the WiFi and coded on Particle to control what happens when the momentary switches are pressed.   The main challenge I faced reaching my first milestone was connecting the Photon to the WiFi, and without that connection, the NeoPixel ring couldn’t light up. It was also difficult getting the ring to light up, but I realized it was due to the wiring, and once I switched it out, it was fine.   I learned how to connect circuits through a breadboard and the reason for different connections between the Photon and NeoPixel ring. For example, the VIN pin is connected to the PWR hole because it supplies the power needed to light up the ring and the D-something pins are for data input.   Next, I’m going to set up the IFTTT functions so that the ring will change colors according to the weather.

Starter Project: MintyBoost

For my starter project, I built the MintyBoost, which is a portable USB charger. This uses a boost convertor chip, a power inductor, a diode, resistors, and capacitors to convert 3V from two AA batteries into 5V, which is transmitted through the USB jack to charge a USB powered device.   The resistors are used to limit the current, as can be observed through Ohm’s law. They are also used to determine the kind of charger that is connected. The first type of capacitors that are used are ceramic capacitors. The first one smooths out the output voltage, and the second one is used to stabilize the converter chip to make sure the voltage is precise. The second type of capacitors are electrolytic capacitors, which store charge and smooth the input and output voltages to keep them stable during the step up. The diode ensures that the current only flows in one direction, from the batteries to the USB port. The power inductor and boost converter chip store the power passing through to convert the 3V from the batteries to 5V for charging the plugged in device.   This project allowed me to get a lot of soldering experience. It’s not easy, but I think I’ve improved–at least, I better have improved, or I’ll have inhaled all those solder fumes for nothing. I realized that the direction of certain parts matter when I messed up and inserted the boost converter chip in the wrong direction, which caused a short circuit. I also learned how to desolder and strip wires, since the wires kept breaking off the circuit board. It was really interesting to learn how all the individual parts of the circuit worked together to transfer energy to charge a phone. I’m glad I chose this project because it gave me soldering experience and allowed me to learn about different circuit elements and their functions.   Next, I’ll be starting on my main project, which is the IoT Weather Indicator. My first milestone for this project is to set up the physical components before moving on to the coding. This includes connecting the wires to the NeoPixel ring and the Photon to establish a connection.

Leave a Comment

Start typing and press Enter to search