AdSense

Friday, July 14, 2017

3 - Raspberry Pi and ThingSpeak (II): channel for Sensor data


RASPBERRY PI AND THINGSPEAK (II): CHANNEL FOR SENSOR DATA

- Layout for this exercise:




1 - Creating a ThingSpeak Channel

- Once signed in the ThingSpeak account a New Channel can be created:




- ThingSpeak allows to collect and store data with the Channels tool:











- After creating the channel an API key is automatically available to be used for the communication between the Raspberry Pi module and the ThingSpeak web services:







2- Programming the sensor

- The Python program used in this exercise is an adapted version of this one:

https://github.com/simonmonk/raspberrypi_cookbook_ed2/blob/master/thingspeak_data.py


- Let's notice that the previously created API Key must be used in this program:





- The send_data function creates the web request providing the temperature to the field 1 (temp_c) of the channel, what will be display in the chart as the Y axis.


3 - Running the sensor

- Giving execution permissions to the Python script:




- Running the program, a series of of the Raspberry Pi CPU Temperature is generated:




- Let's notice that there is an increment of the CPU temperature (from 48.9 to 62.3 degrees) when a video is played on the Raspberry Pi:

https://www.youtube.com/watch?v=LNEEVsZt8vI




- The ThingSpeak channel shows a chart displaying the evolution of the Raspberry Pi CPU temperature along an interval of approximately 8 minutes: