10.c. Available I/O on the 3pi's ATmegaxx8

The easiest way to expand your 3pi’s capabilities is probably to turn your 3pi into a “smart base” that is controlled by the microcontroller of your choosing, as described in Section 10.a. This allows you to connect your additional electronics to your secondary microcontroller and only requires you to make connections to pins PD0 and PD1 on the 3pi. These two pins are completely unused digital I/O lines that connect to the ATmegaxx8’s UART module when that module is enabled. You can freely use PD0 and PD1 for general-purpose digital I/O, or you can use them for serial communication with another microcontroller, a serially-controlled device, or a computer (note that you will need to convert the signal to RS-232 levels or USB to communicate with a computer).

In addition to PD0 and PD1, the 3pi robot has a limited number of I/O lines that can be used as inputs for additional sensors or to control additional electronics such as LEDs or servos. These I/O lines can be accessed through the pads at the center of the 3pi, between the two motors, labeled PD0, PD1, ADC6, ADC7, and PC5. If you are using an expansion kit, these lines are brought up to the expansion PCB.

Pins PC5, ADC6, and ADC7 are all connected to 3pi hardware via removable shorting blocks. By removing the shorting block, you can use these pins for your own electronics. Pin PC5 can be used as either a digital I/O or an analog input. When its shorting block is in place, it controls the emitters for the IR sensors; when its shorting block is removed, the emitters are always on. Pin ADC6 is a dedicated analog input that connects to a voltage divider circuit that monitors the battery voltage when its shorting block is in place, and pin ADC7 is a dedicated analog input that connects to the user trimmer potentiometer when its shorting block is in place.

Note: If you call the Pololu AVR library’s sensor reading functions, the 3pi will drive pin PC5 high for the duration of the sensor read, and it will then drive pin PC5 low. It does this even if the PC5 shorting block is removed. If this behavior will interfere with what you want to connect to PC5, you can modify the library code to initialize the sensors with a bogus emitter pin (e.g. 20 instead of 19).

If you are willing to give up the LCD, as is required when you use the expansion kit without cutouts, you gain access to several more I/O lines. Removing the LCD completely frees the three LCD control pins (PB0, PD2, and PD4), and it makes the four LCD data pins (PB1, PB4, PB5, and PD7) available for limited use. If you do use the LCD data pins, you must make sure that their alternate functions do not conflict with whatever you connect to them. Pins PB1, PB4, and PB5 connect to the user pushbuttons, and PD7 connects to the green user LED. It is important to note that PB4 and PB5 are also programming lines, so you must not connect anything here that would interfere with programming.

So in summary, pins PD0 and PD1 are completely free digital I/O lines that can be used for general-purpose I/O or for TTL serial communciation. Pins PC5, ADC6, and ADC7 can be freed from 3pi hardware by removing their respective shorting blocks. PC5 can be used as an analog input or a digital I/O, and ADC6 and ADC7 are dedicated analog inputs. Pins PB0, PD2, and PD4 become completely free digital I/O lines once you remove the LCD, and pins PB1, PB4, PB5, and PD7 are digital I/O lines that you can use for certain applications if you are careful not to cause conflicts between them and their alternate functionality.

For more information, please see Section 9 for the 3pi pin assignment tables and Section 5.e for the 3pi schematic diagram.