IoT ThingSpeak

IoT ThingSpeak

In this tutorial, we'll use CircuitPython to update fields in ThingSpeak, an open IoT platform that allows us to aggregate, visualize, and analyze live data streams. 

 

Gathering Credentials

Login to your Thingspeak account, if you still don’t have one, you can create one through this link login to ThingSpeak.

Then, create a new channel and enable Field 1, 2 and 3. Save your channel.

 

 

 

You can find the API key in your ThingSpeak account under the API Keys tab of your selected channel. 

 

 

Fill in your Wi-Fi SSID and password, along with the ThingSpeak Write and Read API key in settings.toml file.

 

 


The CircuitPython Code

First, you'll need to copy the files from the 'IoT_Thingspeak' folder on Github and paste them onto your CIRCUITPY drive. 

 

Below, you'll find the CircuitPython code needed for this project. It includes functions to connect to your Wi-Fi, generate dummy values, and update these values in the ThingSpeak channel.

 

Flash the codes to your Raspberry Pi Pico / Pico W. And your CIRCUITPY drive should look like this:

Library file(s) required:
    adafruit_httpserver folder, adafruit_neopixel.mpy, adafruit_simpleio.mpy
File(s) required:
    settings.toml

 

Finally, run the script and verify that the data is being updated on your ThingSpeak channel. You should be able to visualize the changes on the ThingSpeak interface.

 

 

Congratulations! You've just completed an IoT project using CircuitPython and ThingSpeak! As next steps, you can replace the dummy values with real sensor data, or integrate this script into a more complex IoT system.
 

Hardware Components

Robo Pico

$14.90 $14.90

x 1 unit(s)