Grasshopper

algorithmic modeling for Rhino

Hi, i have Rhino 5 (64 bit) Firefly 1.003. arduino uno. i have to control mirrors withs stepper. sending code through arduino interface is working just fine, but cant send through firefly. my friend made me driver that uses one pin (13 let say) n i send number of steps... lets sat 100 makes 180 degree...  Cant this be done by sending 100 in slider to pin 13? i tried...not working... the rx light blinking that means its reading ..my friend said its the fault with firmata as it is writting for servo... can u help me out. plz

Views: 2310

Replies to This Discussion

Hi Hassan,

Thanks for your question about steppers.  First, I would recommend upgrading Firefly to the most current version (1.0063) which is available from www.fireflyexperiments.com.  There are many new components, and the Firefly Firmata has changed since the 1.003 version.  However, the problem still exists in that there is not a super smooth workflow for integrating Steppers with Firefly (yet)... but it's not impossible.  There is a post on the Firefly website that has some instructions on how to drive a stepper motor using the Generic Serial Write component and the Easy Stepper Driver.  You can find a link here for more information: http://www.fireflyexperiments.com/discussions/post/1438445

It's quite possible that if you already have a sketch that is working using a set Arduino variable (say 100, which makes the servo move to 180 degrees) that you're very close to getting it to work with Firefly.  You'll want to use the Generic Serial Write component (instead of the Uno Write component... as the Uno Write component has been setup specifically for use with the Firefly Firmata... and you'll be using you're custom script).  You'll likely need to modify your Arduino script in some small way to read in the serial information being sent over from Grasshopper.  Basically, in Grasshopper, you'll first need to open the port (using the Open/Close Port component).  Make sure the baud rate matches the speed that you use in your Arduino sketch (and that the port number matches your board number).  Then, on the Generic Write component, you'll set the port number (same as the COM number in the Open/Close Port component) and set the start input to True.  Then, all you need to do is connect some data to send over the serial port... If you wanted to send a numeric value (like 100), then just connect an integer slider.  As I said, you need to modify your Arduino code so that it knows how to read in the data from Grasshopper and then what to do with that data.  Without seeing you're code, it's hard to tell you exactly how to do this... But, perhaps if you upload a file (or send us a file at info[at]fireflyexperiments.com) then we can help you get your file modified so it will work.  Once that's done, it should be really straight forward to drive a stepper through Firefly.

HTH,

Andy

PS, integrating steppers into the Firefly firmata is on my wishlist of things to implement into Firefly very soon.  Thank you again for bringing it up.

Hi Mr Payne,

Thanks for replying. i have attached the files, i.e, the firmata i m using, step.pde ( working fine ) and rameez.pde ( working fine) but only with Arduino interface, ( not with firefly) .

i wanted to jump to grasshoper 1.083 but that is not loading, so i have to stick to grasshopper wip 20101119 ( working good with firefly 1.003).

i would be very pleased if you could help me out

Hassan

Attachments:

Hi,

 

i tried serial port.It is communicating with motor but it is just taking jerks. i put slider in data but no progress. please help me out. i have sent you firmata and the arduino file that is working.  i m running out of time :(

 

regards

hassan abbasi

Attachments:

Hi Hassan,
I'm really sorry for the delayed response... for some reason, the Grasshopper website never notified me when you made a reply... so I only just came across your response.  I downloaded your files, and had some difficulty decifering exactly what it is you're trying to do.  A lot of the arduino code was commented out (with little explanation as to what the code actually did).  As best I could tell, you started with the Blink sketch and then tried to modify it for the stepper motor.  Again, I don't know what your stepper setup looks like so I don't know if your code actually works... but it looks like you have a function called motor() which accepts an integer value for the number of steps you want to move.  If this is the case, then it's relatively easy to get Firefly to send a value over the serial port and then assign that value to a variable which you can then use in your motor function.  So, I created a variable called steps... and then another set of functions that will read values from the serial port (from Firefly) and parse up the information and assign the first value coming over to the steps variable.  Again, I'm not really able to test this code, as I don't have your stepper setup... but the attached code should work (I think).

I also put together a Grasshopper setup file too.  I think you still have the old Firefly version installed, so I created a new file with the latest components... You'll need to have the latest version of Grasshopper and Firefly installed for this to work.  You should be able to upload this Arduino sketch, and then open the Grasshopper file... make sure you set the port number to whatever number is assigned to your board... I also made the baudrate in the Arduino sketch match the default baudrate in the latest Firefly Open/Close component.  This value is set to 115200.  Then, open the port and then click the boolean value connected to the start input on the Generic Serial Write to True to send the value over the serial port.  This will send the current value over the port and the arduino sketch should parse it up and assign it to the steps variable.  Hopefully this works for you, but let me know if you still have problems.  Again, I apologize about the slow response.

-Andy 

Attachments:

i hav uploaded a pic of my project, have a look how much does your plugin can do . just help me out with controlling these LDs.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service