SlideShare a Scribd company logo
Getting Started with Firefly
The City University of New York
Architectural Technology Dept.
written by Anthony Gonzalez
GettingStartedwithFirefly
2
Introduction
Firefly is a suite of software tools written for the
Grasshopper plug-in that enable you to drive
parametric values through sensor data via an Arduino
microcontroller. In addition to slaving parameters of a
GrasshopperdefinitiontothatofanArduino-connected
sensor (or creating a mathematical relationship
between a sensor measurement and a controlled
parameter), Firefly also enables parameters to behave
as outputs that drive actuation (eg. motors, LEDS,
etc.). Thus, using Firefly, there is potential for two-way
communication where not only can you determine the
state of external physical conditions and use that data
to construct and/or manipulate responsive virtual
models, you can also use those same virtual models
and their parameters as outputs that control the state
of responsive physical environments.
The Firefly Installation files are available at http://
www.fireflyexperiments.com/download
GettingStartedwithFirefly
3
Preparing for Firefly Communication
Assuming you have already installed the Arduino
IDE and your Arduino board is currently connected
to your workstation, you must now upload the Firefly
Firmata sketch to the Arduino board. Firmata is what
is described as a “generic protocol for communicating
with microcontrollers from software on a host
computer.” In other words, by uploading the Firefly
Firmata sketch you are essentially embedding a
prewritten program onto the Arduino board that allows
Firefly to both read from and write to the Arduino’s pins.
Once uploaded, you can move away from the Arduino
IDE and create all programmatic behavior through the
visual programming language of Grasshopper.
The Firefly Firmata is available at http://www.
fireflyexperiments.com/download
GettingStartedwithFirefly
4
The Firefly Toolbar
Fig. 1 shows the Firefly toolbar as it is in Grasshopper.
As you can see, Firefly actually adds more functionality
to Grasshopper than just Arduino communication.
As seen in Fig. 1, Firefly provides components to
interface with audio input, send & receive data over a
network, and even open up a webcam feed. However,
the components we are concerned about here are
in the panel to the far left (shows in Fig. 2). These
are components specifically related to your Arduino
microcontroller (ignore the Wii object). Depending on
the model of Arduino board you are using, the most
important component to become familiar with is
either the UNO or MEGA component along with its two
variations: READ and WRITE.
Fig. 1 -Firefly Toolbar
Fig. 2 -Firefly Toolbar
GettingStartedwithFirefly
5
The Virtual Arduino
The functionality of the physical Arduino board
(specific pins behaving as either INPUTS or OUTPUTS)
is virtually represented within Firefly as two separate
components (as shown in Fig. 3 & Fig. 4).
Through this simple binary implementation, Firefly
has already designated which pins on the Arduino
board can behave as INPUTS (those assigned to
the ‘Read’ component) and those pins which can
behave as OUTPUTS (those assigned to the ‘Write’
component). While this limits a certain amount of
flexibility in choosing which pins behave in which
manner (like when coding in the Arduino IDE), with
this “hard-coded” approach conflict is averted and the
extra step of assigning behavior to the specific pins
you plan to use is eliminated. Notice in the ‘Read’
object, all six analog pins are available to read, which
makes perfect sense since analog pins are meant
for sensing (measuring voltage) and even in the
Arduino IDE voltage values other than HIGH or LOW
cannot actually be written to analog pins. In addition
to interfacing with analog pins, the ‘Read’ component
interfaces with three digital pins: DPin2, DPin4, and
DPin7. Now look at the ‘Write” component and notice
the absence of analog pins (perfectly legitimate)
and the inclusion of nine digital pins: DPin3, DPin5,
DPin6, DPin8, DPin9, DPin10, DPin11, DPin12, and
DPin13. Digital pins 2, 4, 7 are excluded from the
‘Write’ component because they have already been
designated by Firefly as INPUTS (by their inclusion in
the ‘Read’ component). When wiring, make sure to
note that digital pins 0 and 1 are reserved for serial
communication and are not represented in either the
‘Read’ or ‘Write’ components.
Fig. 3 -Uno Read Component Fig. 4 -Uno Write Component
GettingStartedwithFirefly
6
Reading & Writing to Pins
While the ‘Read’ and “Write’ components are
critical to interfacing with the Arduino board, in
turn, these components depend on other smaller
components in order to operate properly. Before any
kind of communication can take place between the
Arduino board and Grasshopper (or any other piece
of software) a serial port must be opened for that
communication to take place.
The ‘Open Port’ component (shown in Fig. 5)
establishes and opens a port over which
communication will take place between the Arduino
board and Grasshopper. This component requires
three input parameters: Open, Port, and Baud. Open
accepts a “Boolean” value (True or False) which is
easiest to interface with using the “Boolean Toggle”
parameter (under Params > Special) while Port and
Baud accept “Integer” parameters (under Params >
Primitive). The significance of each parameter is self
explanatory: the “Boolean” opens and closes the
connection respectively, the Port “Integer” tells the
component which communication port the Arduino
board is actually connected to, and the Baud “Integer”
tells the port at what transmission speed to operate
(this rate must match the rate defined in the Firefly
Firmata sketch which by default is 115200). The
number assigned to the communication port used by
your Arduino board can be determined in two different
ways: using the Device Manager or through Firefly’s
“Ports Available” component (shown in Fig. 6).
Fig. 5 -Open Port Component Fig. 6 -Ports Available Component
GettingStartedwithFirefly
7
Reading & Writing
Uno Read
Once you have determined the correct port number,
have entered that number into the “Integer”
parameter connected to the “Open Port” component,
and have set the Open property of that component
to True, you are now ready to begin communicating
with the Arduino board. Let’s look at the “Uno Read”
component again (shown in Fig. 7).
Although you have already established and opened a
port over which communication between the Arduino
board and Grasshopper can take place, both the
“Uno Read” and “Uno Write” components require a
clear directive to actually begin utilizing that open
port. This directive is defined through two required
input parameters: Start and Port. The Start input
expects a “Boolean” value and the Port input expects
an “Integer” value (naturally, the corresponding port
number of the line of communication you have already
opened in the “Open Port” component). In addition to
initializing the “Uno Read” component, you must also
define how often to check for updated values from the
Arduino board. This is accomplished by connecting a
“Timer” object directly to the “Uno Read” component.
The “Timer” object sends pulses at a set interval (in
this case every 20ms) to the “Uno Read” component,
which essentially command the component to retrieve
new values for each of the Arduino board’s input pins.
Now let’s set our “Boolean Toggle” to True and connect
some text panels to our component outputs for some
feedback and… you’re now reading values from our
Arduino board’s input pins (as shown in Fig. 8).
Fig. 7 -Uno Read Component Fig. 8 -Uno Read Component
GettingStartedwithFirefly
8
Reading & Writing
Uno write
Using the “Uno Read” component you’ve now used
Firefly as an input to retrieve data from the Arduino
board’s output pins. With this data, you can drive
any parameter of your Grasshopper definition in any
manner that you desire. The counterpart to “Uno
Read” is the “Uno Write” component (shown in Fig. 9)
which allows you to use Firefly as an output that can
send data to the Arduino board’s input pins.
If you remember how to initialize and begin sending
pulses to the “Uno Read” component, then you’ll have
no trouble getting the “Uno Write” component up and
running. Notice the two input parameters Start and
Port as well as the “Timer” object connected directly
to the “Uno Write” component. The obvious difference
here is the number of inputs available, which
correspond to the pins you can control on the Arduino
board from Grasshopper. Each digital pin input
parameter (eg. DPin13) expects either a “Boolean”
or “Integer” value. As in most if not all programming
languages, True evaluates to 1, False evaluates to
0, and vice versa. In addition, any non-zero integer
evaluates to True.
Taking a closer look at the input parameters of “Uno
Write” you’ll notice a small variation on specific digital
pins, specifically the tilde (~). The tilde defines pins
that can be used for either digital input (0 or 1 / false
or true) or PWM (pulse width modulation). In brief,
PWM uses square waves to simulate analog values
by modulating the time the signal is high by the time
the signal is low. These pins can accept integers other
than 0 or 1 and are great for fading LED’s, controlling
motors, etc. By right-clicking the input parameters you
can set how each digital pin should behave (shown in
Fig. 10).
The Out output parameter is included here in order
to demonstrate that the “Uno Write” component
continually writes data to all of the Arduino board’s
input pins regardless of whether you are actually
changing one or all of the “Uno Write” input
parameters.
Fig. 9 -Uno Write Component
Fig. 10 -Set Pin to PWM

More Related Content

What's hot

Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2
Qtechknow
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
John Breslin
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
Vishnu
 
IRJET- Smart Gloves to Convert Sign Languages to Vocal Output
IRJET- Smart Gloves to Convert Sign Languages to Vocal OutputIRJET- Smart Gloves to Convert Sign Languages to Vocal Output
IRJET- Smart Gloves to Convert Sign Languages to Vocal Output
IRJET Journal
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
Vishnu
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
Makers of India
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
Tony Olsson.
 
Arduino course
Arduino courseArduino course
Arduino course
Ahmed Shelbaya
 
C++ Pointers And References
C++ Pointers And ReferencesC++ Pointers And References
C++ Pointers And Referencesverisan
 
아두이노 Digital/Analog IO
아두이노 Digital/Analog IO아두이노 Digital/Analog IO
아두이노 Digital/Analog IO
JungHoon Lee
 
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauriArduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Gaurav Pandey
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interruptTech_MX
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
atuline
 
Lily pad dev_handout
Lily pad dev_handoutLily pad dev_handout
Lily pad dev_handout
Khuê Phạm
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
 

What's hot (20)

Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2
 
Ardx experimenters-guide-web
Ardx experimenters-guide-webArdx experimenters-guide-web
Ardx experimenters-guide-web
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
 
IRJET- Smart Gloves to Convert Sign Languages to Vocal Output
IRJET- Smart Gloves to Convert Sign Languages to Vocal OutputIRJET- Smart Gloves to Convert Sign Languages to Vocal Output
IRJET- Smart Gloves to Convert Sign Languages to Vocal Output
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
 
Arduino course
Arduino courseArduino course
Arduino course
 
C++ Pointers And References
C++ Pointers And ReferencesC++ Pointers And References
C++ Pointers And References
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
아두이노 Digital/Analog IO
아두이노 Digital/Analog IO아두이노 Digital/Analog IO
아두이노 Digital/Analog IO
 
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauriArduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
 
Pointer in c++ part1
Pointer in c++ part1Pointer in c++ part1
Pointer in c++ part1
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
 
Interfacing to
Interfacing toInterfacing to
Interfacing to
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
Lily pad dev_handout
Lily pad dev_handoutLily pad dev_handout
Lily pad dev_handout
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
 
Pointers
PointersPointers
Pointers
 

Similar to Getting Started With Firefly

Electronz_Chapter_14.pptx
Electronz_Chapter_14.pptxElectronz_Chapter_14.pptx
Electronz_Chapter_14.pptx
Mokete5
 
Arduino day 2019
Arduino day 2019Arduino day 2019
Arduino day 2019
BIPUL KUMAR GUPTA
 
arduino uno
arduino unoarduino uno
arduino uno
20PA013BHOOMIKAP
 
Arduino: Arduino starter kit
Arduino: Arduino starter kitArduino: Arduino starter kit
Arduino: Arduino starter kit
SANTIAGO PABLO ALBERTO
 
arduino uno.pptx
arduino uno.pptxarduino uno.pptx
arduino uno.pptx
NeeladriBijayMisra
 
Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
yosikit826
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
Ajay578679
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbook
Felipe Belarmino
 
Introduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).pptIntroduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).ppt
ansariparveen06
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
Ravikumar Tiwari
 
Digital home automation with arduino bluetooth
Digital home automation with arduino bluetoothDigital home automation with arduino bluetooth
Digital home automation with arduino bluetooth
Shishupal03012015
 
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptxAfter COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
Elisée Ndjabu
 
Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004
DO!MAKERS
 
Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011
ΚΔΑΠ Δήμου Θέρμης
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
vishal choudhary
 
Ardublock tutorial
Ardublock tutorialArdublock tutorial
Ardublock tutorial
Jakie_Li
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_Tutorial
NYCCTfab
 
Getting startedwitharduino ch04
Getting startedwitharduino ch04Getting startedwitharduino ch04
Getting startedwitharduino ch04Anil Yadav
 

Similar to Getting Started With Firefly (20)

Electronz_Chapter_14.pptx
Electronz_Chapter_14.pptxElectronz_Chapter_14.pptx
Electronz_Chapter_14.pptx
 
Arduino day 2019
Arduino day 2019Arduino day 2019
Arduino day 2019
 
arduino uno
arduino unoarduino uno
arduino uno
 
Arduino: Arduino starter kit
Arduino: Arduino starter kitArduino: Arduino starter kit
Arduino: Arduino starter kit
 
arduino uno.pptx
arduino uno.pptxarduino uno.pptx
arduino uno.pptx
 
Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbook
 
Introduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).pptIntroduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).ppt
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Digital home automation with arduino bluetooth
Digital home automation with arduino bluetoothDigital home automation with arduino bluetooth
Digital home automation with arduino bluetooth
 
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptxAfter COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
 
Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004
 
Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Arduino workshop sensors
Arduino workshop sensorsArduino workshop sensors
Arduino workshop sensors
 
Ardublock tutorial
Ardublock tutorialArdublock tutorial
Ardublock tutorial
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_Tutorial
 
Getting startedwitharduino ch04
Getting startedwitharduino ch04Getting startedwitharduino ch04
Getting startedwitharduino ch04
 

More from NYCCTfab

Fusion 360 Tutorial
Fusion 360 TutorialFusion 360 Tutorial
Fusion 360 Tutorial
NYCCTfab
 
Citytech HTML/CSS Guide
Citytech HTML/CSS GuideCitytech HTML/CSS Guide
Citytech HTML/CSS Guide
NYCCTfab
 
Ultimaker 2+
Ultimaker 2+Ultimaker 2+
Ultimaker 2+
NYCCTfab
 
Robot Studio
Robot StudioRobot Studio
Robot Studio
NYCCTfab
 
Roland Primer 3D Scanner
Roland Primer 3D ScannerRoland Primer 3D Scanner
Roland Primer 3D Scanner
NYCCTfab
 
Lighting with Photoshop
Lighting with PhotoshopLighting with Photoshop
Lighting with Photoshop
NYCCTfab
 
Fusion 360 Tutorial
Fusion 360 TutorialFusion 360 Tutorial
Fusion 360 Tutorial
NYCCTfab
 
Architectural diagrams
Architectural diagramsArchitectural diagrams
Architectural diagrams
NYCCTfab
 
Advanced Techniques in Photoshop
Advanced Techniques in PhotoshopAdvanced Techniques in Photoshop
Advanced Techniques in Photoshop
NYCCTfab
 
Adobe Premiere Pro
Adobe Premiere ProAdobe Premiere Pro
Adobe Premiere Pro
NYCCTfab
 
VRay Lighting for Rhino
VRay Lighting for RhinoVRay Lighting for Rhino
VRay Lighting for Rhino
NYCCTfab
 
Adobe Illustrator CC 2018
Adobe Illustrator CC 2018 Adobe Illustrator CC 2018
Adobe Illustrator CC 2018
NYCCTfab
 
Silicone Mold Primer
Silicone Mold PrimerSilicone Mold Primer
Silicone Mold Primer
NYCCTfab
 
Presentation Board Layout
Presentation Board Layout Presentation Board Layout
Presentation Board Layout
NYCCTfab
 
CPD Dental Cam Primer
CPD Dental Cam PrimerCPD Dental Cam Primer
CPD Dental Cam Primer
NYCCTfab
 
Temperature and Light Logger (UA-002-64)
Temperature and Light Logger (UA-002-64)Temperature and Light Logger (UA-002-64)
Temperature and Light Logger (UA-002-64)
NYCCTfab
 
Telaire CO2 Sensor (Tel-7001)
Telaire CO2 Sensor (Tel-7001)Telaire CO2 Sensor (Tel-7001)
Telaire CO2 Sensor (Tel-7001)
NYCCTfab
 
UX90-002 Light & Occupancy Logger
UX90-002 Light & Occupancy LoggerUX90-002 Light & Occupancy Logger
UX90-002 Light & Occupancy Logger
NYCCTfab
 
Light Meter (LM-120)
Light Meter (LM-120)Light Meter (LM-120)
Light Meter (LM-120)
NYCCTfab
 
Temperature and Relative Humidity Ext
Temperature and Relative Humidity ExtTemperature and Relative Humidity Ext
Temperature and Relative Humidity Ext
NYCCTfab
 

More from NYCCTfab (20)

Fusion 360 Tutorial
Fusion 360 TutorialFusion 360 Tutorial
Fusion 360 Tutorial
 
Citytech HTML/CSS Guide
Citytech HTML/CSS GuideCitytech HTML/CSS Guide
Citytech HTML/CSS Guide
 
Ultimaker 2+
Ultimaker 2+Ultimaker 2+
Ultimaker 2+
 
Robot Studio
Robot StudioRobot Studio
Robot Studio
 
Roland Primer 3D Scanner
Roland Primer 3D ScannerRoland Primer 3D Scanner
Roland Primer 3D Scanner
 
Lighting with Photoshop
Lighting with PhotoshopLighting with Photoshop
Lighting with Photoshop
 
Fusion 360 Tutorial
Fusion 360 TutorialFusion 360 Tutorial
Fusion 360 Tutorial
 
Architectural diagrams
Architectural diagramsArchitectural diagrams
Architectural diagrams
 
Advanced Techniques in Photoshop
Advanced Techniques in PhotoshopAdvanced Techniques in Photoshop
Advanced Techniques in Photoshop
 
Adobe Premiere Pro
Adobe Premiere ProAdobe Premiere Pro
Adobe Premiere Pro
 
VRay Lighting for Rhino
VRay Lighting for RhinoVRay Lighting for Rhino
VRay Lighting for Rhino
 
Adobe Illustrator CC 2018
Adobe Illustrator CC 2018 Adobe Illustrator CC 2018
Adobe Illustrator CC 2018
 
Silicone Mold Primer
Silicone Mold PrimerSilicone Mold Primer
Silicone Mold Primer
 
Presentation Board Layout
Presentation Board Layout Presentation Board Layout
Presentation Board Layout
 
CPD Dental Cam Primer
CPD Dental Cam PrimerCPD Dental Cam Primer
CPD Dental Cam Primer
 
Temperature and Light Logger (UA-002-64)
Temperature and Light Logger (UA-002-64)Temperature and Light Logger (UA-002-64)
Temperature and Light Logger (UA-002-64)
 
Telaire CO2 Sensor (Tel-7001)
Telaire CO2 Sensor (Tel-7001)Telaire CO2 Sensor (Tel-7001)
Telaire CO2 Sensor (Tel-7001)
 
UX90-002 Light & Occupancy Logger
UX90-002 Light & Occupancy LoggerUX90-002 Light & Occupancy Logger
UX90-002 Light & Occupancy Logger
 
Light Meter (LM-120)
Light Meter (LM-120)Light Meter (LM-120)
Light Meter (LM-120)
 
Temperature and Relative Humidity Ext
Temperature and Relative Humidity ExtTemperature and Relative Humidity Ext
Temperature and Relative Humidity Ext
 

Recently uploaded

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

Getting Started With Firefly

  • 1. Getting Started with Firefly The City University of New York Architectural Technology Dept. written by Anthony Gonzalez
  • 2. GettingStartedwithFirefly 2 Introduction Firefly is a suite of software tools written for the Grasshopper plug-in that enable you to drive parametric values through sensor data via an Arduino microcontroller. In addition to slaving parameters of a GrasshopperdefinitiontothatofanArduino-connected sensor (or creating a mathematical relationship between a sensor measurement and a controlled parameter), Firefly also enables parameters to behave as outputs that drive actuation (eg. motors, LEDS, etc.). Thus, using Firefly, there is potential for two-way communication where not only can you determine the state of external physical conditions and use that data to construct and/or manipulate responsive virtual models, you can also use those same virtual models and their parameters as outputs that control the state of responsive physical environments. The Firefly Installation files are available at http:// www.fireflyexperiments.com/download
  • 3. GettingStartedwithFirefly 3 Preparing for Firefly Communication Assuming you have already installed the Arduino IDE and your Arduino board is currently connected to your workstation, you must now upload the Firefly Firmata sketch to the Arduino board. Firmata is what is described as a “generic protocol for communicating with microcontrollers from software on a host computer.” In other words, by uploading the Firefly Firmata sketch you are essentially embedding a prewritten program onto the Arduino board that allows Firefly to both read from and write to the Arduino’s pins. Once uploaded, you can move away from the Arduino IDE and create all programmatic behavior through the visual programming language of Grasshopper. The Firefly Firmata is available at http://www. fireflyexperiments.com/download
  • 4. GettingStartedwithFirefly 4 The Firefly Toolbar Fig. 1 shows the Firefly toolbar as it is in Grasshopper. As you can see, Firefly actually adds more functionality to Grasshopper than just Arduino communication. As seen in Fig. 1, Firefly provides components to interface with audio input, send & receive data over a network, and even open up a webcam feed. However, the components we are concerned about here are in the panel to the far left (shows in Fig. 2). These are components specifically related to your Arduino microcontroller (ignore the Wii object). Depending on the model of Arduino board you are using, the most important component to become familiar with is either the UNO or MEGA component along with its two variations: READ and WRITE. Fig. 1 -Firefly Toolbar Fig. 2 -Firefly Toolbar
  • 5. GettingStartedwithFirefly 5 The Virtual Arduino The functionality of the physical Arduino board (specific pins behaving as either INPUTS or OUTPUTS) is virtually represented within Firefly as two separate components (as shown in Fig. 3 & Fig. 4). Through this simple binary implementation, Firefly has already designated which pins on the Arduino board can behave as INPUTS (those assigned to the ‘Read’ component) and those pins which can behave as OUTPUTS (those assigned to the ‘Write’ component). While this limits a certain amount of flexibility in choosing which pins behave in which manner (like when coding in the Arduino IDE), with this “hard-coded” approach conflict is averted and the extra step of assigning behavior to the specific pins you plan to use is eliminated. Notice in the ‘Read’ object, all six analog pins are available to read, which makes perfect sense since analog pins are meant for sensing (measuring voltage) and even in the Arduino IDE voltage values other than HIGH or LOW cannot actually be written to analog pins. In addition to interfacing with analog pins, the ‘Read’ component interfaces with three digital pins: DPin2, DPin4, and DPin7. Now look at the ‘Write” component and notice the absence of analog pins (perfectly legitimate) and the inclusion of nine digital pins: DPin3, DPin5, DPin6, DPin8, DPin9, DPin10, DPin11, DPin12, and DPin13. Digital pins 2, 4, 7 are excluded from the ‘Write’ component because they have already been designated by Firefly as INPUTS (by their inclusion in the ‘Read’ component). When wiring, make sure to note that digital pins 0 and 1 are reserved for serial communication and are not represented in either the ‘Read’ or ‘Write’ components. Fig. 3 -Uno Read Component Fig. 4 -Uno Write Component
  • 6. GettingStartedwithFirefly 6 Reading & Writing to Pins While the ‘Read’ and “Write’ components are critical to interfacing with the Arduino board, in turn, these components depend on other smaller components in order to operate properly. Before any kind of communication can take place between the Arduino board and Grasshopper (or any other piece of software) a serial port must be opened for that communication to take place. The ‘Open Port’ component (shown in Fig. 5) establishes and opens a port over which communication will take place between the Arduino board and Grasshopper. This component requires three input parameters: Open, Port, and Baud. Open accepts a “Boolean” value (True or False) which is easiest to interface with using the “Boolean Toggle” parameter (under Params > Special) while Port and Baud accept “Integer” parameters (under Params > Primitive). The significance of each parameter is self explanatory: the “Boolean” opens and closes the connection respectively, the Port “Integer” tells the component which communication port the Arduino board is actually connected to, and the Baud “Integer” tells the port at what transmission speed to operate (this rate must match the rate defined in the Firefly Firmata sketch which by default is 115200). The number assigned to the communication port used by your Arduino board can be determined in two different ways: using the Device Manager or through Firefly’s “Ports Available” component (shown in Fig. 6). Fig. 5 -Open Port Component Fig. 6 -Ports Available Component
  • 7. GettingStartedwithFirefly 7 Reading & Writing Uno Read Once you have determined the correct port number, have entered that number into the “Integer” parameter connected to the “Open Port” component, and have set the Open property of that component to True, you are now ready to begin communicating with the Arduino board. Let’s look at the “Uno Read” component again (shown in Fig. 7). Although you have already established and opened a port over which communication between the Arduino board and Grasshopper can take place, both the “Uno Read” and “Uno Write” components require a clear directive to actually begin utilizing that open port. This directive is defined through two required input parameters: Start and Port. The Start input expects a “Boolean” value and the Port input expects an “Integer” value (naturally, the corresponding port number of the line of communication you have already opened in the “Open Port” component). In addition to initializing the “Uno Read” component, you must also define how often to check for updated values from the Arduino board. This is accomplished by connecting a “Timer” object directly to the “Uno Read” component. The “Timer” object sends pulses at a set interval (in this case every 20ms) to the “Uno Read” component, which essentially command the component to retrieve new values for each of the Arduino board’s input pins. Now let’s set our “Boolean Toggle” to True and connect some text panels to our component outputs for some feedback and… you’re now reading values from our Arduino board’s input pins (as shown in Fig. 8). Fig. 7 -Uno Read Component Fig. 8 -Uno Read Component
  • 8. GettingStartedwithFirefly 8 Reading & Writing Uno write Using the “Uno Read” component you’ve now used Firefly as an input to retrieve data from the Arduino board’s output pins. With this data, you can drive any parameter of your Grasshopper definition in any manner that you desire. The counterpart to “Uno Read” is the “Uno Write” component (shown in Fig. 9) which allows you to use Firefly as an output that can send data to the Arduino board’s input pins. If you remember how to initialize and begin sending pulses to the “Uno Read” component, then you’ll have no trouble getting the “Uno Write” component up and running. Notice the two input parameters Start and Port as well as the “Timer” object connected directly to the “Uno Write” component. The obvious difference here is the number of inputs available, which correspond to the pins you can control on the Arduino board from Grasshopper. Each digital pin input parameter (eg. DPin13) expects either a “Boolean” or “Integer” value. As in most if not all programming languages, True evaluates to 1, False evaluates to 0, and vice versa. In addition, any non-zero integer evaluates to True. Taking a closer look at the input parameters of “Uno Write” you’ll notice a small variation on specific digital pins, specifically the tilde (~). The tilde defines pins that can be used for either digital input (0 or 1 / false or true) or PWM (pulse width modulation). In brief, PWM uses square waves to simulate analog values by modulating the time the signal is high by the time the signal is low. These pins can accept integers other than 0 or 1 and are great for fading LED’s, controlling motors, etc. By right-clicking the input parameters you can set how each digital pin should behave (shown in Fig. 10). The Out output parameter is included here in order to demonstrate that the “Uno Write” component continually writes data to all of the Arduino board’s input pins regardless of whether you are actually changing one or all of the “Uno Write” input parameters. Fig. 9 -Uno Write Component Fig. 10 -Set Pin to PWM