Firefly

Firefly offers a set of comprehensive software tools dedicated to bridging the gap between Grasshopper, (a free plug-in for Rhino) the Arduino microcontroller and other input/output devices. It allows near real-time data flow between the digital and physical worlds – enabling the possibility to explore virtual and physical prototypes with unprecedented fluidity.

Serial read problem in Firefly

Hi guys,

I'm communicating with a 3D printer via Grasshopper / Firefly (and eventually) Silkworm.

So far, I can quite happily send G-Code move commands to the printer  - which is a Leapfrog Creatr, based on Arduino Mega / RAMPS electronics - via the generic Serial Write command. 

I also want to get a return feed of information, which will basically tell me when the printhead has reached its destination (so normally sending the printer a code 'M114' will get it to return a string along the lines of :

X:100.00Y:15.00Z1.20E:0.00 Count X:100.00Y:15.00Z1.20E:0.00

ok

you can see this works in an arduino serial monitor window from the screenshot below.

Unfortunately I can't seem to get the generic "Serial Read" block to work for me in Grasshopper. (I do have the arduino serial monitor closed, and the "Hurray" message is displaying)

When I write a log file, the txt file does grow, but full of empty lines.

I'm stumped, really - there are lots of other people who have asked this question / had this problem, but unfortunately most of them never explained how they got it working when they did....

Thanks in advance

Fergal

  • up

    Andy Payne

    Hi Fergal,

    Thanks for your question.  To be honest... I think your issue is somewhat of a unique and new issue... but something I've been looking into recently.  You see all of the Read/Write components (including the Generic versions) don't wait to receive a call back message from the Arduino... basically the Write components send the data whenever Grasshopper computes a new solution (whether that's from a timer upstream or someone moving a slider... it sends the latest message as soon as possible).  

    What you're describing is a way in which Grasshopper manages a list of instructions and waits for a call back from the Arduino before issuing the next command.  I've recently been re-working the stepper component so that it incorporates this new functionality... and it seems to be working pretty well.  I had to re-work the Stepper Firmata as well as the component itself... but I think in general it works well.  However, currently the stepper component sends a specific string to work with the Stepper Firmata sketch... It isn't necessarily suited to send any generic message you want.

    However, I've recently also been working with Erik Luhtala who is building his own CNC milling machine and he would like to be able to use Firefly to stream G-code directly to the Arduino in the same manner your describing (using the call back function once each command has been implemented).  So, I'm thinking of modifying the stepper component to be able to send any generic list of string data (ie. g-code) using this call back communication method.  I think this would work for what you're trying to do too.  I'm not sure when this will be available, but hopefully soon.  

    -Andy

    6