Go to ThinkParametric

Responsive Skin / Arduino + Grasshopper Firefly

Some weeks ago Andy Payne from Lift Architects announced the release of his first version plugin Firefly which is a specialized set of tools dedicated to bridging the gap between the Arduino interface and Grasshopper , currently the plugin has two components one for receiving data coming from sensors and the other to send parametric data from grasshopper to some sort of actuator via Arduino.

I think Firefly is a great tool for prototyping projects that involve sensors and actuators , because before you actually build it, with this tool you can first model a digital muck up to see how your project elements will behave with real sensor data, so then you can port that same logic to build your real project.

Here is an experiment I made sending data from a photoresistor to Grasshopper to create a Responsive Structure that reacts to the degree of light of a physical space in real time.
What you need:
-Arduino Board
-1K Resistor
-Photoresistor
-LED

(sorry about the crappy picture I had to use my webcam)
You have to start by making your Arduino Hookup and writing a code in the Arduino environment so you can retrieve the value of the photoresistor which measures the amount of light in a room and then send it to the board , in this case I wanted that when the amount of light is low an LED started to turn on and that the intensity of it also varies depending the amount of light .

So for the hookup the photoresistor and 1K resistor are hooked up in series. Arduino +5V goes to the photoresistor and ground goes to the 1K resistor. The junction where the photoresistor and the 1K meet is where Arduino pin #5 goes (picture Above).

Next step is write a code in the Arduino environment were we take an analog reading being send from the photoresistor to our board and then send that value to our output which in this case is digital pin11 which is the position of our LED , I made some annotations to the Arduino code to make it more easy to understand.

Arduino Test from Rodrigo Medina on Vimeo.

The last part would be porting the data from arduino to Grasshopper , here is were Firefly comes into action , actually is very easy to use once you install the plugin you´ll se two more components added which are the Serial Read and Serial Write.

In this case as we want to import data from Arduino we are going to use the Serial Read component which has three inputs , the first one is to define if we want the port that transfer data open or closed, you will like to have an integer slider that goes from 0 to 1 to control this easily, remember to have it always at cero before yo start the timer, the second input is for indicating the computer the serial port you are working on which in my case was  COM3 but it depends on the serial USB ports of each computer you can check with which port you are working by opening your Arduino code , then going to the menu Tools and were it says Serial Port you´ll see the one that the Arduino board is using , the last input of the component is the Baud Rate which controls the speed and it should match the one you are using in Arduino apparently the standard is 9600 so I used that one.

Besides that the rest goes pretty straight forward using the common tools of Grasshopper , have I also included some notes in the definition to help you out.

Arduino + Grasshopper & Firefly from Rodrigo Medina on Vimeo.

As always let me know if you have any problems the best way to catch me is by twitter @Rodrigo_Medina


Subscribe to our mailing list to get access to our downloadable files

Files Names
Arduino Code:GH3D_FireflyExperiment.pde
Grasshopper Definition:Arduino + Firefly experiment.ghx

banner

  • http://www.liftarchitects.com Andy Payne

    Hi Rodrigo,
    Thanks for your example file. It’s looks great (although I wish I could speed up the redraw rate… but I think that’s more to do with the core of Grasshopper and less with Firefly). Congratulations. I think you’ll really like the next release too. It will have offer many new components!

  • Rodrigo

    Hello Andy, glad you liked it , you are really doing a great job with this Plugin looking forward to see the new release !!! =D

  • http://www.giuliopiacentino.com Giulio Piacentino

    It will be fun to follow this tutorial, thanks!

  • Danny

    Hey man,

    just wanted to say you have an awesome tutorial here. I followed the tutorial and setup my own grasshopper and followed your arduino code. It was my first test and turned out well. It’s for a research project i’m taking so posted up a video of me testing the reaction http://www.youtube.com/watch?v=MpQpw-x8k2c on youtube, referenced you of course! Anyways just wanted to say thanks for the tutorial was a big help!

    Danny.

  • Rodrigo

    Hi Danny thanks a lot , glad you have found it useful video looks great keep it up !!

  • Pingback: Flow of Data from Physical to Digital | Danny Nguyen's Portfolio()