iot, programming, raspberry pi, python, node.js, javascript,

Things on Thursdays: A Live Streaming Series

Simon Prickett Simon Prickett 8 mins read
Things on Thursdays: A Live Streaming Series

As part of my job as the Principal Developer Advocate at Redis, I’ve been producing a live stream series in which I take a look at how Redis or related concepts can be used with a variety of Internet of Things devices. These streams go out most weeks on Thursdays on the Redis YouTube and Twitch channels – check out our team’s schedule for links to future events.

So far, I’ve mostly focussed on work with the Raspberry Pi family of devices as that’s what I have on hand. I’ve been working on different projects across multiple streams and wanted to bring them all together in one place here so that you can follow along. I’ve tried to describe each project and link to the source code I produced where relevant. I’ve been coding in Python, MicroPython (for the Raspberry Pi Pico) and Node.js.

This is an ongoing work in progress, so please check back here for updates! I’m also always interested in ideas for topics to cover - if I have or can get hold of the hardware, I’ll certainly try out your suggestions. Get in touch with me if you want to share ideas, or even appear as a guest to work on something together. My only real criteria are that we should be using Redis or talking about data structures that Redis implements.

Here’s the videos and links to the relevant GitHub repositories and articles. Enjoy!

Series Introduction

In the first video I introduce the Things on Thursdays concept and the first project – building a Bloom Filter using LEDs on a Raspberry Pi, and talking to it using redis-cli and the Redis wire protocol. Coding in Python, I build a simple fake Redis server that implements some of the Redis Set data type commands.


Resources:

Redis Compatible Visual Bloom Filter Project

Episode 1

In this episode, I walk through my pre-existing Visual Bloom Filter project that uses a Raspberry Pi and a Pimoroni Unicorn Hat LED matrix. The code is in Python.


Resources:

Episode 2

In this second episode, I combine the fake Redis server that I made in the “Series Introduction” stream with the Visual Bloom Filter project, creating a Visual Bloom Filter than can be used from any Redis client. I demonstrate usage with the redis-cli and Node Redis client for Node.js.


Resources:

Redis Streams, Raspberry Pi Pico and MicroPython Project

Episode 1

Starting with a box fresh Raspberry Pi Pico W, I show you how to install MicroPython, connect to the device from Visual Studio Code and write Python code on it. I demonstrate how to connect to a wireless network, create a Redis database in the cloud and get started with streaming data to Redis.


Resources:

Episode 2

In Episode 2, I’ve soldered headers to the Pi Pico W and connected it to a Seeed Studio Grove shield. This makes it easy to attach Grove compatible sensors. I replace the code from episode 1 that sent a stream of numbers to Redis with code that sends temperature and humidity values from a sensor attached to the Pi. I also demonstrate how to read this data from a Redis stream using Node.js.


Resources:

Episode 3

In Episode 3, I add a light sensor to the existing temperature/humidity sensor on the Pi Pico W and stream data from that to Redis. I then look at how to modify the Node.js code that reads from the stream to remember how far through it was so that if it crashes or gets restarted it picks up from where it left off rather than at the start of the stream. I demonstrate how to use a Redis Sorted Set to model the 1:many relationship between sensor IDs and room IDs (one room can contain many sensors, one sensor can only live in one room) before finishing up by storing structured JSON documents in Redis representing the status of each room.


Resources:

Episode 4

In Episode 4, I address the issue of how to limit the memory consumed by the Stream of incoming sensor data, fix up some data type issues in the JSON documents and add a RediSearch index so that we can perform different sorts of query and aggregation over the dataset.


Resources:

Episode 5

In the 5th and final episode, I introduce a second Raspberry Pi Pico W running an LCD display and a small fan. I show how we can control it using a Redis List to turn the fan on when the room needs cooling down.


Resources:

CheerLights with Redis Streams, MQTT and Python

In this project, I show how to show and track the current CheerLights color on a Pimoroni Unicorn Hat connected to a Raspberry Pi. I subscribe to a topic on the CheerLights MQTT server, put the latest color into a Redis Stream and consume it on the Pi.


Resources:

Synchronized Counting with Redis Keyspace Notifications and a 7 Segment Display

Episode 1

This is a two week project in which I demonstrate how to count things using Redis, then synchronize multiple devices to display the current count. In the first week, I look at doing this for a web interface with Node.js and Express:


Resources:

Episode 2

In the second part of this two week project, I implement an additional counter and display using arcade buttons, a TM1637 7 digit display and a Raspberry Pi 3.


Resources:

Wifi Setup with Raspberry Pi Pico W

One of the problems associated with making and distributing IoT devices to consumers is dealing with having the consumer connect the device to their own wifi network. This is especially problematic for headless devices that don’t have displays or input mechanisms. In this video, I look at how to use Pimoroni’s Phew! templating system and a captive access portal to provision wifi credentials to a Raspberry Pi Pico W. The code is in MicroPython.


Resources:

What’s Next?

This is an ongoing series of projects, don’t forget to check out the Redis Developer Relations streaming schedule to see when the next episode will be. I’ll update this page shortly after each episode airs.


Main image: “Person using Appliance” by Alexander Dummer on Pexels.

Simon Prickett
Written by Simon Prickett
Experienced software professional.