Arduino: Installation for Hummingbird Arduino

To use the Hummingbird Duo in the Arduino environment, you’ll need to put your Hummingbird into Arduino mode, install Arduino, and then install our Arduino libraries.

Installation Instructions

1. First, use the Hummingbird Firmware Burner to put your Hummingbird Duo into Arduino mode.

2. Install the Arduino IDE.

3. Run the Arduino IDE one time – simply open and close it. This may seem odd, but the first time Arduino launches it creates a number of folders that are necessary for our installation utility to operate properly.

4. Download and extract the Hummingbird Arduino files. 

5. Locate your Arduino Sketchbook folder. Open the Arduino IDE and go to File->Preferences (Arduino->Preferences on a Mac). In the resulting menu, make note of the path to the Sketchbook IDE:

 

6. Copy the folders “libraries, hardware, and tools” to the Arduino Sketchbook folder. If you already have existing folders named libraries, tools, etc in the Sketchbook folder, then merge the contents of the folders.

7. WINDOWS-ONLY. Go into the WindowsDrivers folder and double click runDriverInstall.bat.

8. Restart the Arduino IDE.

Verifying your Installation

Once you’ve installed the Hummingbird Arduino libraries, you can verify that installation was successful by opening (or re-opening) the Arduino environment.

First, select the Hummingbird Duo as your board type by navigating to Tools->Board->Hummingbird Duo:

Under File ->Examples ->Hummingbird you should now see ten Hummingbird Duo Arduino example programs.

Example Programs

Arduino comes with a number of example programs. You can access the sample programs in the Arduino IDE by navigating to File->Examples->Hummingbird.

The sample program are described below. A sample program named BlankSlate is also included for Arduino; this is a basic starter file that includes the minimum necessary code for a Hummingbird Duo program.

  • BlinkLED: Blinks the status LED and the LED on port 1 for 0.5 seconds on, 1 second off.
  • FadeLED: Fades on and off the status LED and LED on port 1.
  • KnobMotorControl: Controls the speed of a gear motor on port 1 with a knob sensor attached to sensor port 1.
  • LEDThermometer: Sets the color of a tri-color LED on port 1 to correspond with a temperature from a temperature sensor attached to port 4. Also prints the temperature in Celsius over the serial port. Blue is 10 C or less, green is 25 C, and red is 40 C.
  • SensorPrinter: Prints the values of the four sensor ports, first as raw values, and then converted into units assuming a light or knob sensor attached to port 1, a sound sensor on port 2, a distance sensor on port 3, and a temperature sensor on port 4. Also prints the system voltage.
  • SensorTrigger: Checks the sensor value on port 1, if it’s below 100 it turns off the status LED and turns on a vibration motor and an LED. If it’s 100 or more, it turns on the status LED and turns off the LED and vibration motor.
  • SerialHummingbirdInterface: Allows control of outputs and reading of sensors via a serial interface.
  • SimpleServo: Moves the servos in order from port 1 to 4 between 0 degrees and 180 degrees.
  • SlowMotionServo: Moves one servo from 0 to 180 degrees and back slowly.

 

Duo’s Hummingbird and Arduino Sides

Hummingbird Duo has connectors for components on both the top and bottom of the board. The top side, or Hummingbird connectors, are used for connecting to Hummingbird kit components like sensors, servos, LEDs, and motors. The bottom side connectors follow the standard Arduino header spacing and pinout and can be used for connecting to hundreds of Arduino shields. There are three ways to use Hummingbird as an Arduino; you can use solely kit parts and connect them to the Hummingbird top side connectors, you can use solely Arduino shields and the bottom side connectors, or you can use both.

Using top side Hummingbird connectors

The top side Hummingbird connectors are specifically designed to interface with Hummingbird kit parts, and the Hummingbird Arduino library described in section 3 is designed with this assumption in mind. You may also choose to interface non-kit parts to these connectors – for example, standard LEDs in the LED port, or non-kit motors/servos. Make sure to read the Hummingbird Duo datasheet for more information about using the connectors with non-kit components.

Using bottom side Arduino connectors

The bottom side Arduino connector pinout is identical to that found on the Arduino Leonardo and is compatible with all Leonardo-compatible shields. There are two important considerations to using Hummingbird exactly as an Arduino Leonardo:

Integrated Motor/Servo Shield: The gear motors and servos are controlled by a secondary processor that is controlled by the main microcontroller via SPI. SPI can be shared between multiple shields/devices, but we needed to use one I/O pin as the “slave select” line. We are using Arduino pin 8 for this function. If you wish to use the integrated motor/servo capabilities of the Duo, rewire any shields that use pin 8 to an alternative I/O pin.

Battery Voltage Detect: The Hummingbird Duo has an integrated battery voltage monitor that makes use of analog input pin A5. Use another analog port if you wish to retain this feature. You can use A5 as a traditional analog input: an external analog signal will safely override the battery voltage signal.

Mixing top and bottom side connectors

It is quite possible to use Arduino shiels and top side connectors simultaneously, but care must be taken to ensure that signals that map to both the top and bottom connectors are appropriately programmed and connected. It is good practice to connect only one component to each signal; for example, if you have an Arduino shield that makes use of Arduino I/O pin 6, you should not also connect the green element of the tri-color LED on port 2. Observe the following tables when mixing top side components with Arduino shields:

Digital I/O
Arduino Pin Hummingbird Use
0 Not used
1 Not used
2 Controls LED port 2
3 Controls LED port 1
4 Controls RGB port 1, green element
5 Controls RGB port 2, red element
6 Controls RGB port 2, green element
7 Controls RGB port 1, red element
8 Controls SPI slave select for motor/servo controller.
9 Controls Vibration motor 1
10 Controls Vibration motor 2
11 Controls RGB port 2, blue element
12 Controls RGB port 1, blue element
13 Controls Status LED on top side, ‘L’ LED on bottom
SDA Controls LED port 2
SCL Controls LED port 1
Analog In
Arduino Pin Hummingbird Use
0 Controls LED port 4
1 Sensor 1 input
2 Sensor 2 input
3 Sensor 3 input
4 Sensor 4 input
5 Battery voltage monitor
SPI
Arduino Pin Hummingbird Use
MOSI MOSI to motor/servo controller, can be used for additional modules
MISO Not used
SCK SCK to motor/servo controller, can be used for additional modules

Source Code

The source code for the Hummingbird Arduino library is available on Github, and is also installed in the Arduino Sketchbook folder at libraries->Hummingbird.