5.a. Using the Demo Program

The Demo Program

The Orangutan ships with a demo/test program pre-loaded. This demonstrates most of its features and allows you to test that it is working correctly. When you first turn on your Orangutan, you will hear a beep and see the words “Pololu xV-xx8”, then “Demo Program” appear, indicating that you are running the demo program. If you hear a beep but do not see any text on the LCD, you may need to adjust the contrast potentiometer in the upper-right corner of the board. When the program has started successfully, press the B button (the middle button, marked PB4 on the underside of the board) to proceed to the main menu. Press C (the top button, marked PB5) or A (the bottom button, marked PB1) to scroll forward or backward through the menu, and press B to make a selection or to exit one of the demos. There are seven demos accessible from the menu:

  1. Battery (SV-xx8 only): This demo displays the battery voltage in millivolts. Desoldering the SMT jumper marked ADC6=VBAT/3 will separate the battery voltage measurement circuit from the analog input, causing the number displayed to drop to some low value. Note that this demo only exists on the SV-xx8 version of the program.
  2. Temp (LV-168 only): This demo displays the board temperature in degrees Fahrenheit (button C) or Celcius (button A). If you touch the board near the center you should see the temperature rise. Desoldering the SMT jumper marked ADC6=TEMP will separate the temperature sensor output from the analog input, causing the number displayed to drop to some low value. Note that this demo only exists on the LV-168 version of the program.
  3. LEDs: Blinks the red and green user LEDs on the underside of the board. If you have soldered in the optional user LEDs, they will also blink.
  4. Trimpot: Displays the position of the user trimmer potentiometer, which is located on the underside of the board, as a number between 0 and 1023. While displaying the value, this demo also blinks the LEDs and plays a note whose frequency is a function of the current reading. It is easiest to turn the trimpot using a 2mm flat-head screwdriver.
  5. Motors: Hold down A or C to run motor 1 or 2, respectively, or hold down both buttons to run both motors simultaneously. The motors will gradually ramp up to speed; in your own programs, you can switch them on much more suddenly. Tap A or C to switch the corresponding motor to reverse (the button letter becomes lowercase if pressing it will drive the corresponding motor in reverse).
  6. Music: Plays an adaptation of J. S. Bach’s Fugue in D Minor for microcontroller and piezo, while scrolling a text display. This demonstrates the ability of the Orangutan to play music in the background.
  7. Timer: A simple stopwatch. Press C to start or stop the stopwatch and A to reset. The stopwatch continues to count while you are exploring the other demos.

The source code for the demo program is included with the Pololu AVR C/C++ Library. After downloading and unpacking the library zip file, the demo program can be found in the appropriate examples\atmegaxx8\xV-xx8_demo_program.

The “Secret” Test Program

The demo program contains a simpler test program that can be triggered if you hold one of the user pushbuttons while resetting or turning on the controller. We use this program to test each Orangutan before it ships. When this test program first begins running, the LCD will display a startup screen followed shortly by an interpretation of the voltage on pin ADC6. On the Orangutan SV-xx8, this figure represents the current battery voltage in millivolts; on the Orangutan LV-168, this figure represents the output of the temperature sensor in degrees Fahrenheit (if you touch the board near the center you should see the temperature rise). From this point on, you can use the three user pushbuttons to navigate through the three demo modes:

    A Button: Motor Demo

    Pushing the bottom user pushbutton (labeled PB1 on the back of the Orangutan PCB) will take you to the motor demo, which alternates between driving motors 1 and 2 forward and reverse. First, the Orangutan gradually ramps motor 1 from stationary to full-speed forward, to full-speed reverse, and back to stationary; motor 2 is stationary during this entire phase. Next, the Orangutan repeats this process with motor 2 while motor 1 remains stationary. The two motors alternate periods of activity like this for the duration of the demo. While motor 1 is active, the red LED is lit, and while motor 2 is active the red LED is off. While the currently active motor is moving forward, the green LED is lit, and while the currently active motor is moving in reverse, the green LED is off. The LCD gives you feed back about which motor is moving in which direction: “F” = forward, “R” = reverse, and “-” = inactive.

    B Button: User I/O Demo

    Pushing the middle user pushbutton (labeled PB4 on the back of the Orangutan PCB) will take you to the user I/O demo, which makes use of the eight user I/O pins and the trimmer potentiometer. At any given time, one pin is being driven low while the rest are weakly pulled high. At the same time, the LCD displays the input values on the eight user I/O pins. If you short a pin to ground, you will see the corresponding bit on the LCD go to zero. Pin PD1 will always read as low because it is being pulled down through the red user LED. The pin that is driven low will repeatedly cycle from left to right and back again, “bouncing” back and forth from PC5 to PD0 to PC5. The period of this cycle is determined by the position of the user potentiometer. You can connect an LED between an I/O lines and power (make sure you use a current-limiting resistor!), and the LED will light each time the pin it’s connected to is driven low.

    Note: do not short a pin to power or else you could damage the ATmega168 microcontroller when it tries to drive that pin low; only short it to one of the ground pins along the top edge of the board, or use an LED in series with a resistor to connect to power.

    C Button: Melody Demo

    Pushing the top user pushbutton (labeled PB5 on the back of the Orangutan PCB) will take you to the melody demo, in which the Orangutan plays a fugue on the buzzer while using high-frequency software PWM to alternately fade the red and green user LEDs in and out. The demo program uses the Pololu AVR library to play the melody directly from program memory (i.e. flash), thereby conserving RAM, and it uses timer interrupts to play the melody notes at the proper times, so program execution is not blocked as the melody plays.