Happy Fugio Friday!
Today we have two new plugins that enable Fugio to talk to hardware that uses a serial port interface, which includes the Arduino range of open source hardware (like the Arduino Uno above), which means that we can control LED lights, motors, servos, and use sensors for touch, magnetism, temperature, and many more!
The serial plugin handles the raw data communication between the Arduino and Fugio, and can be used to implement any kind of custom protocol between the two, but we can go one further and use the rather nice Firmata plugin to talk directly to the Arduino pins without writing any Arduino code at all.
Download Fugio 1.8.0 for Windows and OS X
I haven’t had time to do a tutorial video (yet), but here’s some pointers to get you started:
Setting up a Serial Port
- In the new Devices menu, choose Serial Ports
- Add an entry for your Arduino. Make sure you choose the right port, and set the baud rate (the speed the serial port will work at) to 57600 (bits per second)
- Remember to press the Enable button for the entry you’ve just added
Reading from the Arduino (without Firmata)
Upload the following code to your Arduino:
void setup() { Serial.begin( 57600 ); while( !Serial ) { // wait for serial port to connect. } } void loop() { Serial.println( "Hello, World!" ); delay(1000); // wait for a second }
Create the following:
And use the following Lua program:
fugio = require "fugio" PinInputStrings = fugio.input( "Strings" ) function main() local Strings = PinInputStrings:get() for i = 1,#Strings do fugio.log( i .. ": " .. Strings[ i ] ) end end
Setting up Firmata
Instructable for installing Firmata on Arduino
And here’s what you have to do in Fugio:
Quit the Arduino software and load Fugio:
- Add a Serial Input node, a Firmata node, and a Serial Output node
- Connect the Serial input and Serial output to the Firmata node
- Connect a button to the Reset pin
If everything is connected and configured properly, you should see the pins appearing on the Firmata node. Check the logger window for additional messages.
If this doesn’t happen first time, you may need to close the patch and reload it.
At this point you should be able to read and write to the Arduino pins!
Click the Edit Pins button to configure pins for inputs (digital INPUT (true/false) and ANALOG input (0-1023)), and outputs (digital OUTPUT (true/false), and PWM mode is supported):
I’m going to be showing a couple of artworks at the prestigious V&A Museum in London for the next few days with the High Altitude Bioprospecting team (and fellow members of the Institute of Unnecessary Research) for the Digital Design Weekend as part of the London Design Festival.
23rd September: 6-8pm
24th and 25th September: 10:30am-5pm
I’ll have Fugio on hand (creating music from genomic data) so come and say hello!