Arduino on Firmata

Hey,

The Firmata Component has moved into the Palette starting with build 088.50180

attached is a little experiment to send and receive stuff to and from the Arduino using the Firmata API.
Firmata seems essentially to be an Arduino sketch which let’s yuo configure and control the Arduino using messages formated as Midi. A good introdction for whoever is interested can be found here: firmata.org/wiki/Protocol

So what does it let you do? Well, first:

  • hook up your Arduino
  • upload the StandardFirmata Sketch from the Examples/Firmata folder
  • after successful upload start the attached TouchDesigner toe and go into /project1/firmata and select the right COM Port on the serial1 DAT
  • toggle thee Active Parameter of the serial1 DAT off and on --> you should be seeing messages coming into the serial1 DAT

now go one level up to /project1, here you find:

  • a pinCapabilities DAT telling you what each pin of your Board can act as
  • a pinSettings DAT telling you what each pin is currently set to
  • a firmataVersion DAT informing you off the Firmata Sketch and Version uploaded to the Arduino as well as
  • an analogValues and digitalValues CHOP, showing you the pins output

on the input side to the firmata COMP you find:

  • a constant CHOP called values to set pins to certain values
  • a constant CHOP called mode to tell the pin what it should act as (there is a Table DAT called modes docked to the firmata COMP informing you of what value maps to what mode)
  • as well as a Report Analog and a Report Digital Button which enable feedback from the Arduino to TouchDesigner.

Not yet implemented are the I2C and Shift Modes, if anybody has information on how to do that best, I’d be really interested to see this working
Also I ran into a problem with my Arduino Mega, not all pins would report correctly, wonder if my mega somehow is faulty? Further when connecting a servo I had sitting here for a long time, the Arduino would reset, so the servo functionality is not fully tested yet.

If you like to further develop the extension or this patch, the Firmata class sits in /project1/firmata/local/modules/firmata

Anyhow. I hope this is good use for some people. Firmata seems to be great to get a quickstart in using the Arduino as a pure input/output converter for all kinds of Sensors and Devices and keep all the logic inside TouchDesigner.

Cheers
Markus

I’d been meaning to ask if anyone had tried Firmata with Touch. Thanks Herr Snaut!

I have used PDuino a lot which is a custom firmata to interface arduino directly with PureData.
en.flossmanuals.net/pure-data/se … ng-pduino/

it would be worth having an arduino CHOP to use firmata flashed to an arduino to make it a dumb I/O board for touch.

thanks again, will have a play with it on the weekend.

Rod.

Hi Rodney,

that’s what the COMP is trying to be, a fairly simple way to read and write to/from a Arduino which has been loaded with the standard Firmata sketch.

Let me know if it is of any use to you.

cheers
Markus

Thanks Snaut!!!
This is Awesome!

Does anyone know how to create tones on a piezo module using this? I tried sending the digital pin a square lfo but I can’t get anything resembling smooth tones.

Hey,

for the piezo speaker you would have to use PWM mode.

cheers
Markus

Hi Snaut!.
First, thanks for your pioneering work. I am looking into firmata as an (hopefully) simpler way to interact with steppers (simpler than serial msg parsing anyway :wink: ).
Naturally I have a bunch of questions.

1)I was apparently under the mistaken impression that firmata would be more like a ‘firmware’ mod of the Arduino, but it seems it is ‘only’ a sketch upload. (Maybe that is all that is really possible with an arduino anyway? Or maybe Im just not unnerstanding the Arduino paradigm correctly?)…

2)Why do they use the ancient MIDI protocol? (maybe I dont really want to know, as once the talk turns to Most significant/Least Significant bits/ nibbles et al, my eyes kind of glaze over and I try my best to understand …maybe I dont need to know thks to your work!)(why not a more modern protocol like OSC, as example ?)

3)is there a way to communicate to a firmata’d Arduino other than serial/USB? Ethernet perhaps ?

  1. I gots a warning msg from my Diecimila: ‘low memory, stability problems may occur’ - looks to be about 84% full after uploading the sketch. Is my dfiecimilla just too old and small you think ?

any insights aprec.

I will answer #4 myself: diecimilla is old and small. I switched to an UNo and the problem went away

  1. imo, its great that its a sketch, in that it allows users to upgrade/tweak/develop it using the exact same set of tools they use for any other Arduino development.

  2. My guess is because MIDI is a very simple protocol without much overhead (all messages start with a value > 127) etc. Things like OSC would require much more sketch space devoted to parsing.

  3. I don’t have any experience with them, but I found a few references online about firmata branches supporting ethernet. Maybe the arduino forum is the best place to ask.

  4. Haven’t seen that before. Wonder if its really a problem, or if firmata memory usage is relatively constant (as most embedded systems usually are).

Rob.

@cod65

I have used Firmata for a while and think it is great.

If you are interested in Firmata I would encourage you to checkout the wiki: http://firmata.org/

It answers your questions. To chime in on what @rob said:

The Firmata project is intended to be a Firmware for arduino, (that’s how it got the name) and I think it does a pretty good job.

Everything from Touch to a browser to MAX / MSP can interact with Firmata all using the same sketch on Arduino.

http://firmata.org/wiki/Design_Issues Answers this exactly. It goes over why the original author chose to use MIDI instead of HID or OSC. Hint, Rob was right.

  1. I have communicated with an Arduino running Firmata wirelessly over Bluetooth, however, that was still via serial. You can do serial over lots of transports.

The Tox file is not here anymore?

Its in the palette now.

Is it possible to change the Baud Rate? I’m running into issues when I go into the component and change the Baud Rate on the Serial Dat

Hey folks,

Would anyone be able to confirm whether or not the Firmata.tox (from the palette) will work with the Circuit Playground Express board running Firmata?

learn.adafruit.com/circuit-play … a/overview

Also, it appears that the Firmata main site is down, maybe has been for a while?
firmata.org/wiki/Main_Page

Any tips or pointers on how to get sensor data from this board into Touch would be appreciated. Thanks :slight_smile:

-Casey

I am having trouble with the firmata componant from the pallette manager. I am trying to simply switch a digital pin on and off. I have selected mode as output for the pin in the pin modes tab, and have connected to the correct serial port. I even see my little arduino blink when i toggle the serial connection. This seems to happen on multiple arduinos (tried on two micros and two megas) with different usb cords and with both the current and older versions of standard firmata.

Any ideas?
FIRMATA 3.jpg
FIRMATA 2.jpg
FIRMATA 1.png

Has anyone had any luck with getting firmata->Report Digital Pins to work ? ‘Report Analog Pins’ is reporting the analog pin values correctly, but ‘Report Digital Pins’ doesn’t seem to update ever. The actual firmata functionality is working fine and I’m able to set the values of my output pins no problem. When I try and monitor ‘Output 2 (CHOP) Digital’ the values just remain at 0.

TD 099: Non-Commercial 64-Bit Build 2019.15230
I’m using the default firamta tox that comes in the palette menu.
Screen Shot 2019-05-28 at 12.27.14 PM.png

Hey,

which Arduino Board are you using? I know there are problems with the Mega…

Cheers
Markus

An issue I’m encountering is that the serial DAT’s active parameter export is not working. When I disable/enable the export from null1 to serial1, everything works again. Also switching that export to a reference fixes it as well…

I’m on Mac OSX 10.14.5 and build 2019.15840

I also discovered another issue, it may be the reason that servo’s aren’t totally working…

on line 271 of the firmata extension, values are multiplied by 360. Typically, the arduino servo library expects 0-180.