Wireless Analog Data to Max/Msp

If you are looking for a cheap wireless solution (<$10) for transmitting analog data to Max/Msp, this might be your ticket. In my case, the data originated from a 3-axis accelerometer, with each axis controlling a unique facet of the sound. I needed the wireless link to work within a range of about 5 feet of the transmitter. Here is how we got it done:

2- Arduino Microcontrollers*
1- XY-FST Transmitter (FS1000A)
1- XD-RF-5V Receiver
1- 3 Axis Accelerometer


Arduino IDE
VirtualWire Library

*I used a Arduino Nano and an ATmega328

On the transmit side, almost everything fit onto a micro-breadboard (the Nano is hanging off the edge). In addition to the accelerometer and the FS1000A transmitter, there is also a LM7805 regulator so that I can power the whole transmitter with a 9V battery. The Nano is collecting analog readings on pins A1-A3, packaging those readings (via VirtualWire) into a digital output message on pin D9, and then transmitted via the DATA pin on the XY-FST. See the photo below for the connections; see github for the transmit code.


On the receiving end, wireless data (on 433mHz) is captured by the XD-RF-5V, sent from the DATA pin to D11 on the ATmega328, then parsed by the microprocessor (specifically, the VirtualWire library) before being sent via the serial pins to the computer. The photo below shows the connections (it would look much cleaner on an Arduino board), and again, the code can be found via the github link. The main limitation of the posted code is that the length of the variables (i.e. accelerometer axis values) are hardcoded.


If you are following along, you should be able to see your data in the Arduino Serial Monitor now. The last step (pour moi) involved sending this data into MAX/MSP; easy!


The screen shot above shows how to capture the serial flow within MAX, parse the values, visualize the data, and then most importantly, sonify the data. In addition to the screen shot, the MAX patch is also available via github.

A few final things worth mentioning about the MAX patch:

1)  the serial port is hardcoded into the serial object (i.e., serial b); this may or may not match the origin of your serial port. Click the print button to see all available serial ports on your machine, and then replace the “b” in [serial b 9600] with the appropriate port (as displayed in the MAX window when you click print).

2) you may need to calibrate the serial data (i.e., tweak the scale objects) depending on your analog data source

3) in the data visualization, x and y are plotted in the 2D space of the LCD object; z is plotted along a color gradient.

The video below shows the final setup in action. Enjoy!

Github Link