Logging data and creating graphs may seem like a tedious task, especially if you are doing a science fair project or something else that needs monitoring. Instead of taking a reading manually, writing down the temperature with a pencil, and the copying it to a spreadsheet, you could have that all done for you automatically! Just add 5V and some code.
Some BackgroundFor my science project last year, I decided to see if light color affects plant growth. For that project, I had to measure the height of the plant plus the humidity and temperature levels. You can find that project here. I had used an ESP8266 Dev Board from Sparkfun, along with Thingspeak. It would have been nice to automatically put that into a Google Sheet instead of having it just on Thingspeak, which is where this project comes into play.
Video:Gather the PartsI chose a Particle Photon for this task as it is easy to use and interfaces well with IFTTT. I also got a DHT11 temperature and humidity sensor, but you can use any sensor you like depending on your data needs. Finally, I collected one 10k ohm resistor for the DHT11.
I created a new applet in IFTTT. For the trigger I chose the Particle Photon service that checks for an event being published named "Temp_Published". The action is a new row being added to a spreadsheet using the Google Drive service. It creates a spreadsheet named "Particle Photon Temperatures" and adds data to it periodically. Now that IFTTT is setup, it's time to add some code to the mix!
I went to https://build.particle.io/build and began to create my code. I began by including the DHT library, and then I specified the pin and type in the object constructor. Next, I made a function that reads the temperature and converts it into a string. Finally, in loop, I made it check every 10 seconds and then publish an event called "Temp_Published".
Now it is finished! I flashed the code to the Photon and wallah, in my Google Drive there is a spreadsheet that gets updated every 10 seconds with the latest data. And this could be for any sensor. You could plot light levels, distance, and even acceleration! Plus, you can make a really slick graph after you get enough data.
Comments