AlphaBot Controlled Ride with Odometry

| Autor: | Sherina Uwera |
| Betreuer: | Prof. Dr.-Ing. Schneider |
| Sprache: | 🇬🇧 |
Objective
The objective is to make the AlphaBot drive forward in a straight line and stop after a specified distance. The initial target is 30 cm. Wheel encoders provide the measurements for two tasks: estimating how far the robot has traveled and detecting a difference in travel between the left and right wheels.
Introduction
Technical overview
The AlphaBot uses two independently driven wheels. An Arduino Uno R4 WiFi receives encoder pulses from both wheels and sends direction and PWM signals to the motor driver. The Simulink model converts the encoder counts into estimated left and right wheel distances, SL and SR.
Two quantities are derived from the wheel distances:
- Estimated travel of the robot’s center :Savg =(SL+SR)/2
This is the signal intended for the distance cutoff.
- Difference in wheel travel: e = SR-SL
This is the input to the proposed steering controller. When SL exceeds SR, the controller should decrease the left PWM command and increase the right PWM command.
Wheel odometry depends on reliable encoder counts and wheel calibration. Missed pulses, wheel slip, and differences in effective wheel diameter can affect the estimated distance.
Task List
- Make a copy of the Simulink Model
DemoAlphaBotOdometry.slx. - Introduce a stateflow-Block, that has the states
standstill,driveandstop. - During the state
standstilldrive a controlled straight line using the odometry. - Research how to calculate # Calculate
vLandvR. - Discuss the possible ways with Prof. Schneider.
- Calculate
vLandvRfrom the most promissing algorithm.
Component Requirements
| Component | Function |
|---|---|
| AlphaBot chassis with two drive motors and a motor driver | Drives the robot and allows independent control of each wheel |
| Left and right wheel encoders | Provide pulses for estimating individual wheel travel |
| Arduino Uno R4 WiFi | Runs the deployed model, counts encoder pulses, and commands the motor driver |
| AlphaBot battery supply | Powers the robot during floor tests |
| USB data cable | Used for deployment and monitoring during the initial tests |
| MATLAB, Simulink, and Simulink Support Package for Arduino Hardware | Used to configure, deploy, and monitor the model |
| Tape measure and floor markers | Used to measure physical travel and observe sideways deviation |
Measurement Method and Circuit
Each encoder signal connects to an external interrupt input. The motor driver receives four direction signals and one PWM signal per motor channel.
| Specifications | ||||||||||||
|
The distance per pulse was estimated from the measured wheel diameter and the average pulse count per revolution: Distance per Pulse = (Pi *0.064)/20.4 = 0.00986m
For each wheel, the cumulative pulse count is multiplied by the distance per pulse to estimate wheel travel. The first tests were performed with the wheels raised to verify motor direction. A short forward test was then performed on the floor with the same PWM command applied to both motors.
| Parameter | Value Tested |
|---|---|
| Microcontroller | Arduino Uno R4 WiFi |
| Wheel diameter | 64 mm, measured |
| Encoder calibration | Approximately 20.4 counted pulses per wheel revolution |
| Estimated distance per counted pulse | Approximately 9.86 mm |
| Base motor command | PWM value 80 for both motors |
| Motor command duration | 1 s, followed by zero PWM |
| Simulink run duration | 5 s, allowing observation after PWM cutoff |
| Target travel distance | 0.30 m for the planned distance-controlled test |
MATLAB And Simulink

The model was deployed to the Arduino using Monitor & Tune. The motor commands PWML and PWMR and the wheel distances SL and SR can be inspected in Simulation Data Inspector. Comparing the distance traces at PWM cutoff and again after the robot comes to rest will show how much of the wheel-distance difference develops during powered motion and how much develops while coasting.