[Sharing is fun] SARCuino
SARCduino is a sensor acquisition protocol developed for the Arduino and Max/MSP environments by PhD and Staff of SARC. It samples the 6 analog and 12 digital pins of the microcontroller, and sends them to Max/MSP via the serial port.
What it is:
A simple way to poll data from the Arduino into max at a fixed sampling rate.
Also, there is a visualisation module that allows to check if your sensors are doing what they are supposed to do. Note that this module uses [multislider] for showing graphs and thus is not very efficient. The graphs should only be used for quick visualisation of sensor activity and not be left running constantly on the background.
What it is not:
A system to control the Arduino from max.
The patch has an OSC out section which can be used to send sensor data to other programs. MIDI out is being implemented but it will take some time before it is released.
Comments, suggestions and improvements are welcomed but do not expect full customer support. This firmware/patch has been used for the last 3 years in the interaction design modules at SARC and seems very solid.
you can download it here:
hope you find it useful
Thanks a lot for sharing.
Do you know if a sample rate of 1000Hz is ok (if I change the argument of your metro object ) ? I think it’s the maximum in Max scheduler, right ? But do you know if the Arduino can do the trick each ms ?
Hi C_° ,
It could kind of work but I would not recommend it.
At the moment there is no query of data from max to the Arduino, the latter is throwing data at a fixed sample rate that gets buffered in the serial port. From there, max gets the messages that have been passed by the arduino. To change the sampling rate you would need to change the metro in max and the sampling freq on the arduino sketch. However, the bottleneck would be serial-through-usb communication. We did try to see how fast it would go and had less than spectacular results with higher sampling rates. On the sourcecode of the Arduino sketch there are some links to the discussions on this.
We are sending 10bit values (0-1023) for six analog inputs and 12 digital. If you edit the firmware and the patch you could get up to 1k but not for all channels.
I am looking at a fully OSC version on my spare time but is nowhere near ready and it would require an ethernet shield on the arduino to bypass the usb/serial issue.