Skip to main content

sensorAIRium - Turns air quality into an experience of light and sound - Part IV

In the previous part, we took a dive deeper into the world of PURE DATA, now we're going to have a look at the visual aspects of this project.

In order to make it look cool, we have recycled an old bedlight and torn out the lamp socket to have space for a neopixel ring with WS2812b LEDs. We are also having a look at how this can be synced to the generative music created by PURE DATA.

Bed light

Let there be... light!

In order to control the individual LEDs, we're using an ARDUINO microcontroller which takes care of controlling the individual LEDs. Interfacing the microcontroller with the Raspberry PI is pretty simple, it is recognized by the Raspberry PI as a serial interface. The idea is to provide basic functionality for controlling the lights which are generic enough so that no reprogramming of the ARDUINO is necessary at any time. The Arduino is receiving commands via the serial interface and also takes care of the smooth transition between the colour scenes. For the provided functionality, we're using a similar approach which is known from three dimensional sound formats such as DOLBY ATMOS where there is a sound bed and individual sound objects. The same approach would be applicable for the lighting: a light bed which "breathes" in sync with the chords and coloured light objects which are playing simultaneously with the melody. Based on the air quality, the colours are changing from blue/green to red/orange both for the bed and for the coloured objects.

Three basic commands

In order to facilitate this, the ARDUINO program provides the following three commands:

  • Light bed - with two parameters: colour and duration/blending time
  • Light objects - wth four parameters: colour, duration/blending time, position of the colour blob, size of the colour blob
  • Remove light object - wth four parameters: colour, duration/blending time, position of the colour blob, size of the colour blob

Neopixel ring

Using this approach, the LEDs can be perfectly synced to the soundtrack provided by PURE DATA. We're using again a Python script and the same TCP socket as before. Whenever there is a trigger, PURE DATA sends data to the python script which parses it and sends a command via the serial interface to the Arduino which in turn talks to the Neopixel ring.

In the forthcoming article, we'll show some audio-visual examples and provide a glimpse behind the scenes to provide you with all the information necessary to build your own sensorAIRium.

I am an IT expert which is interested in machine user interaction, music and arts. In the late 90s I have developed music instruments and music software. I'm working in the IT industry for over 20 years now - and it's getting more exciting every day. Programming and development of hard- and software components and doing music is something I do together with my kids in my leisure time.