3.9. Adding electronics

3.9.1. Controlling a servo

This section gives tips for how additional electronics can be connected to the Romi 32U4 Control Board.

Free I/O pins

If you want your additional devices 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. The pin assignment table in Section 3.8 lists all of these pins and how they are used. Many of the I/O pins are already being used for some other purpose on the board, but there are 8 free I/O pins: 0, 1, 5, 12, A0, A2, A3, and A4. Any of the free I/O lines can be used as basic digital inputs or outputs; each pin also has some special capabilities.

Pin 0 (PD2) and pin 1 (PD3) are the RX and TX lines of the AVR’s TTL serial port.

Pin 5 (PC6) is a hardware PWM output and is usable with the Arduino analogWrite() function. Pin 12 (A11/PD6) can also be used as a PWM output, but it is not supported by analogWrite(), and using pin 12 for PWM might conflict with uses of pin 6 (which controls the buzzer by default) as these two pins are complementary outputs of Timer4 channel D.

Pins 12 (A11/PD6), A0 (18/PF7), A2 (20/PF5), A3 (21/PF4), and A4 (22/PF1) can be used as analog inputs.

Freeing up more I/O pins

If the free I/O pins are not sufficient for connecting the devices you want to connect, you might need to disable or disconnect some of the other features of the Romi 32U4 Control Board to free up more I/O pins.

If you do not need the AVR to be able to measure the battery voltage, you can use pin A1 (19/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 = BATLEV” in order to disconnect it from the on-board voltage divider. If you only want to use A1 as an output, you might not need to cut that jumper.

If you are not connecting an LCD to the board’s LCD connector, then pin 11 (PB7) and pin 4 (A6/PD4) are free. Both pins can be used for digital input and output. In addition, pin 11 can be used as a PWM output and a pin change interrupt and pin 4 can be used as an analog input.

If you are not connecting an LCD to the board’s LCD connector, you can use 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 free up pin 6 (A7/PD7) by cutting the surface-mount jumper labeled “6 = Buzzer”. Pin 6 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.

If you do not need encoders, you can free up pin 7 (PE6), pin 8 (A8/PB4), PE2, and pin A5 (23/PF0). Each of those pins has a corresponding surface mount jumper on the bottom of the board that can be cut in order to disconnect the encoder output from the AVR.

Be careful about connecting electronics to pin 13 (PC7), pin 17 (PB0), and pin 30 (PD5). These pins are used to control the LEDs on the Romi 32U4. All three of these pins are controlled as outputs by the bootloader. Pin 17 (PB0) and pin 30 (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.

I²C devices

It should be possible to attach additional I²C slave devices to the control board’s I²C bus as long as the additional devices’ slave addresses do not conflict with that of the LSM6DS33, which uses 7-bit address 1101011. The ATmega32U4’s I²C pins (2 and 3) operate at 5 V. If you are connecting a 3.3 V device, you can connect it to the 3.3 V side of the bus instead (accessible through Raspberry Pi GPIO pins 2, for SDA, and 3, for SCL, even if a Raspberry Pi is not connected). Separate level shifters might be necessary to interface with devices that use other voltages.

If you do not want to use the inertial sensors on the I²C bus, you can cut the surface-mount jumpers labeled “IMU SDA Jmp” and “IMU SCL Jmp”. This frees up pin 2 (PD1) and pin 3 (PD0) for limited use as digital inputs and outputs as long as a Raspberry Pi is not attached to the control board. Note that the AVR’s I²C pins will remain connected to the on-board I²C level shifters and will therefore still be pulled up to 5 V.

Power

The control board’s power nodes are accessible in several areas on the board. If you power additional devices from VSW, then they will be powered whenever the control board’s power is in ON, 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 is on (but they cannot be powered from USB). If you power them from a 5V pin, then they will receive 5V power whenever the control board’s logic components are powered. If you power them from 3V3, they will receive 3.3V power whenever the control board’s logic components are powered. For more information about these power nodes and how much current they can provide, see Section 3.5.

It is also possible to add your own power switch to control power to the Romi 32U4 Control Board, as described in Section 3.5.

Ground

You should make sure that all the grounds in your system are connected. The Romi 32U4 Control Board’s ground node can be accessed from pins labeled “GND”. It should be connected to the ground node of every other circuit board or device you add to the robot.

Related Products

Romi 32U4 Control Board
Romi Robot Kit for FIRST - Red
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors