[chuck-users] Serial/Arduino & ChucK example

Steve Morris steve at judgement.com
Thu Jan 2 23:19:42 EST 2014

In case anyone is interested Firmata is two things. 1) It is a piece of
software that runs on Arduino that allows sensors to be read via a serial
port protocol. 2) The serial protocol is also called Firmata or the Firmata
protocol. The Firmata protocol has a more or less midi format (sysex) and
can be parsed by standard midi interpreters/parsers. I haven't looked at
the ChucK midi support but it may be that 95% of the code needed for a
Firmata client is already in that package. In fact it might be easiest to
implement a Firmata client as a special mode of the standard ChucK midi

The nice thing about it is that the Firmata firmware gets serious
maintenance so you basically just load it to the Arduino and it works. It
can read most standard sensors that plug into the Arduino. It was
originally written to allow processing apps to read Arduino sensors and
display the results allowing processing to basically be a gui front end for
an Arduino. Firmata client libraries/plugins are now available in a variety
of languages including PureData as Alan mentioned earlier. It has become
the defacto way to access Arduino sensors from a remote host via a serial
port. ChucK absolutely needs someone to write a Firmata client library and
it should be bundled with the core ChucK package. It would make using
Arduino sensors in ChucK a simple plug and play, basically bug free
operation. A lot of work has already been done to connect various
sensors/controllers to music systems using Arduino/Firmata. Making all of
that work available to ChucK users would be a big win.

The protocol is documented here:


Firmata doesn't solve every possible Arduinio interface need but it covers
95% of what most people want to do.

-steve aka zencuke

On Thu, Jan 2, 2014 at 10:00 PM, Joel Matthys <jwmatthys at yahoo.com> wrote:

>  +1 to the Firmata interface idea.
> Joel
> On 01/02/2014 06:23 PM, Steve Morris wrote:
> someone should do a ChucK interface to Firmata. It is a good starting
> point. Maybe I'll give it a whack.
> On Thursday, January 2, 2014, Alan Brooker wrote:
>>  Hi Spencer/Steve,
>>  Thanks for your reply and thoughts, much appreciated...hmm I'm not
>> getting Arduino & ChucK to Communicate at the moment but I think I need to
>> work more on my Arduino code more to communicate with ChucK- up to now I
>> have been using Firmata with Pure Data, which only requires the the Firmata
>> sketch to upload. As you say there is a lot of stuff here to look at so
>> will report back :)
>>  Thanks again!
>> On Thu, Jan 2, 2014 at 2:54 AM, Spencer Salazar <
>> spencer at ccrma.stanford.edu> wrote:
>>> Hi Al,
>>>  If you check out the chuck examples folder that came in the chuck
>>> download or in the "Open Example" menu item, there should be a "serial"
>>> subcategory with some basic examples of communicating with serial devices
>>> (e.g. Arduino) in there.
>>>  What I would recommend is sending your 5 analog values as a space
>>> separated series of ASCII numbers, ending with a newline, and repeating
>>> this at whatever your desired refresh rate is. In ChucK, you can use
>>> onLine()/getLine() (as in the lines.ck example) to get each line of
>>> data, which includes all 5 current sensor values. There is also a
>>> (minimally documented) RegEx class you can use to pull out the values
>>> individually and then convert them to integers.
>>>  Ive also attached another ChucK example I have that does something
>>> very similar to this, except it reads only 3 sensor values and uses commas
>>> to separate values.
>>>  Thats a lot of stuff, so let us know if you have any more questions.
>>>  spencer
>>>  On Wed, Jan 1, 2014 at 9:59 AM, Alan Brooker <
>>> alan.brooker2010 at gmail.com> wrote:
>>>>   Hi there
>>>>  I am using ChucK (Chimera) with miniAudicle 1.3.0a on Ubuntu
>>>> 12.04- I think the latest version can communicate with Arduino directly?
>>>> Cant seem to find any examples so any advice  or example code would be much
>>>> appreciated. I am trying to build a simple step sequencer with *x5
>>>> potentiometer*s that send values to an arduino board and then into
>>>> ChucK hopefully. Was hoping I could do this without OSC-
>>>> thanks for helping this noob!
>>>> Al
>>>>  _______________________________________________
>>>> chuck-users mailing list
>>>> chuck-users at lists.cs.princeton.edu
>>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>> _______________________________________________
>>> chuck-users mailing list
>>> chuck-users at lists.cs.princeton.edu
>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> _______________________________________________
> chuck-users mailing listchuck-users at lists.cs.princeton.eduhttps://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140102/3021ad92/attachment.htm>

More information about the chuck-users mailing list