IoT Weather Display

The IoT Weather Display is a cloud in a jar that retrieves weather information from the cloud to change colors according to the weather condition outside. In addition to displaying the current weather information, it shows the time and date, an inspirational quote of the day, and a random so-bad-it’s-funny dad joke. It’s a handy little device to keep on your desk for viewing pleasure, because who knows when you’ll need to know it’s 79.87ºF outside? Or to be inspired by Confucius? Or to put your dad in his place with your superior dad jokes?

Engineer

Karen L.

Area of Interest

Computer Engineering

School

Homestead High School

Grade

Rising Senior

Reflection

Overall, I had a really enjoyable experience building my project, as well as at BlueStamp in general. I was initially interested in the program because of the freedom and independence it offered for students to complete their own projects, and I definitely got that. I liked that I was able to work at my own pace and decide what I wanted to do based on what genuinely interested me. I was able to personalize my project with modifications and truly make it my own. I learned so much in just six weeks and met people who have endless knowledge of and passion for engineering. This program allowed me to explore engineering in earnest, and I feel confident in my decision to pursue engineering in the future.

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. 

How It Works

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. 

 

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. 

Building Process

Challenges

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.

What I Learned

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.

Possible Further Modifications

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. 

How It Works

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. 

Building Process

Challenges

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. 

What I Learned

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.

Second Milestone

For my second milestone, I created IFTTT applets so that the NeoPixel ring changes colors when the weather changes and transferred the components from the breadboard to a perfboard and soldered them on. 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. 

How It Works

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. 

Building Process

Challenges

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. 

What I Learned

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. 

 

First Milestone

For my first milestone, I connected all the electrical components so that the Particle Photon can communicate with the NeoPixel ring to light it up. I added two momentary switches so that I could manually change the LED colors and turn it off.

How It Works

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.

Building Process

Challenges

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.

What I Learned

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 pins send data to the NeoPixel.

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.

How It Works

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.

Building Process

This project allowed me to get a lot of soldering experience. I’d never soldered before, but I sure have now. A lot. I learned 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, both of which will be helpful when building my main project.

STEM, engineering, coding, computer, summer program, high school, science, project, IoT, Internet, Particle Photon, API

Leave a Comment

Start typing and press Enter to search

Bluestamp Engineering