So, you have a CircuitPython project and want to connect it to the internet? You may want to consider adding MQTT to your project. MQTT is an extremely popular and lightweight protocol which can connect your project to the internet and quickly process network events.
MQTT is a small, lightweight protocol which is incredibly easy to use in scenarios where bandwidth is at a premium, your project is sending a small amount of data every so often, or if you'd like to process network events incredibly quickly (clicking a button would cause your project to do something).
- If you'd like to learn more about MQTT - check out its section in the All The Internet of Things: Protocols guide.
We've built a robust MQTT module for CircuitPython called CircuitPython MiniMQTT to quickly get you started connecting your projects to the internet and sending data around.
In this guide, you will set up your CircuitPython board with the necessary libraries, connect to the internet and connect your CircuitPython board to either a MQTT broker of your choice or the free Adafruit IO MQTT broker. We've included code-walkthrough and advanced usage sections to this guide so you can roll your own MiniMQTT project!
Parts
You'll need a CircuitPython board which either has network connectivity built-in or external network hardware .
All-in-One CircuitPython WiFi Boards
Don't want to add extra hardware to your project? Consider grabbing a board which has an ESP32 WiFi co-processor built-in!
Externally Connected CircuitPython Network Hardware
If you already have a project which uses a CircuitPython board without internet connectivity, you can easily add WiFi connectivity with an externally connected AirLift module.
WiFi
If you're using an Adafruit Feather, adding WiFi connectivity to your project is as easily as snapping the the AirLift FeatherWing on top.
If you're using a CircuitPython board with an Arduino form-factor, you'll want to pick up an AirLift Shield.
If none of the form factors above work for your project - we also have a breakout board which can connect to any microcontroller over SPI.
Ethernet
Wireless is wonderful, but sometimes you want the strong reliability of a wired connection. If your project is going to be part of a permanent installation, you'll want to add ethernet networking to your project.
- For more information about using Ethernet for CircuitPython with Wiznet5k, please see our guide here...
Text editor powered by tinymce.