Introduction: Arduino: Installing Standard Firmata
Arduino is an open-source electronics platform based on easy-to-use hardware and software. You typically use an Arduino microcontroller board in one of two ways:
- You can plug the board into a desktop computer and upload a computer program (or script). Once the board is programmed you can then embed it in your own projects and power the board using a standard AC adaptor, or,
- You can keep the board plugged into the desktop computer and transfer messages (data) between the board and the computer. In this case you are using the board as an "extension" of your computer to provide a set of digital and analog input or output connections.
In this Instructable we will consider case #2, using the Standard Firmata library. Firmata is a protocol (set of rules) for communicating with microcontrollers from software on a computer, smartphone, or tablet. Standard Firmata is a software library that allows Arduino devices to communicate with your computer using the Firmata protocol.
In the following steps we'll show how to download, install, and test the Standard Firmata library on an Arduino Uno device plugged into a computer running Mac OS X 10.10.3. These steps should work on any Arduino-compatible device including the Arduino Pro Mini or the LilyPad. The steps should also work on either Microsoft Windows or Linux with only minor modifications.
Step 1: Download and Install the Arduino Application
Your first step should be to download the Arduino application from http://www.arduino.cc/en/Main/Software. Be sure to choose the latest version and also the correct download for your computer and operating system.
Once the software has downloaded, you can install the application using the method appropriate for your system.
- For Mac OS X you will be downloading a ZIP file. Double-clicking on the ZIP should produce a single "Arduino" application file which you can then copy into your Applications folder.
- For Windows, you should download the .EXE containing a full Windows installer. Double clicking on the .EXE should start the installation.
- For Linux you will download a compressed TAR file. You can use the "tar" command to uncompress and unpack the application.
After installation, start the Arduino application. After the splash screen appears, the application should open up with a default program, called a "sketch", in the text editor. This is usually the "Blink" sketch.
Step 2: Plug in Your Arduino Board
At this point you are ready to plug your Arduino board into your computer. Your board should have a USB cable to attach the board to the computer. Disconnect any wires that may be attached to your Arduino or LilyPad and plug the board into the computer.
Depending upon your Arduino, the USB cable will plug directly into the board using a standard, mini, or micro USB plug.
Step 3: Choose Your Port and Board
Once you have your Arduino board plugged into your computer, you need to tell the Arduino application how to find the board and what type of board it is.
First, in the Arduino application, go under the menu item Tools --> Port. There, you should see a list of available USB ports. Hopefully, if you have plugged in your Arduino, one of the ports should have the port number followed by the name of the board. Choose this menu item to select the correct USB port.
If you don't see your board listed under any of the ports, double check that the board is plugged into the computer. If you still don't see the correct port, then follow one of the detailed installation guides:
- For Windows, http://www.arduino.cc/en/guide/windows
- For Mac OS X, http://www.arduino.cc/en/Guide/MacOSX
- For Linux, http://playground.arduino.cc/Learning/Linux
After you have chosen the port, go under the Tools --> Board menu item. Here you will see a list of supported Arduino and LilyPad boards. Choose the menu item that corresponds to your board. If you don't see your board listed, check the detailed instructions that came with your board. If your board came from a third-party manufacturer such as SparkFun, the instructions should tell you which board is "compatible".
Step 4: Upload the Standard Firmata Sketch
Now we're ready to upload Standard Firmata to the Arduino.
In the Arduino application, open the sketch using File --> Examples --> Firmata --> Standard Firmata. You should see the "C" code appear for the Standard Firmata sketch. You don't need to understand any of the actual code to use Firmata, but if you'd like, feel free to scroll through and examine the code.
Now, at the top of the text editor window, click the "Upload" button as shown in the picture above. At the bottom of the text editor window, you should see a small status window. This will report the progress as the code is compiled and then uploaded to the Arduino. While the code is being uploaded, you should see some very small LED lights (the Transmit (TX) and Receive (RX) lights) on your Arduino board blinking as the data is transferred.
When the process is completed, you should see the message "Done Uploading" in the status window at the bottom of the editor. If you see an error message, go on to the next step about "Troubleshooting." Otherwise, skip the next step.
Step 5: Troubleshooting
There are usually two things that can go wrong.
First, if you get the message "Problem uploading to board" (as seen in the first picture above), this usually indicates that you have chosen the wrong USB port. Go back to the Tools --> Port menu item and see if there is a different USB port that you can try. Then click the "Upload" button.
Next, you may get a series of "not in sync" error messages (as seen in the second picture). This is almost always because you have chosen the wrong Arduino board. Go back to the Tools --> Board menu item and verify that your Arduino board matches the chosen menu item. Then click the "Upload" button again.
If you are still having problems, we recommend going to the Arduino websites mentioned in step 3. Instead of uploading the "Standard Firmata" sketch, you might try uploading the "Blink" sketch, which is much quicker to upload. Once you get the "Blink" sketch to upload, come back and try to upload "Standard Firmata" again
Step 6: Testing Standard Firmata
A quick test can be done using the Firmata Test application. You can download the application from the main Firmata page. Scroll down the page to find the Test application, and download the version appropriate for your desktop machine and operating system. Once you have the application running, use the Port menu item to choose the correct USB port. The Test application should report all of the available digital and analog ports for your Arduino, as shown in the second picture above.
For a more complete test, hook up an LED with a resistor to one of the ports. As seen in the first picture above, we've hooked two wires from the Arduino to a breadboard. The first wire comes from the ground (GND) pin of the Arduino. This wire is connected to a 100 ohm resistor (any resistor between 100 and 330 ohms should work), which in turn is connected to the short leg of a red LED. Finally, the long LED leg is connected to the blue wire which connects to pin 12 of the Arduino (you are welcome to use any of the digital output pins 2 through 13).
In the Firmata Test application, if you select "High" for your output pin, the LED should light up. Selecting "Low" should turn it off.
Congratulations! You've successfully set up your Arduino with Standard Firmata, and can now start building projects that transfer data between your computer and your Arduino!
1 Person Made This Project!
- ernstp made it!