element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs Getting started with Gertduino - Firmata FTW
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: doorknob
  • Date Created: 19 Apr 2014 7:28 PM Date Created
  • Views 278 views
  • Likes 0 likes
  • Comments 0 comments
  • gertduino
  • firmata
  • all-sky
  • camera
Related
Recommended

Getting started with Gertduino - Firmata FTW

doorknob
doorknob
19 Apr 2014

Firmata is a serial communication protocol designed for transferring data between (for example) a microcontroller board and a host computer. Software running on the host (the Pi, in this case) can control, either by reading or writing to, ports on the target microcontroller (the Arduino, in this case).

 

There are a couple of different approaches typically adopted by Firmata users. One is to use a pre-written Arduino sketch called 'StandardFirmata' to handle the Arduino's ports, and the host side software then communicates with StandardFirmata as necessary to set or read specific Arduino interfaces. Another, more difficult but more powerful approach is for the Arduino programmer to write programs that directly use the Firmata library to handle the Arduino's ports, which allows the programmer to handle custom logic and preprocessing or postprocessing of the data within the Arduino sketch before or after shipping the data betweem the two endpoints.

 

My plan is to start off by using StandardFirmata to read and set port values. After I'm successful doing that, I may (or may not) consider rolling up my sleeves and doing some custom Firmata coding on the Gertduino.

 

The main page of the Firmata wiki is at http://firmata.org/wiki/Main_Page and the Firmata protocol itself is documented at http://firmata.org/wiki/Protocol. The Arduino Firmata library is documented at http://arduino.cc/en/reference/firmata.

 

Several Python modules have been developed to simplify the use of Firmata from the host side. Some of these are listed at https://github.com/firmata/arduino (under the heading of "Firmata Clients"). I am going to try using pyFirmata as it is the one that I've seen most frequently used in the examples that I've found.

 

As the Firmata protocol has evolved over time, it's a good idea to ensure that the version that you're using on the Arduino side is compatible with the library that you've chosen on the Pi side. The most-recently-released version of the protocol is 2.3. The pyFirmata repository at https://github.com/tino/pyFirmata states that it is compliant with Firmata version 2.1 (and version 2.3 should be backwards compatible with version 2.1). To find out which version of Firmata is installed on the Pi (for use when programming the Arduino), I took a look at Firmata.h (which is located in the /usr/share/arduino/libraries/Firmata directory of the Pi) and discovered that it is up-to-date with version 2.3.1:

 

image

 

A quick check of Google brings up a number of discussions about using Firmata to communicate between the Raspberry Pi and the Arduino, each with a common theme but a slightly different approach to the implementation. As noted earlier, most of the examples that I have seen use the pyFirmata module on the Pi, and they mostly all use the StandardFirmata.ino example program on the Arduino.

 

The MagPI magazine, issue 7, has a great article on using the firmata protocol to communicate between Arduino and the Raspberry PI. See https://ex.ploit.ws/themagpi/The_MagPi_issue_7.pdf on pages 4 through 6. That article assumes that the Arduino is connected to the Pi via serial-over-USB, so the procedures that the author describes differ from those that I will need to use with the Gertduino, but the differences look to be easily manageable.

 

The most complete description of using Firmata to communicate between the Pi and an Arduino that I've found is not on the web per se (unless you have an O'Reilly Safari subscription like I do, that is, in which case it can be found starting at http://my.safaribooksonline.com/book/hardware/raspberry-pi/9781449365288/14dot-arduino-and-raspberry-pi/sec14_3_html), but rather is contained in the pages of the O'Reilly book "Raspberry Pi Cookbook" (see http://shop.oreilly.com/product/0636920029595.do). You can see a sampler of that content here: http://razzpisampler.oreilly.com/ch10.html

 

So it looks like I'm going to start playing with Firmata. I'll let you know what I find out.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube