Figure 1
Figure 2
Figure 3
Figure 4
The team started by installing and initiating gspread, oauth2client, and psutil. Then, on Google's API admin console, a project was created for the lab. The Google Drive API was enabled and credentials were generated for secure sign-on. Following this, a Google Sheet was created from the Raspberry Pi and data was inputted into the sheet. Overall, the lab demonstrated that Google Sheets could be integrated into the Raspberry Pi's workflow.
Figure 1 shows the projects created using the Fliqr google account. The project rpidata is being used this lab. The service account shown in Figure 2 shows the rpidata email and key in the json file.
For this lab, the team created a ThinkSpeak account and opened the cpu_loop channel. In this channel, some of the settings were altered to allow support for cpu_pc and mem_avail_mb. Next, the ThinkSpeak API was enabled on the Raspberry Pi and an API token key was generated to allow support between both platforms. Once the ThinkSpeak API was linked with the Pi, the thinkspeak_cpu_loop.py program that was provided by professor Lu was then executed.
The json file opened on the pi in Figure 3 shows all the data in the json file such as email, project id, and the private key. The python script that will be running to display the sensor data in the Google Sheet is displayed in Figure 4. Error messages, output messages and where the output will be located in the sheet can all be seen here.
The time between measurements was changed to 3 seconds to update the sheet faster, and is shown in Figure 5. In this screenshot, multiple measurements have been taken which show up in the Google sheet shown in Figure 6.
Figure 5
Figure 6