Fireflies and grasshoppers.

2017 Jun 02
#coding  #appCode 

I would like to start with the Firefly plugin in Grasshopper and see if I can control a stepper motor. If I can get a successful start with that, then I might be able to incorporate dishuBot controls through Grasshopper/ Firefly rather than GRBL. This would be directly connected to my G-code transcoder. There are a few challenges. One, Firefly has not been released on the MacOS, my operating system. Two, I need to learn to setup code for the board to accept commands through serial from Firefly.

This is an example of Firefly reading and parsing live hand tracking from a Kinnect. One short step from outputting data to steppers...

This is an example of Firefly controlling a walking 3D printer robot that is simultaneously sensing and adjusting for terrain differentiatios.

And there are many more fantastic precedents here.

First I had to find a way work around the installer and use the grasshopper and arduino components on a Mac. Download the installer. I tried to extract the files using a few different unpackers on macOS but was only left with unusuable files. If you have access to a Windows machine, you can download this. Extract the files from the installer. Then, return to your mac and copy the Grasshopper files into the components folder. Open Grasshopper, click here:

Relaunch Rhinoceros. Start Grasshopper. I get the following errors, yet the application loads and seems stable. First step down.

Object: WebCam_VideoStream (level 1)
{
Exception has been thrown by the target of an invocation.
TargetInvocationException
}

Object: WebCam_VideoStream (level 2)
{
An exception was thrown by the type initializer for Firefly_X.WebCam_VideoStream
TypeInitializationException
}

Object: WebCam_VideoStream (level 3)
{
Invalid IL code in C_sawapan_media.MediaIO:Initialize (int): IL_0002: call      0x06000111


InvalidProgramException
}

Do you like tutorials? You can do that. First install the firmata to Arduino. I had to use Arduino IDE 1.0.6 for this. First I will try to control a stepper motor with a spare Arduino Mega cross RAMPS shield. From the notes of the sketch:

1. Plug Arduino boards into your USB port; confirm that your Arduino's green power LED in on
2. Select your specific Arduino Board and Serial Port (Tools > Board; Tools > Serial Port) *Take note of your Serial Port COM #
3. Verify (play button) and Upload (upload button) this program to your Arduino, close the Arduino program
4. then open ... Rhino/Grasshopper/Firefly

Note: The Firefly Firmata sets the following pins to perform these functions:

*****ON MEGA BOARDS (ie. ATMEGA1280, ATMEGA2560)*****
ANALOG IN pins 0-15 will return values (from 0 to 1023) for 16 analog sensors
DIGITAL IN pins 22-31 will return 0's or 1's; for digital sensors (buttons, switches, on/off, true/false, etc.)
DIGITAL/ANALOG OUT pins 2-13 can be used to digitalWrite, analogWrite, or Servo.write depending on the input status of that Firefly pin
DIGITAL OUT pins 32-53 can be used to digitalWrite, Servo.write, or analogWrite depending on the input status of that Firefly pin

Next connect the serial monitor in Grasshopper. Here, I am having problems.

Unable to solve the serial port communication problem, I was spurred to add capabilities. Now I can also Steam on Windows. I installed using Bootcamp. I did not need to go to any extremes such as reinstalling MacOS. I simply launched Bootcamp, downloaded some material to a neutrally formatted USB memory, dictated a partition size and installed Windows. I had a rush of nostalgia from my childhood.

I will return to this, likely after my final work. Former Fab Academy student Francesca Perona, from the point of view of a MacOS user, walks through installing the necessary components (Windows, Rhinoceros, Grasshopper, Firefly, Arduino) gathering data from a sensor and operating an LED using Firefly. Enrico Cacciapuoti uses Firefly to control an Arduino Uno x CNC Shield combination, not coincidentally akin to the setup of dishuBot.

I will post links to resources I have found helpful here.

  • Enrico Cacciapuoti : Firefly with Arduino Uno x CNC Shield.
  • Francesca Perona : Go from MacOS to Windows and Firefly.
  • Firefly Forum : Get some info.
  • Geoweaver : Firefly 3d Printing Hexapod.
  • Firefly precedents : Examples of applications.
  • Share this post...

    « Previous post :: Grow Module | The science

    The nonvascular bryophyte microbial fuel cell operates in two main zones: anode and cathode. The anode side is a layer of moss, two mixtures of cotton and carbon (10:1, cotton : carbon weight) sandwiching a single layer of stainless steel mesh (as thin as possible). This anode mixture is from the 2016 October 3 Royal Society published work of Paolo Bombelli, et al. Electrical output of bryophyte microbial fuel cell systems is sufficient to power a radio or an environmental sensor. The cathode is a sandwich of acrylic (bread), rubber (condiment), hydrogen electrode (10 wt % Pt/C + 5% Nafion...

    Next post :: Grow module | Design and fabrication »

    My idea is to first create a small modular testing garden. I began with some sketches on paper and Rhinoceros. The bioelectrochemical modules are red and the frame is purple. I think this way will be able to be broken down and assembled easily and can be grown or reduced by adjusting the array. While the sketch shows a six by six array, I might reduce it to five by five. The testing modules were essentially cubes. This module is has a smaller bottom half to create a lip for sitting on the structure. In the upper portion there is...