Pololu Romi 32U4 User manual

Pololu Romi 32U4 Control
Board User’s Guide
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
https://www.pololu.com/docs/0J69/all Page 1 of 55

1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Included components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2. What you will need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3. Supported operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3. Romi 32U4 Control Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1. Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2. User interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3. Motor drivers and encoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4. Inertial sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5. Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.6. Expansion areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.7. Raspberry Pi interface and level shifters . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.8. Pin assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.9. Adding electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.9.1. Controlling a servo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.10. AVR timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.11. Schematics and dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4. Assembling the Romi 32U4 Control Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5. Programming the Romi 32U4 Control Board . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.1. Installing Windows drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.2. Programming using the Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.3. Programming using avr-gcc and AVRDUDE . . . . . . . . . . . . . . . . . . . . . . . 41
6. Romi 32U4 Arduino library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7. The Romi 32U4 USB interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8. The A-Star 32U4 Bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9. Reviving an unresponsive Romi 32U4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9.1. Reviving using the Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9.2. Reviving using AVRDUDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10. Related resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
Page 2 of 55

1. Overview
The Romi 32U4 Control Board is designed to be assembled with a Romi chassis
[https://www.pololu.com/category/202/romi-chassis-and-accessories] to create a capable integrated robot
platform that can easily be programmed and customized.
Like our A-Star 32U4 programmable controllers [https://www.pololu.com/category/149/a-star-
programmable-controllers], the Romi 32U4 Control Board is built around a USB-enabled Atmel
ATmega32U4 AVR microcontroller, and it ships preloaded with an Arduino-compatible bootloader. The
control board features two H-bridge motor drivers and is designed to connect to a Romi Encoder Pair
Kit [https://www.pololu.com/product/3542] (available separately) to allow closed-loop motor control. It also
includes a powerful 5 V switching step-down regulator that can supply up to 2 A continuously, along
with a versatile power switching and distribution circuit. A 3-axis accelerometer and gyro enable a
Romi 32U4 robot to make inertial measurements, estimate its orientation, and detect external forces.
Three on-board pushbuttons offer a convenient interface for user input, while indicator LEDs, a buzzer,
and a connector for an optional LCD allow the robot to provide feedback.
The Romi 32U4 Control Board can be used either as a standalone control solution or as a base for a
more powerful Raspberry Pi controller. Its on-board connector and mounting holes allow a compatible
Raspberry Pi (Model B+ or newer, including Pi 3 Model B [https://www.pololu.com/product/2759] and
Model A+ [https://www.pololu.com/product/2760]) to plug directly into the control board. Integrated level
shifters make it easy to set up I²C communication and interface other signals between the two
controllers, and the control board automatically supplies 5 V power to an attached Raspberry Pi. In
this setup, the Raspberry Pi can handle the high-level robot control while relying on the Romi 32U4
Control Board for low-level tasks, like running motors, reading encoders, and interfacing with other
analog or timing-sensitive devices.
The I/O lines of both the ATmega32U4 and the Raspberry Pi are broken out to 0.1″-spaced through-
holes along the front and rear of the control board, and the board’s power rails are similarly accessible,
enabling sensors and other peripherals to easily be connected.
A software add-on is available that makes it easy to program a Romi 32U4 robot from the Arduino
environment, and we have Arduino libraries and example sketches to help get you started. A USB A
to Micro-B cable [https://www.pololu.com/product/2072] (not included) is required for programming.
1.1. Included components
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
1. Overview Page 3 of 55

The following components are
included with the Romi 32U4
Control Board:
• two low profile female headers for motors and encoders
•buzzer [https://www.pololu.com/product/1484]
•2×7 female header [https://www.pololu.com/product/1027] and male header
[https://www.pololu.com/product/966] for LCD
• battery terminals
• four 3/16″ #2-56 screws and nuts
• four M2.5 standoffs [https://www.pololu.com/product/1952] (11 mm length), screws
[https://www.pololu.com/product/1968], and nuts [https://www.pololu.com/product/1967] for mounting
Raspberry Pi
An LCD and Raspberry Pi are not included with the Romi 32U4 Control Board.
1.2. What you will need
These additional items are also needed for using and assembling the Romi 32U4 Control Board:
Required accessories
• a Romi Chassis Kit [https://www.pololu.com/category/203/romi-chassis-kits] (this includes motors,
wheels, one ball caster, and battery contacts)
• a Romi Encoder Pair Kit [https://www.pololu.com/product/3542]
• six AA batteries [https://www.pololu.com/product/1003]. The Romi chassis and control board
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
1. Overview Page 4 of 55

work with both alkaline and NiMH batteries, though we recommend rechargeable NiMH cells.
Assembly tools
• soldering iron and solder (we recommend one with adjustable temperature control like the
Hakko FX-888D Digital Soldering Station [https://www.pololu.com/product/2779])
• small Phillips screwdriver
•USB A to Micro-B cable [https://www.pololu.com/product/2072] to connect the board to your
computer for programming and debugging
Optional tools
• small 2 mm slotted screwdriver for adjusting the LCD contrast
•small pair of pliers [https://www.pololu.com/product/150]
•wire cutter and stripper [https://www.pololu.com/product/1923], for adding wires for peripherals
• tape or small clamps (for holding parts together when soldering)
Optional accessories
You might also consider getting these for your Romi 32U4 Robot:
• an 8×2 character LCD [https://www.pololu.com/product/356]
• a compatible Raspberry Pi (Model B+ or newer, including Pi 3 Model B [https://www.pololu.com/
product/2759] and Model A+ [https://www.pololu.com/product/2760])
•sensors [https://www.pololu.com/category/7/sensors], such as optical [https://www.pololu.com/
category/79/sharp-distance-sensors] or sonar range finders [https://www.pololu.com/category/78/
sonar-range-finders]
•connectors and jumper wires [https://www.pololu.com/category/19/connectors], for connecting
additional sensors and components
• battery charger, if you are using rechargeable batteries; since the Romi just uses ordinary
AA batteries, we recommend basic AA chargers (into which you stick the individual cells)
available at most general electronics stores, though we carry a much fancier iMAX-B6AC V2
balance charger/discharger [https://www.pololu.com/product/2588] that can be also used for this
1.3. Supported operating systems
The Romi 32U4 Control Board can be programmed using any operating system that supports the
Arduino environment. This includes Microsoft Windows 10, 8.1, 8, 7, Vista, XP (with Service Pack 3),
Linux, and macOS.
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
1. Overview Page 5 of 55

2. Contacting Pololu
We would be delighted to hear from you about any of your projects and about your experience with
the Romi 32U4 Control Board. You can contact us [https://www.pololu.com/contact] directly or post on our
forum [http://forum.pololu.com/]. Tell us what we did well, what we could improve, what you would like to
see in the future, or anything else you would like to say!
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
2. Contacting Pololu Page 6 of 55

3. Romi 32U4 Control Board
3.1. Microcontroller
Like our A-Star 32U4 programmable controllers [https://www.pololu.com/category/149/a-star-
programmable-controllers], the Romi 32U4 Control Board features an integrated, USB-enabled
ATmega32U4 AVR microcontroller from Atmel, clocked by a precision 16 MHz crystal oscillator. This
is the same microcontroller and clock frequency used in the Arduino Leonardo [https://www.pololu.com/
product/2192] and Micro [https://www.pololu.com/product/2188].
The control board includes a USB Micro-B connector that can be used to connect to a computer’s
USB port via a USB A to Micro-B cable [https://www.pololu.com/product/2072] (not included). The USB
connection can be used to transmit and receive data from the computer and program the board
over USB. The USB connection can also provide power for the microcontroller and most of the other
hardware on the board (but not motor power); see Section 3.5 for more details.
The control board’s ATmega32U4 comes preloaded with the Arduino-compatible A-Star 32U4 USB
bootloader [https://www.pololu.com/docs/0 66/7], which allows it to be easily programmed using the
Arduino IDE. or more information about programming the Romi 32U4 Control Board, see Section 5.
The board also has a 6-pin ISP header that allows it to be programmed with an external programmer,
such as our USB AVR programmer [https://www.pololu.com/product/3172]. Pin 1 of the header is indicated
with a small white dot and has an octagonal shape.
3.2. User interface
LEDs
The Romi 32U4 Control Board has five indicator LEDs.
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 7 of 55

• A yellow user LED is connected to Arduino digital pin 13, or PC7. You can drive this pin high
in a user program to turn this LED on. The A-Star 32U4 Bootloader [https://www.pololu.com/
docs/0 61/9] fades this LED on and off while it is waiting for a sketch to be loaded.
• A green user LED is connected to Arduino pin 30, or PD5, and lights when the pin is driven
low. While the board is running the A-Star 32U4 Bootloader or a program compiled in the
Arduino environment, it will flash this LED when it is transmitting data via the USB connection.
• A red user LED is connected to Arduino pin 17, or PB0, and lights when the pin is driven low.
While the board is running the A-Star 32U4 Bootloader or a program compiled in the Arduino
environment, it will flash this LED when it is receiving data via the USB connection.
The Romi32U4 library contains functions that make it easier to control the three user LEDs (see
Section 6). All three user LED control lines are also LCD data lines, so you will see them flicker when
you update the LCD. The green and red user LEDs also share I/O lines with pushbuttons (see below).
• A blue power LED next to the power switch indicates when the controller is receiving power
from the Romi’s batteries (the power switching circuit must be turned on).
• A green power LED on the bottom edge of the board near the USB connector indicates when
the USB bus voltage (VBUS) is present.
Pushbuttons
The Romi 32U4 Control Board has five pushbuttons: a power button in the rear left corner, a reset
button on the front right edge and three user pushbuttons located along the rear edge. The user
pushbuttons, labeled A, B, and C, are on Arduino pin 14 (PB3), pin 30 (PD5), and pin 17 (PB0),
respectively. Pressing one of these buttons pulls the associated I/O pin to ground through a resistor.
The three buttons’ I/O lines are also used for other purposes: pin 14 is MISO on the SPI interface, pin
30 and pin 17 control the green and red user LEDs, and all three pins are LCD data lines. Although
these uses require the pins to be driven by the AVR (or SPI slave devices in the case of MISO),
resistors in the button circuits ensure that the Romi 32U4 Control Board will not be damaged even
if the corresponding buttons are pressed at the same time, nor will SPI or LCD communications
be disrupted. The functions in the Romi32U4 library take care of configuring the pins, reading and
debouncing the buttons, and restoring the pins to their original states.
LCD
The Romi 32U4 Control Board has a set of through-holes in the center where a 2×7 header can be
soldered to connect an 8×2 character LCD [https://www.pololu.com/product/356] (or any other LCD with
the common HD44780 parallel interface [https://www.pololu.com/file/0 71/DMC50448N-AAE-AD.pdf] (109k
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 8 of 55

pdf)). You can adjust the LCD contrast with the potentiometer on the top right of the LCD connector.
We recommend using a 2 mm slotted screwdriver to adjust the contrast.
The Romi32U4 library provides functions to display data on a connected LCD. It is designed to
gracefully handle alternate use of the LCD data lines by only changing pin states when needed for an
LCD command, after which it will restore them to their previous states. This allows the LCD data lines
to be used for other functions (such as pushbutton inputs and LED drivers).
Note that the control board is not designed to allow both an LCD and a Raspberry Pi to plug into it
at the same time. However, having an LCD header soldered to the board should not interfere with
mounting a Raspberry Pi.
Buzzer
The buzzer [https://www.pololu.com/product/1484] included with the Romi 32U4 Control Board can be
soldered into the designated through-holes and used to generate simple sounds and music. By
default, it is connected to digital pin 6 (which also serves as OC4D, a hardware PWM output from the
AVR’s 10-bit Timer4). If you alternate between driving the buzzer pin high and low at a given frequency,
the buzzer will produce sound at that frequency. You can play notes and music with the buzzer using
functions in the Romi32U4 library. If you want to use pin 6 for an alternate purpose, you can disconnect
the buzzer circuit by cutting the surface-mount jumper next to the buzzer.
3.3. Motor drivers and encoders
Motor drivers
The Romi 32U4 Control Board has two Texas Instruments DRV8838 motor drivers that are used
to power the Romi chassis’s two mini plastic gearmotors [https://www.pololu.com/product/1520]. our
Arduino pins are used to control the drivers:
•Digital pin 15, or PB1, controls the right motor direction (LOW drives the motor forward,
HIGH drives it in reverse).
•Digital pin 16, or PB2, controls the left motor direction.
•Digital pin 9, or PB5, controls the right motor speed with PWM (pulse width modulation)
generated by the ATmega32U4’s Timer1.
•Digital pin 10, or PB6, controls the left motor speed with PWM.
or more information about the drivers, see the DRV8838 datasheet [https://www.pololu.com/file/0 806/
drv8838.pdf] (1MB pdf). We also sell a carrier board [https://www.pololu.com/product/2990] for this driver.
The Romi32U4 library provides functions that allow you to easily control the motors (see Section 6).
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 9 of 55

The motor driver connections are brought out to two pairs of headers that are intended to interface with
the Romi Encoder Pair Kit [https://www.pololu.com/product/3542]. A pair of low-profile female headers is
included with the Romi 32U4 Control Board and can be soldered into either the outer or inner row of
through-holes on each side. (Note that these headers must be soldered into the positions that match
the male header installed on the encoder board.)
As your batteries run out, the voltage supplied to the motor drivers (VSW) will decrease,
which will make the motors slower. It is possible to account for this in your code
by monitoring the battery voltage (see Section 3.5) or using the encoders and other
sensors to monitor the movement of the robot.
Quadrature encoders
The Romi 32U4 Control Board is configured to connect the quadrature encoder outputs from the Romi
Encoder Pair Kit to the ATmega32U4 microcontroller. The encoders can be used to track the rotational
speed and direction of the robot’s drive wheels. They provide a resolution of 12 counts per revolution
of the motor shaft when counting both edges of both channels, which corresponds to approximately
1440 counts per revolution of the Romi’s wheels. or more information about the specifications of the
Romi encoders, please see the Romi Encoder Pair Kit product page [https://www.pololu.com/product/
3542].
Quadrature encoder transitions are often detected by monitoring both encoder channels directly.
However, since transitions on the Romi’s encoders can occur at high frequencies (several thousand
per second) when its motors are running, it is necessary to use the AVR’s pin change interrupts or
external interrupts to read the encoders. To reduce the required number of interrupt pins, the Romi
32U4 Control Board XORs together both channels of each encoder and connects the resulting signal
to an interrupt pin, while channel B of each encoder is connected to a non-interrupt pin:
•Digital pin 7, or PE6, reads the right encoder XORed signal using external interrupt INT6.
•Digital pin 8, or PB4, reads the left encoder XORed signal using pin change interrupt
PCINT4.
•Digital pin 23 (analog pin 5), or P 0, reads the right encoder channel B.
• Pin PE2 reads the left encoder channel B.
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 10 of 55

The XORed signal and the channel B signal can be used to reconstruct the channel A signal by simply
XORing them again: (A XOR B) XOR B = A. or both encoders, channel B leads channel A when the
motor is rotating in the forward direction; that is, B rises before A rises and B falls before A falls. (The
waveforms in the diagram above would be produced by forward rotation.) Note that this description
designates the A and B signals as labeled on the control board itself, which puts A in front on both
sides.
The Romi32U4 library provides appropriate interrupt service routines and functions for reading the
encoders and keeping track of their counts (see Section 6).
3.4. Inertial sensors
The Romi 32U4 Control Board includes on-board inertial sensors connected to the ATmega32U4’s I²C
interface that can be used in advanced applications, such as helping detect collisions and determining
the robot’s orientation. These sensors are part of the ST LSM6DS33 [https://www.pololu.com/product/
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 11 of 55

2736], which combines a 3-axis accelerometer and 3-axis gyro into a single package.
The inertial sensors are connected to the board’s I²C bus by default, but they can be disconnected by
cutting the surface-mount jumpers labeled “IMU SDA Jmp” and “IMU SCL Jmp”. Level shifters built into
the control board allow the ATmega32U4, operating at 5 V, to communicate with the 3.3 V sensors. If
a Raspberry Pi is plugged into the control board, its I²C pins are connected to the 3.3 V side of the bus
as well. (See Section 3.7 for more information about the Raspberry Pi interface.)
We recommend carefully reading the LSM6DS33 datasheet [https://www.pololu.com/file/0 1087/
LSM6DS33.pdf] (1MB pdf) to understand how these sensors work and how to use them.
Using the sensors
The Romi32U4 library (see Section 6) includes example programs that demonstrate how to use the
sensors.
3.5. Power
The Romi 32U4 Control Board includes battery terminal connections that provide access to power
from the Romi chassis’s six-AA battery compartment. We recommend using rechargeable AA NiMH
cells, which results in a nominal voltage of 7.2 V (1.2 V per cell). You can also use alkaline cells, which
would nominally give you 9 V.
The negative battery voltage is connected to GND. The positive battery voltage is designated VBAT.
VBAT feeds into a reverse protection circuit and then a power switching circuit controlled by the on-
board pushbutton or slide switch. The output of the power switching circuit is designated VSW.
VSW provides power to the motors through the on-board DRV8838 motor drivers, so the motors can
only operate if the batteries are installed and the power switch circuit is on.
The reverse protected and switched battery voltage on VSW can be monitored through a voltage
divider that is connected to analog pin 1 (P 6) by default. The divider outputs a voltage that is equal
to one third of the battery voltage, which will be safely below the ATmega32U4’s maximum analog
input voltage of 5 V as long as the battery voltage is less than 15 V (though the maximum voltage
for the board is still limited to 10.8 V by the DRV8838 motor driver). The readBatteryMillivolts()
function in the Romi32U4 library can be used to determine the battery voltage from this reading. The
surface-mount jumper labeled “A1 = BATLEV” can be cut to disconnect the voltage divider and free
the pin for other uses.
Power switch circuit
The Romi 32U4 Control Board uses the patented latching circuit from the Pololu pushbutton power
switch [https://www.pololu.com/product/2808], which provides a solid-state power switch for your robot
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 12 of 55

controlled with the on-board pushbutton. By default, this pushbutton can be used to toggle power: one
push turns on power and another turns it off. Alternatively, a separate pushbutton can be connected
to the PWRA and PWRB pins and used instead. Multiple pushbuttons can be wired in parallel for
multiple control points, and each of the parallel pushbuttons, including the one on the board itself, will
be able to turn the switch on or off. The latching circuit performs some button debouncing, but
pushbuttons with excessive bouncing (several ms) might not function well with it.
or proper pushbutton operation, the board’s slide switch should be left in its Off
position. (Sliding the switch to the On position will cause the board power to latch on,
and the switch must be returned to the Off position before the board can be turned off
with the pushbutton.)
Alternatively, to disable the pushbutton, you can cut the button jumper labeled Btn mp; this transfers
control of the board’s power to the on-board slide switch instead. A separate slide or toggle switch can
be connected to the GATE pin and used instead.
The power switch circuit also offers several alternate pushbutton connection options that result in
push-on-only or push-off-only operation, and additional inputs enable further power control options like
allowing your robot to turn off its own power. These advanced control options are available through the
button connection pins and four control inputs:
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 13 of 55

PIN Description
PWRA Connect through momentary switch to pin “PWRB” for standard push-on/push-off
operation. Connect through momentary switch to ground for on-only operation.
PWRB Connect through momentary switch to pin “PWRA” for standard push-on/push-off
operation.
ON A high pulse (> 1 V) on this pin turns on the switch circuit. This pin only functions when
pushbutton operation is enabled (i.e. the button jumper has not been cut).
O
A high pulse (> 1 V) on this pin turns off the switch circuit (e.g. allowing a powered
device to shut off its own power). This pin only functions when pushbutton operation
is enabled.
CTRL
With pushbutton operation enabled, this pin directly determines the state of the switch
circuit. A high pulse (> 1 V) on this pin turns on the switch; a low pulse (e.g. driving
the pin low with a microcontroller output line or pushing a button connected from this
pin to ground) turns the switch off. Leave this pin disconnected or floating when not
trying to set the switch state. Note that this pin should not be driven high at the same
time the “O ” pin is driven high.
GATE
With pushbutton operation disabled (button jumper cut), this pin controls the state of
the switch circuit: driving it low turns the switch on, while letting it float turns the switch
off. Connect through slide or toggle switch to ground for on/off operation. Leave this
pin disconnected or floating for proper pushbutton operation. We recommend only
ever driving this pin low or leaving it floating; this pin should never be driven high while
the slide switch is in the “On” position.
5 V and 3.3 V regulators
VSW supplies power to a 5 V regulator, whose output is designated VREG. The battery voltage is
regulated to 5 V by an MP4423H switching buck converter; although the regulator itself works with
input voltages up to 36 V, the motor drivers limit the control board’s maximum input voltage to 10.8 V.
When available, VREG is generally used to supply logic power for the ATmega32U4, motor drivers,
and encoders. The rest of the regulator’s achievable output current, which depends on input voltage
and ambient conditions, can be used to power other devices; this can include an attached Raspberry
Pi (which typically draws a few hundred milliamps). Under typical conditions, up to 2 A of current is
available from the VREG output. (We also make a standalone regulator [https://www.pololu.com/product/
2858] based on this integrated circuit.)
The MP4423H regulator features an open-drain power good output, PG, which requires an external
pull-up. PG drives low when the 5 V regulator’s output voltage falls below around 85% of the nominal
voltage and becomes high-impedance when the output voltage rises above around 90%. The regulator
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 14 of 55

circuit on the Romi 32U4 Control Board can be disabled by driving the regulator shutdown pin,
REGSHDN, high; this will cause 5 V logic power for the control board to be sourced from USB instead
if it is available.
The Romi 32U4 Control Board also contains a 3.3 V LDO that draws its power from the output of the
logic power selection circuit described below. The output of the 3.3 V regulator is designated 3V3 and
is used to supply the on-board inertial sensors and level shifters.
Logic power selection
The Romi 32U4 Control Board’s power selection circuit uses the TPS2113A power multiplexer
[https://www.pololu.com/product/2596] from Texas Instruments to choose whether its 5 V supply
(designated 5V) is sourced from USB or the batteries via the 5 V regulator, enabling the control board
to safely and seamlessly transition between them. The TPS2113A is configured to select regulated
battery power (VREG) unless the regulator output falls below about 4.5 V. If this happens, it will select
the higher of the two sources, which will typically be the USB 5 V bus voltage if the control board is
connected to USB.
Consequently, when the Romi 32U4 Control Board is connected to a computer via USB, it will receive
5 V logic power even when the power switch is off. This can be useful if you want to upload or test a
program without drawing power from the batteries and without operating the motors. It is safe to have
USB connected and battery power switched on at the same time.
The currently selected source is indicated by the STAT pin; this pin is an open-drain output that is
low if the external power source is selected and high-impedance if the USB supply is selected. The
current limit of the TPS2113A is set to about 1.9 A nominally. or more information about the power
multiplexer, see the TPS2113A datasheet [https://www.pololu.com/file/0 771/tps2113a.pdf] (1MB pdf).
The 5 V output of the selection circuit is used to supply the control board’s ATmega32U4
microcontroller, logic power for the DRV8838 motor drivers, and the encoders; it also optionally powers
an attached Raspberry Pi.
Raspberry Pi power
By default, the control board will provide power from its 5V line to an attached Raspberry Pi. In this
situation, we recommend switching on the power circuit so that the Raspberry Pi receives power
from the batteries through the control board’s on-board switching regulator. Alternatively, you can use
aUSB wall power adapter [https://www.pololu.com/product/1459] to supply power through the control
board’s USB connector, although we have sometimes observed AVR brown-out resets occurring when
a board powers the Raspberry Pi this way. A typical computer USB port might not be able to supply
enough current to properly power the Romi 23U4 Control Board and an attached Raspberry Pi.
Power provided to the Raspberry Pi can be switched off by driving the Raspberry Pi shutdown pin,
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 15 of 55

RPISHDN, to 5 V.
An ideal diode circuit on the control board makes it safe to have a different power supply connected to
the Raspberry Pi (for example, through the Raspberry Pi’s USB Micro-B receptacle) while the control
board is connected and powered. (In other words, it is safe to have any combination of control board
USB power, battery power, and Raspberry Pi USB power connected to the system.) The RPI5V pin
provides direct access to the Raspberry Pi’s 5 V line, which will typically come from the higher of the
two power sources. The 3.3 V output of the Raspberry Pi is also made available on the RPI3V3 pin.
Note that the diode circuit prevents power from being shared in the reverse direction: the Raspberry
Pi cannot supply 5 V logic power to the control board through the 40-pin connector.
Power distribution
•VBAT is connected to the battery contact labeled BAT1+ and provides a direct connection to
the battery supply.
•VRP provides access to the battery voltage after reverse-voltage protection.
•VSW is the battery voltage after reverse protection and the power switch circuit.
•VREG is the output of the on-board 5 V regulator.
•5V is the output of the TPS2113A power multiplexer circuit which is connected to VREG by
default, but switches to 5 V USB power if VREG is too low.
•3V3 is the output of the 3.3 V LDO regulator.
See Section 3.6 for a diagram of the board’s power distribution buses and access points.
3.6. Expansion areas
The Romi 32U4 Control Board has several expansion areas (primarily in three groups near the front
left and middle and back right edges) that break out all of the general-purpose I/O lines from the
ATmega32U4 microcontroller and the Raspberry Pi. The board also provides access to various power
inputs, outputs, and control pins, and it makes a few stand-alone buses available to help you make
connections. The following diagrams identify the locations of these pins and the hardware associated
with them; they are also available as a printable PDF [https://www.pololu.com/file/0 1261/romi-32u4-control-
board-pinout-power.pdf] (1MB pdf). or more information about the ATmega32U4 microcontroller and its
peripherals, see Atmel’s ATmega32U4 documentation.
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 16 of 55

Pinout diagram of the Romi 32U4 Control Board (ATmega32U4 pinout, peripherals, and board
power control).
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 17 of 55

Pinout diagram of the Romi 32U4 Control Board (Raspberry Pi pinout, peripherals, and level
shifters).
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 18 of 55

Power distribution diagram of the Romi 32U4 Control Board.
3.7. Raspberry Pi interface and level shifters
The Romi 32U4 Control Board was designed to be easy to interface with a Raspberry Pi single-
board computer to expand the Romi’s processing power. It has a connector and mounting holes
matching the Raspberry Pi HAT (Hardware Attached on Top) specification and is designed to connect
to the Model B+ and newer versions of the Raspberry Pi with 40-pin GPIO headers (including
the Raspberry Pi 3 Model B [https://www.pololu.com/product/2759] and Model A+ [https://www.pololu.com/
product/2760]). A 2×20-pin 0.1″ female header is soldered to the control board, and it ships with a set of
four standoffs [https://www.pololu.com/product/1952],screws [https://www.pololu.com/product/1968], and nuts
[https://www.pololu.com/product/1967].
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 19 of 55

I²C communication
When used with a Raspberry Pi, the control board is designed to serve as an auxiliary controller,
communicating with the Raspberry Pi using an I²C interface (also known as 2-wire Serial Interface,
or TWI). As such, the ATmega32U4 microcontroller’s I²C data and clock lines (SDA and SCL) are
connected to the corresponding lines on the Raspberry Pi’s I²C bus 1 through on-board level-shifting
circuits. These bidirectional level shifters convert between the AVR’s 5 V logic level and the Raspberry
Pi’s 3.3 V logic level.
We have written an Arduino library [https://github.com/pololu/pololu-rpi-slave-arduino-library] for our our
32U4 family of boards that lets them act as an I²C slave and provides a framework for communication
between the ATmega32U4 and a Raspberry Pi master.
Atutorial [https://www.pololu.com/blog/577] on the Pololu blog demonstrates this library and its included
example code, using them to make a robot that can be remotely controlled and monitored through
a web server running on the Raspberry Pi. This tutorial uses our A-Star 32U4 Robot Controller
SV [https://www.pololu.com/product/3119] and a laser cut chassis, but the instructions for setting up your
Raspberry Pi and Raspberry Pi slave library for Arduino still apply for the Romi 32U4 Control Board,
and we will be releasing an updated tutorial with steps specific to the Romi soon.
Pololu Romi 32U4 Control Board User’s Guide © 2001–2019 Pololu Corporation
3. Romi 32U4 Control Board Page 20 of 55
Other manuals for Romi 32U4
1
Table of contents
Other Pololu Controllers manuals

Pololu
Pololu Mini Maestro Series User manual

Pololu
Pololu Orangutan SVP-324 User manual

Pololu
Pololu DMC01 User manual

Pololu
Pololu DRV8825 User manual

Pololu
Pololu Jrk G2 21v3 User manual

Pololu
Pololu A-Star 32U4 Series User manual

Pololu
Pololu Qik 2s12v10 User manual

Pololu
Pololu G2 User manual

Pololu
Pololu Orangutan X2 User manual