3.11. Adding electronics
This section gives tips for how the Zumo 32U4 can be expanded with additional electronics.
Freeing up I/O pins
If you want your additional electronics to send or receive information from the AVR, you will need to connect them to one or more of the AVR’s I/O pins. Each I/O pin is already being used for some other purpose, as documented in Section 3.10, so you might need to disable or disconnect one of the other features of the Zumo 32U4.
If you are not using the proximity sensors and you do not care about turning off the infrared emitters for the line sensors, you can cut the surface-mount jumper on the front sensor array labeled “LED”. This frees pin 11 (PB7) for other uses. Pin 11 can be used for digital I/O and analog input. We do not recommend making this change if you are using the proximity sensors, because then the line sensor infrared emitters would always be on, which would interfere with the proximity sensors.
If you are not using line sensor 2 or the left proximity sensor, then you can remove the sensor-selection jumper for pin 20 on the front sensor array. This frees up pin 20 (PF5) for other purposes. This pin can be used for digital input and output, as well as analog input.
If you are not using line sensor 4 or the right proximity sensor, then you can remove the sensor-selection jumper for pin 4 on the front sensor array. This frees up pin 4 (PD4) for other purposes. This pin can be used for digital input and output, as well as analog input.
If you are not using any of the sensors on the front sensor array, you can remove the front sensor array. This frees up 7 pins: pin 11 (PB7), pin 18 (PF7), pin 20 (PF5), pin 21 (PF4), pin 4 (PD4), pin 12 (PD6), and pin 22 (PF1). Each pin can be used for digital input and output, while 6 of them (all except pin 11) can be used as analog inputs.
If you are not using the proximity sensors, you probably will not want to use the IR LEDs on the main board, so that frees up pin 5 (PC6), which can be used for digital I/O or PWM output. That also frees up Timer3.
If you are not using the proximity sensors and you also do not need the AVR to be able to measure the battery voltage, you can use pin 19 (A1, PF6) for other purposes. This pin can be used for digital input and output, as well as analog input. If you want to use this pin as a digital or analog input, you might need to cut the surface-mount jumper labeled “A1 = VBAT / 2” in order to disconnect it from the VBAT voltage divider. If you only want to use A1 as an output, you might not need to cut that jumper.
If you do not need the display, you can remove it. This frees up pin 0 (PD2) and pin 1 (PD3). These pins are the transmit (TX) and receive (RX) pins of the UART, so you can use them to establish serial communication with another microcontroller. These pins are also capable of digital I/O. These pins are the recommended pins for connecting two output channels from an RC receiver, or for controlling two RC servos, because they are arranged in a convenient way with respect to power and ground on the right-side expansion header.
On the original (LCD) version of the Zumo 32U4, if you have removed the LCD and do not need to use button A, this frees up pin 14 (PB3). Pin 14 is capable of digital input and output. Removing the LCD also frees up the LCD contrast potentiometer for other purposes. The output of the potentiometer is a 0 V to 5 V signal which is accessible on the LCD connector. It can be connected to any free analog input if you want to read it from the AVR, or it might be useful to connect it to the other electronics that you are adding.
If you do not need to use the buzzer, you can cut the surface-mount jumper labeled “6 = Buzzer”. This disconnects pin 6 (PD7) from the buzzer, so it can be used for other things. Pin 6 (PD7) can be used as a PWM output, digital I/O line, or analog input. Disabling the buzzer also frees up Timer4, which has several PWM output pins. These pins can be used as PWM outputs if they are not needed for their normal tasks.
Be careful about connecting electronics to pin 13 (PC7), pin 17 (PB0), and PD5. These pins are used to control the LEDs on the Zumo 32U4. All three of these pins are controlled as outputs by the bootloader. Pin 17 (PB0) and PD5 are used as RX and TX indicators, so if you are sending or receiving data over USB then the Arduino USB code will drive those pins in its interrupt service routines while your sketch is running.
It should be possible to attach additional I²C slave devices to the Zumo 32U4’s I²C bus without giving up any features as long as the additional devices’ slave addresses do not conflict with those of the inertial sensors. (The sensors’ addresses are specified in their respective datasheets, which can be found in Section 3.7). The I²C pins (pins 2 and 3) operate at 5 V, so level shifters might be necessary to interface with other devices that use different voltages. (The level-shifted 3.3 V signals used by the inertial sensors are not available to the user.)
If you do not want to use the inertial sensors on the Zumo 32U4’s I²C bus, you can cut the surface-mount jumpers labeled “2 = SDA” and “3 = SCL”. This frees up pin 2 (PD1) and pin 3 (PD0). These pins can be used as digital inputs and outputs.
All of the Zumo’s power nodes are accessible from the left expansion area. If you power additional devices from VBAT, then they will be powered whenever the Zumo’s power switch is in the ON position, and they will receive whatever voltage the batteries are outputting. If you power them from VREG, they will get 5 V power whenever the batteries are installed and the power switch is on (but they cannot be powered from USB). If you power them from the 5V pin, then they will receive 5V power whenever the Zumo 32U4 logic components are powered. If you power them from 3V3, they will receive 3.3V power whenever the Zumo 32U4 logic components are powered. For more information about these power nodes and how much current they can provide, see Section 3.8.
It is also possible to add your own power switch to control power to the Zumo, as described in Section 3.8.
You should make sure that all the grounds in your system are connected. The Zumo 32U4’s ground node is labeled “GND” and can be accessed from any of the expansion areas. It should be connected to the ground node of every other circuit board or device you add to the robot.
Making the physical connections
You should refer to Section 3.9 to locate the access points in the Zumo 32U4 expansion areas for the pins you have chosen. One option to make the connections to those pins is to get two 2×13-pin female headers and solder them in to the left and right expansion areas. Another option would be to break off pieces of a 2×40-pin male header and solder them in. Our premium jumper wires can then be plugged into the male or female headers.