algorithmic modeling for Rhino

hi all,

several of us (arch. grad students and our professor at portland state univ) are trying to get our ultrasonic range sensors working on our arduino unos in grasshopper. we have dl'ed firefly and run the main firmata. at that point everything works great and we know how to do things between arduino and grasshopper BUT the ultrasonic sensor doesn't work.

so, we dl'ed and ran j frölich's custom firefly_firmata_ping which makes the sensor work in grasshopper. BUT that seems to keep us from being able to address any of the pins for another purpose (running leds, servos, etc.).

we've been looking at the code of both of those firmatas in the arduino app and trying to merge them somehow, but that's beyond our understanding of programming.

after some searching we wonder if this would work:

use generic serial read/write firefly components in grasshopper to control the LED or servo while running the frölich firmata so the sensor is recognized?

we can't understand the basic workflow for this type of problem. do we need to write a custom firmata for every possible new sensor out there? or do you access them some other way while using the main unhacked firmata firefly?

thanks for any suggestions or assistance you can provide us!


Views: 1015

Replies to This Discussion

Hi Mart,

My apologies for the really late reply.  Basically, the reason why j frolich needed to create a modified version of the firmata is because that particular ping sensor doesn't output a standard analog output.  The firmata is setup to read (digital and analog) values from the appropriate pins.  However, to get the ping sensor to work properly, you need to send a brief digital pulse out to the sensor on a pin to trigger the detection and then wait for a return pulse after the sound has echoed off of an object.  Here's a good explanation (  So to get an actual reading from these sensors, you're sending a receiving signals very quickly on a standard digital pin.  The firmata simply tells the microcontroller to do a digital read... but you need to do a digital write and a digital read (all of this is happening very quickly).  So, there's a little bit of difference in how this particular sensor is configured in order to get a reliable value (compared to other sensors).

So, the easiest solution for all of this if you aren't comfortable with coding would be to simply use two arduino boards (if you have an extra one available).  On one of them, you could load up j frolich's modified firmata to get your ping sensor values.  On the other you could load up the standard firmata to control your servos etc.  The key would be to know that you will also need to use two Open/Close port components since you're going to be communicating with two separate arduino boards.  In addition, when you specify the port input on the read and write components, you'll need to know which board is connected to the sensor and which one is connected to the servo (so you send the right command to the right board).  Hopefully this makes sense.  Let me know if you have any additional questions.

If anyone would like to see this second solution, I have a tutorial and video going over the process using two Arduinos and serial read.






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service