‹ SuperCollider Firmata 2Syntjuntan ›

Wireless MQTT Circuits

2016-11-25 14:29 electronics

I've started using MQTT for talking to microcontrollers over WiFi and here's some code and instructions on how to set up such a system.

There are two programs that have to run in the background. They handle all the communication between the wireless hardware and the client software (MaxMSPJitter, SuperCollider etc). One is Mosquitto. Mosquitto is a MQTT broker and the central pub/sub hub of the system. The second program is a Python MQTT-OSC bridge script using the Paho client. This Python script lets programs like MaxMSPJitter or SuperCollider talk to Mosquitto via OSC. See the readme.txt included below on how to install and configure these programs.

On the hardware side, I build send/receive circuit nodes consisting of an ESP8266-01 module and an Arduino Pro Mini. These circuits run on 3V, are small and configurable and the parts cost almost nothing. The ESP8266 module provides WiFi communication and runs a MQTT client (I'm using the Adafruit MQTT library), while the Pro Mini does the physical inputs and outputs (sensors, LEDs etc). The two modules talk to each other via serial.
Some circuits I've built do 12 digital + 8 analogue inputs, while others have 12 LEDs in combination with 8 analogue inputs. But any combination is possible and the number of ins/outs depends on how the Pro Mini is programmed. (See portable_promini_ana and portable_promini_led in the zip archive below.)

portable circuit photo 1 portable circuit photo 2

So far I'm really pleased with this new technique. It seems to scale well and work more reliable than what I used before (sending raw OSC via CC3000 or ESP8266).

‹ SuperCollider Firmata 2Syntjuntan ›