ME 405 Term Project
Loading...
Searching...
No Matches
Hardware & Electrical Design

System Overview

The Romi robot is built on a Pololu Romi chassis and controlled using an ST Nucleo development board running MicroPython. The hardware and electrical design emphasizes predictable startup behavior, clean signal routing, and modular interfaces that support incremental development, debugging, and future extension.

Major subsystems integrated into the robot include:

  • Dual DC motors with quadrature encoders
  • Reflectance-based line sensor array
  • Inertial Measurement Unit (IMU)
  • Bluetooth communication module
  • Battery-powered system with onboard voltage monitoring

Microcontroller and Power System

The system is powered by six AA batteries, routed through a power distribution board (PDB). Battery voltage is supplied to the Nucleo board via the VIN pin. A resistive voltage divider feeds an ADC input, allowing real-time measurement of battery voltage during operation.

This measurement is used to compensate for battery voltage droop in the motor control pipeline, improving repeatability over the duration of a run.

Startup behavior was treated as a primary design constraint. Motor driver enable (nSLP) pins are explicitly controlled in software, and pin selections were chosen to prevent unintended motor motion during power-up or reset. Pull-down configurations and initialization order were carefully managed to ensure safe and predictable behavior.


Motor Driver Interfaces

Each motor is driven using three signals:

  • PWM signal for effort command
  • Direction signal
  • Sleep/enable (nSLP) signal

Hardware timers were selected to generate PWM outputs independently for each motor without conflicting with encoder timers or communication peripherals. Motor enable pins are controlled as standard digital outputs to enforce explicit enable/disable behavior in firmware.

This structure ensures motors remain disabled until the system has fully initialized and the scheduler has started.


Quadrature Encoder Interfaces

Wheel encoders are interfaced using hardware timer encoder modes. This approach offloads quadrature decoding to dedicated timer hardware, providing robust position and velocity measurements with minimal CPU overhead.

Separate timers are used for the left and right encoders to allow fully independent velocity estimation and closed-loop control. Encoder wiring and pin selection were chosen to avoid overlap with PWM, ADC, and communication peripherals.


Line Sensor Array

Line detection is performed using a multi-channel reflectance sensor array mounted at the front of the chassis. Individual sensors are read using ADC inputs distributed across multiple GPIO ports to balance pin availability and minimize conflicts with timers and communication interfaces.

Although only a subset of sensors is used for control during line following, all channels are wired and supported in firmware. This provided flexibility during development and allowed sensor selection and weighting strategies to evolve without hardware changes.


IMU Interface

An IMU is connected via the I2C2 peripheral. Dedicated SDA and SCL pins were selected to avoid interference with timers, ADC inputs, and UART communication.

The IMU is supported in firmware and was used extensively during Lab 0x05 for state estimation experiments. Although it was not relied upon for the final line-following implementation, its integration provided valuable insight into system dynamics and informed later design decisions.


Bluetooth Communication Interface

A Bluetooth module provides wireless communication between the Romi and a PC. The module is connected via a UART interface and is used for real-time data streaming, diagnostics, and parameter adjustment during testing.

Streaming is enabled by default on startup and can be toggled through the PC-side interface. This approach reduced onboard memory usage and provided immediate visibility into system behavior during controller tuning and debugging.


Pin Assignment Summary

The following table summarizes the primary electrical connections used in the final system configuration. Wire colors are shown explicitly to aid debugging and reproducibility.

CableContactColorSignal / Module PinNucleo PinPDB PinPortAFFunction
Encoder (Left)1BlueEncoder Ch. ATimer Pin, Ch.1ELA or ERAPA9AF1TIM1_CH2
2YellowEncoder Ch. BTimer Pin, Ch.2ELB or ERBPA8AF2TIM1_CH1
Encoder (Right)1BlueEncoder Ch. ATimer Pin, Ch.1ELA or ERAPC7AF2TIM8_CH2
2YellowEncoder Ch. BTimer Pin, Ch.2ELB or ERBPC6AF2TIM8_CH1
Motor (Left)1YellowMotor EnableDigital OutputnSLPPB4-Enable / Sleep
2BlueMotor DirectionDigital OutputDIRPB3-Direction
3GreenMotor EffortTimer PinPWMPB5AF2TIM3_CH2
Motor (Right)1YellowMotor EnableDigital OutputnSLPPC9-Enable / Sleep
2BlueMotor DirectionDigital OutputDIRPB9-Direction
3GreenMotor EffortTimer PinPWMPB8AF2TIM4_CH3
IMU-RedIMU VIN-5V (CN7)--Power
-IMU 3vo-Optional*--Regulated Output
-BlackIMU GND-GND (CN7)--Ground
-BurgundyIMU SDA--PB14AF4I2C2_SDA
-GrayIMU SCL--PB13AF4I2C2_SCL
-WhiteIMU RST----Reset
Bluetooth Module1WhiteModule RXRomi TX-PB6AF7UART1_TX
2OrangeModule TXRomi RX-PB7AF7UART1_RX
3BlackModule GNDRomi GND-GND (CN7)-Ground
4RedModule VCCRomi 5V-E5V (CN7)-Power
Battery / Power1BlackDivider GroundGND-GND (CN7)-Ground
2BlueDivider NodeADC Input-PC2-Battery Sense
3RedPower to NucleoVIN-VIN (CN6)-Board Power
4BlackPDB Ground-GND--Ground
5RedPDB Battery Power-VSW--Battery
Line Sensors-RedPower3.3V-3.3V (CN7)-Power
-BlackGroundGND-GND (CN7)-Ground
-BurgundySensor 1ADC-PC4-ADC
-BurgundySensor 3ADC-PA1-ADC
-OrangeSensor 5ADC-PA4-ADC
-GreenSensor 7ADC-PB0-ADC
-BlueSensor 9ADC-PC1-ADC
-YellowSensor 11ADC-PC0-ADC
-OrangeSensor 2ADC-PA6-ADC
-GreenSensor 4ADC-PA7-ADC
-GraySensor 6ADC-PA0-ADC
-WhiteSensor 8ADC-PB1-ADC
-BrownSensor 10ADC-PC3-ADC
Bump Sensors-BlackGroundGND-GND-Ground
-RedBMP0Digital Input-PH0-Input
-GreenBMP1Digital Input-PH1-Input
-OrangeBMP2Digital Input-PC10-Input
-BurgundyBMP3Digital Input-PC11-Input
-GrayBMP4Digital Input-PC12-Input
-BrownBMP5Digital Input-PD2-Input
-WhiteGroundGND-GND-Ground

Pinout Reference and Wiring Diagram

The diagram below summarizes the final pin assignments used on the Nucleo board. This diagram was used throughout development to track peripheral usage and avoid conflicts between timers, ADC inputs, and communication interfaces.

Pin assignment diagram showing connections between the Nucleo board, motors, encoders, sensors, and peripherals.

Discussion

The hardware and electrical design evolved alongside the firmware throughout the quarter. Careful pin selection, explicit motor enable control, and deliberate startup behavior were critical to achieving reliable and repeatable operation.

By prioritizing modularity and clarity in both wiring and software interfaces, the system remained flexible enough to support experimentation while maintaining a stable configuration for final demonstrations.