Vorpal Robotics Wiki
Log in

Vorpal The Hexapod: Flashing The Arduino Code

From Vorpal Robotics Wiki
Revision as of 14:17, 11 November 2018 by Vorpalwiki (talk | contribs)

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 here. 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), but for convenience we have stored the current tested and released 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 two libraries that are maintained by other organizations. Both of these are open source and are free:

  • Adafruit Servo PWM Driver Library
  • Pixy Camera Library

The versions we have tested with the current release are both 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.

To install the libraries follow these steps:

  1. Open the Arduino IDE that you previously installed.
  2. Click on the menu SKETCH, select INCLUDE LIBRARY. Then select ADD .ZIP LIBRARY.
  3. Browse in the downloaded folder named LIBRARIES and select the Adafruit Servo Library. Then, repeat for the Pixie library.

After this, click on the menu SKETCH, choose INCLUDE LIBRARY, and confirm that you see the Adafruit Servo PWM Driver Library and the Pixy library listed there.

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:

  1. Browse your filesystem and find the gamepad code in the files you downloaded from the Vorpal Files Shared Dropbox folder.
  2. Open either the debug or production version of the gamepad code. (The names of the files describe what they contain).
  3. The Arduino IDE should now boot up and show the code. Confirm again that you've opened one of the "Gamepad" file names.
  4. 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.
  5. Go into the menu TOOLS, select the BOARD item and make sure it's set to "Arduino Nano".
  6. Make sure the TOOLS menu PROCESSOR item is set to ATMEGA328P.
  7. 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.
  8. 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, fortunately. 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.

Flashing Code on the Robot

The steps are identical, you just want to load up the robot source file instead of the gamepad source file.