Python all the time
- Colin Bell
- Aug 3, 2023
- 2 min read
Updated: Nov 25, 2024
At the end of July I travelled to Scotland to present some Internet of Things (IoT) training at an electronics company in Livingston. I presented this course on behalf of a training company- the course title was "IoT Programming with Python".
First - it was great to do this as an onsite course - this is a course that requires quite a bit of hardware (microcontrollers and sensors) and although I have done that kind of thing remotely before, using Zoom and a webcam to demonstrate how to build circuits, it's so much easier to see what is going on when you have the devices in front of you on the table.
Second - this was the first time I have used Raspberry Pi Pico devices as microcontrollers in a course like this. Previously I have used Arduino Nanos for this task, but as much as I love the Arduino family, the Pico's support for MicroPython straight out of the box makes them super convenient for a course like this.
In the course we used a bunch of different sensors, each attached to a Pico, then connected to a standard Raspberry Pi acting as a gateway, then sending the data up to the cloud. So we used Python in four different ways...
on the Pico, to read values from the sensors and send those values up to the Pi
on the Pi, to read and process the values from the Pico and call an API running on an AWS EC2 instance to post that data into a database
on the AWS machine, using FastAPI to create APIs so that we could post data to the cloud (and store it in a database) and get data from the cloud
on a local machine, to call the API and get data back from the cloud again, to analyse it using a tool like Jupyter Notebook
So there it is- end to end internet of things programming with Python. Doing a course like this and getting everything up and running in such a short space of time shows why Python has become the language that is so frequently at the top of lists such as the Tiobe Index.
Here are a couple of pictures from the course with devices under construction - naturally there was also some Lego involved... and as a side note, in place of standard LEDs to show outputs we used some very cool filament LEDs that I got from the Pi Hut.