This guide has information on installing and using the Arduino IDE to flash new versions of firmware on the Vorpal Hexapod and gamepad. This guide does not assume you are familiar with Arduino programming, and it provides a step by step cookbook approach. To further explore Arduino, please see educational materials on the web, including at the Arduino website, youtube.com, and other sources.
Downloading the Arduino IDE
You can download the Arduino IDE from the Arduino Project Website Downloads Page. It's available for Windows, Mac, and Linux. Download the version for your system and follow the instructions to install it.
This guide assumes you sourced the Nanos in your kit from the Vorpal Store. If you didn't, then you may have a different version of Nano than we're talking about here, and you would potentially need to slightly adjust what you do. We assume that if you sourced your own parts, you known what you're doing.
Downloading the Hexapod Arduino Code
The code is available on Github (search for Vorpal Hexapod and it pops right up), however sometimes what's at the top of the github source tree is not the latest stable build. So for convenience we have stored the current tested and released stable version in a shared dropbox folder here:
Download all the files and folders to your local hard drive before continuing.
Installing Required Libraries
The Hexapod project code requires three libraries that are maintained by other organizations. These are open source and are free:
- Adafruit Servo PWM Driver Library
- Pixy Camera Library
- SDFat Library by Bill Greiman
The versions we have tested with the current release are in the shared Dropbox folder referenced above. You may also go directly to the project pages for those projects if desired, a web search will bring them right up. However, it's possible the libraries have been revised up to later versions that have not been tested by Vorpal Robotics. So, you are better off using the files that are posted in the shared folder.
To install the libraries follow these steps:
- Download the ZIP files for the libraries from the shared files area http://tinyurl/VorpalFiles (look in the LIBRARIES subfolder).
- Open the Arduino IDE that you previously installed.
- Click on the menu SKETCH, select INCLUDE LIBRARY. Then select ADD .ZIP LIBRARY.
- Browse in the folder you downloaded the ZIP files previously and select Adafruit Servo Library. Then, repeat for the Pixy and SDFAT libraries.
After this, click on the menu SKETCH, choose INCLUDE LIBRARY, and confirm that you see the Adafruit Servo PWM Driver Library, the SDFat library, and the Pixy library listed there.
NOTE: Do not actually select any library from this list! Just look to see that they appear in the list. Selecting one or more from the list would insert extra header files that will cause the program not to compile.
Installing Drivers for the CHG34x USB Serial Chip
This step is only required for MAC operating systems, and only if you plan on flashing the robot. The Nano we use on the robot has a serial port that requires the CHG34x driver on Mac operating systems. On Windows and Linux, this driver is almost always installed by default. Just be sure you have a live Internet connection before plugging the USB cord into the Nano on the robot in case Windows needs to find the driver online.
For MAC, see the DRIVERS folder in the shared dropbox link shown above. Follow the instructions in the folder.
Flashing Code on the Gamepad
To flash a new version of the Vorpal Gamepad Code onto the Gamepad follow these steps:
- Browse your filesystem and find the gamepad code in the files you downloaded from the Vorpal Files Shared Dropbox folder.
- Open either the debug or production version of the gamepad code. (The names of the files describe what they contain).
- The Arduino IDE should now boot up and show the code. Confirm again that you've opened one of the "Gamepad" file names.
- Plug the Gamepad Nano into a USB port on your computer. If this is the first time you've ever plugged an Arduino into your computer and it's a Windows system, you may need to wait a minute or so for the drivers to install.
- Go into the menu TOOLS, select the BOARD item and make sure it's set to "Arduino Nano".
- Make sure the TOOLS menu PROCESSOR item is set to ATMEGA328P. NOTE: In very recent versions of the Arduino IDE you may need to use ATMEGA328P (Old Bootloader). If the code fails to compile with (Old Bootloader) then try the other one, because manufacturers are sort of randomly supplying old and new bootloaders these days, so you could have either one.
- Open the TOOLS menu COM port item and make sure the COM port for your Nano is selected. If you see no COM ports, you either didn't plug in a Nano, or you don't have the drivers installed yet. If you see more than one COM port and don't know which one is your Nano, you may need to dismiss the menu, unplug the Nano, bring the menu up again, and notice which one dissappears/reappears as you unplug/plug in your nano. NOTE: The menu doesn't refresh unless it's dismissed and brought back up.
- Press the "Upload" button (a small arrow pointing to the right). The code will now compile and upload.
If the upload is successful, you will get a message "Upload is Done" near the bottom of the screen.
If something went wrong, carefully follow the instructions a second time. If you still have issues, try our support forum for help.
Most of the steps you have done above only have to be done once. After the first time, you will normally just need to boot up the IDE and hit the "upload" button. The driver will still be installed, all the menu items retain their prior values, libraries will remain installed, etc. You may sometimes need to use TOOLS, PORT to select the right device.
Flashing Code on the Robot
The steps for uploading the robot program are identical. You just want to open up the robot source file instead of the gamepad source file.
Also, be sure the robot has a fresh battery and is turned on before you plug in your USB cord. Unlike the gamepad, the robot cannot be powered solely by USB and you may brown out your computer's USB port if the robot is not powered.
- Sync errors:
- Do you have the correct PORT selected from the TOOLS menu?
- Have you tried both 'ATMEGA328P' and 'ATMEGA329P (Old Bootloader)' versions of the processor?
- Missing library errors: Make sure you've loaded the libraries stored in the Vorpal shared dropbox folder.
- Syntax errors:
- Make sure you have a recent version (1.8 or later) of the Arduino IDE installed.
- Make sure you have not accidentally modified the code by typing into the window or accidentally selecting INSERT LIBRARY from the IDE menu. Try copying again from the shared dropbox folder.
- Robot doesn't have V3 functions.
- Make sure you flashed both the gamepad and the robot with the V3 code. Flashing one but not the other won't work.
Vorpal The Hexapod Quick Links
|Sign Up For Our NEWSLETTER||VORPAL FORUM: Join the Discussion|
Getting & Giving Vorpal