If you do not want to host your own MQTT broker, using Adafruit IO's MQTT broker is a great way to get started connecting your CircuitPython project to the internet. Best of all - it's free to use!
You're going to build an Adafruit IO Dashboard which can visualize incoming data from your CircuitPython board, and send data to it.
If you have not already, sign up for an Adafruit IO account by clicking this link.
Next, you're going to need your Adafruit IO username and secret API key.
Navigate to your profile and click the View AIO Key button to retrieve them. Write them down in a safe place, you'll need them later.
Adafruit IO uses a special type of MQTT Topic named a Feed to store data along with metadata (information about the data). You'll be publishing data to one feed, and subscribing to another.
Create two new Adafruit IO Feeds named onoff and photocell.
If you have not created an Adafruit IO Feed before, follow this page and come back once you've the created two feeds above.
Adafruit IO Dashboards are a way to interact with feeds. You can link blocks on dashboards to your feeds. The blocks can either display information about the feed (such as the current temperature) or allow you to interact with a feed by setting it to different values.
Start by creating a new dashboard. Name it whatever you'd like!
- If you do not know how to create a dashboard, head over to this page and come back here when you've successfully created a dashboard.
Create a Gauge Block
After creating a dashboard, create a Gauge Block to display the value of the Photocell feed.
If you do not know how to add blocks to a dashboard, head to over this page and come back when you've added a gauge block to your dashboard.
Create a Toggle Switch Block
To send values to the onoff feed you created - create a toggle switch block.
Your dashboard should look like the following: