Upcoming Events

Jason Kelly Johnson will be running a one-day intensive Firefly/Arduino Workshop "RESPONSIVE BUILDING FACADES" on July 27, 2012 in San Francisco (as a part of the Architect's Newspaper "Art and Science of Building Facades" Symposium.) Register here.

*Read Jason's Hardware Recommendations blog post for 2012-13 Firefly Workshops.  

Are you teaching or participating in a workshop that is using Firefly?  Let us know about it and we'll feature it here on the Firefly website! (info@fireflyexperiments.com)

Discussions > standard servo¬†instructions

HI guys, I'm trying to move a servo standard motor,( http://www.google.it/search?gcx=c&sourceid=chrome&ie=UTF-8&q=istructions#q=hitec+hs+311&hl=it&sa=X&prmd=imvns&source=univ&tbm=shop&tbo=u&ei=QRyGTrb5ApCXhQfm-e3wDA&ved=0CEEQrQQ&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=f134d5695189a0d0&biw=1280&bih=701 ).
I properly have just used a light sensor, and it works good.
I used the simple sweep scheme on the arduino website:
http://arduino.cc/en/Tutorial/Sweep
.I open the arduino actuation file example, apparently everything is working good, the port is open, there is the message "you can write on the borad", but when I move the sliders on pin 9, the motor doesn't rotate.I dont' know if it is a problem of firmata, or something else.I also tried the tutorial on the firefly guide(light sensor +led+servo),same problem the light sensor is working good, but not the servo.
Thank you guys.

September 30, 2011 | Unregistered Commenterfederico

Hi Federico,
Did you right-click on the DPin 9 input and remember to set the pin state to Servo (by default its set to Digital). This could be the problem.
HTH,
Andy

October 2, 2011 | Registered CommenterEditor

HI Andy!!
I'm using the PWM mode on the Dpin9.this is what is going on:

http://www.flickr.com/photos/passiconnessi/6208285732/sizes/l/in/photostream/
thank you again.

October 3, 2011 | Unregistered Commenterfederico

Hi Federico,
Thanks for the image... it helps explain a lot. I think you are using an old version of Firefly. Some things have changed in the latest release of Firefly, which make it a lot easier to control Servos, PWM, etc. In the newest version (available under the download section) you should be able to right-click on DPin 9 input and set it to send Servo information. You'll need to use the latest Firefly Firmata (also included in the download) for this to work properly. Try updating your version and see if this helps (it should be pretty straight forward (hopefully).
Also, I should mention that I'm about to release a newer version this week as well. Not quite sure when, but probably in the next few days... so even if you download the latest version today, you may want to check back later in the week and get the newest version.
HTH,
Andy

October 3, 2011 | Registered CommenterEditor

thank you Andy!Now it's working!!!!!!!...thank you so much!

October 3, 2011 | Unregistered Commenterfederico

Hey there!
I have been experimenting with GH/Firefly for a little now and was given a live tutorial by a friend where we were able to use the slider to dictate the rotation of the servo (that came with the Arduino experimentation package) Since then my blue servo has broke and I bought a servo of higher quality with 360 degree full rotation. I have tried controlling this servo in the same manner and with the GH script as the last but whenever I plug the servo in and set the pin to "Servo" the servo rotates automatically even with the number slider.

I guess my real concern is whether the issue is with my script or whether my servo is unable to work with GH/FF properly.
Your help and feedback is greatly appreciated!

January 14, 2012 | Unregistered CommenterSean

Hi Sean,
Continuous rotation servos behave differently than standard servos. In essence, standard servos have some sort of feedback mechanism (usually an internal potentiometer) which allows you to specify the position of the servo very accurately. However, these can usually only move between 0-180 degrees. Continuous rotation servos do not have this feedback mechanism... as such, they can move indefinitely in either direction, but it's difficult to tell them to move to a specific position. The Firefly firmata uses the servo library to create the pulses to move the servo to the appropriate position. If you want to control continuous rotation servos, you will have to create your own pulse modulation. I would recommend using the PWM setting (as opposed to the Servo input). You should be able to find some PWM value that is the 'center' point of the servo pulse width where the servo doesn't move forward or backward. If you increase your PWM, it will move in one direction, and decreasing it will move it in the other. Unless you can figure out a very specific timing mechanism, it will likely be difficult to control servos with a great deal of angle precision. If this is what you're after, I would recommend using stepper motors. They can rotate more than 360 degrees (virtually they move indefinitely in either direction) and you can control them very specifically. Plus, they are silent. The next version of Firefly (1.0064) will have stepper support (which I hope to release in the next day or so).
HTH,
Andy

January 17, 2012 | Registered CommenterEditor

Hello,
I'm a beginner and so far I've played with the Actuation and Interaction grasshopper scripts. I'm having the same problem of the servo not working, but I had already tried assigning the Pin(s) to "servo". I have the new firefly (just downloaded last week), but the servo just doesn't move even though grasshopper is clearly reading the potentiometer numbers. The servo works fine when using the simple sweep and knob tutorials from Arduino. What can it be? By the way I'm using Arduino Duemillenove with the UNO firmata.

Thanks,
Jasleen

July 26, 2012 | Unregistered CommenterJasleen

Any chance you could post an image of your circuit? Do you have the signal wire of your servo going to the pin you've specified as "servo" in Firefly? And 5V and GND going to the other wires on the servo? The other issue that might be happening is that you have to remap your potentiometer values into a range compatible with your servo. The potentiometer value will be between 0-1023 and the servo angle can only be 0-180. You might have to use the Remap Numbers component to map your value into an appropriate range for your servo.
-Andy

July 26, 2012 | Registered CommenterEditor

Andy,

I am one of the students working for Dr. David Gerber. I had a question about controlling a servo.

We are trying to create a firefly program that will move a servo from 0 degrees to 90 degrees. We also want to incorporate a timer so that the servo with continuously move so that we can test a prototype. We have gotten the servo to move using the slider but we want it to be able to move the servo on a timer. If you have any idea how to help use with the firefly it would be great.

Thanks so much.

Seri Hieatt

July 27, 2012 | Unregistered CommenterSeri Hieatt

Here is a link to my circuit board. I believe that I used the remap component. The end numbers in the grasshopper file is between 0-180. I selected pin 11 and changed it to "servo".

http://computerimaging.wordpress.com/

Thanks,
Jasleen

July 29, 2012 | Unregistered CommenterJasleen

Andy,
I figured it out. I had the servo routed to Pin 11 rather than pin 9. It works now!
Thank you,
Jasleen

July 29, 2012 | Unregistered CommenterJsarai

Hi Jasleen,
Sorry for my long delay. I was out of town all of last week on vacation and was without access to my computer. I'm glad you got it figured out. Let me know if you have any additional questions.
Cheers,
Andy

August 5, 2012 | Registered CommenterEditor

Hey Andy,

i have the same problem like jasleen but on every port on the arduino.
if i write out the code to arduino without firefly it works well.
thx

September 6, 2012 | Unregistered CommenterFrank

Hi, I ve been trying the same process as everyone else has (as written in the firefly user guide), however i have right-clicked and set my pin 9 to the servo library, even used an alternate power source to power the servo and it still will not register with grasshopper. The number slider corresponds to the uno write component just fine, giving me the right numbers on the output side. I have also tried two other 180 degree servos with no luck.

I thought it might be the servos however when i use just the arduino IDE, the servos work fine.

firefly's firmata is up to date as well.

Am i missing something?

thanks

September 1, 2014 | Unregistered Commenterstpehen