The problem
Electric motors deliver torque instantly, so an EV can spin its drive wheel on wet roads or loose surfaces, losing traction and stability. Traction control must estimate slip and reduce torque quickly without killing acceleration.
Objectives
- Measure wheel speed from an encoder motor and emulate vehicle speed with a tyre-road model
- Compute slip ratio and detect wheel spin
- Implement and compare rule-based, PI and sliding-mode slip controllers
- Quantify acceleration delivered and slip error across surfaces
What you need
From the EV Embedded Development Kit
- STM32F103C8T6 microcontroller unit (Arm Cortex-M3)
- Motor driver for PWM motor-control experiments
- 3-axis accelerometer and gyroscope (MPU6050, I2C)
- Analog potentiometer input
- 4×3 matrix keypad
- Serial UART interface
- 16×2 LCD
- RGB LEDs and a buzzer
Software
- STM32CubeIDE with HAL TIM (PWM, encoder), I2C and UART
- Embedded C
- Python with NumPy, SciPy, pandas and matplotlib
- MATLAB/Simulink (optional) for controller design
Extra parts
- A small brushed DC motor with a quadrature encoder, within the motor driver's rating, with a small flywheel disc — The kit has no motor or speed sensor; the encoder motor with added inertia acts as the driven wheel.
Key concepts
- Slip ratio
- Slip is (wheel speed times radius minus vehicle speed) divided by the larger of the two; traction peaks at a small positive slip, often around 0.1–0.2 depending on surface.
- Tyre friction curve
- A simplified curve such as the Burckhardt model gives friction coefficient as a function of slip for dry, wet and icy surfaces.
- Wheel-in-the-loop emulation
- The real motor gives wheel speed; the firmware model computes the road reaction force and vehicle speed, and the controller sees a mix of real and emulated signals.
- Sliding-mode control
- A robust controller that drives slip error to a sliding surface and holds it there despite model error, at the cost of possible chattering.
Step-by-step guide
- 1
Research questions and model
Write the research questions: how quickly each controller limits slip, how much acceleration it keeps, and how robust it is to a sudden surface change. Build a quarter-vehicle model in Python or Simulink with wheel inertia, a tyre friction curve for dry, wet and icy surfaces, and vehicle mass. Design and tune the three controllers in simulation first, and save the simulated responses for comparison with the hardware later.
Checkpoint: Simulated slip and acceleration responses for each controller on three surfaces.
- 2
Board setup
Use the DIP switches to enable the motor driver, MPU6050, potentiometer, keypad and LCD. In CubeMX configure the 72 MHz clock, a 20 kHz PWM channel and direction pins, a timer in encoder mode for the motor encoder, I2C for the MPU6050, a UART for logging and a timer for a 500 Hz control loop. Fit the flywheel disc to the motor shaft securely and check the encoder speed reading at a fixed duty.
Checkpoint: Encoder speed and PWM work at the control rate.
- 3
Wheel speed and model coupling
Measure wheel speed every 2 ms from the encoder. In the control loop compute slip from the measured wheel speed and the emulated vehicle speed, look up the friction coefficient from the active surface curve, and compute the road force that accelerates the emulated vehicle. Feed the road-load torque back onto the real wheel by reducing the motor command by that torque, so the spinning flywheel feels the road. Check that on the dry surface with gentle throttle the slip stays small.
Checkpoint: On the dry surface with gentle throttle, slip stays small and vehicle speed tracks wheel speed.
- 4
Surface selection
Assign keypad keys to the dry, wet and icy friction curves, and another key to schedule a step from dry to icy part-way through a run, which tests how the controller copes with a sudden surface change. Show the active surface and the present slip on the LCD. Check that full throttle on the icy surface without traction control makes the emulated wheel spin up quickly, as it would on a real low-friction road.
Checkpoint: Full throttle on icy surface makes the wheel spin up quickly in the emulation.
- 5
Use of the IMU
On a real vehicle, vehicle speed is not measured directly and must be estimated, often with help from an IMU. In a push test, put the kit on a trolley, push it a measured distance and use the MPU6050's forward acceleration in a simple speed observer; compare the estimated distance with the measured one. On the bench the emulated vehicle acceleration is used instead, and the report should say which signals are real and which are emulated.
Checkpoint: The observer's speed estimate from IMU acceleration in the push test is plotted against a timed distance.
- 6
Rule-based baseline
Implement the simplest traction control as the baseline: when slip exceeds a threshold, cut the torque command by a fixed fraction, and when slip falls below a lower threshold, restore torque gradually. Tune the thresholds and restore rate for the dry surface, then run it on all surfaces. Expect visible torque oscillation, and log it, because the oscillation is one of the things the better controllers should reduce.
Checkpoint: Spin is limited on icy surface, with visible torque oscillation.
- 7
PI slip controller
Regulate slip to a target such as 0.12 with a PI controller on the slip error, whose output reduces the rider's torque request. Add anti-windup so the integrator does not grow while torque is already at zero or at the request, and enforce the rule that the controller output never exceeds the rider's request. Tune in simulation, then on hardware, and check that slip settles near the target on all three surfaces without sustained oscillation.
Checkpoint: Slip settles near target on all surfaces without exceeding the rider's request.
- 8
Sliding-mode controller
Design a sliding surface on the slip error and derive a control law that drives the slip onto it and holds it there despite model error. Implement it with a boundary layer around the surface to reduce chattering, and tune the boundary width and gain first in simulation, then on hardware. Check it holds slip near the target on all three surfaces and after a dry-to-icy step, and log any chattering.
Checkpoint: Slip is held near target, including after a dry-to-icy step.
- 9
Comparative experiments
Run full-throttle launches on each surface and with the surface step, with five repeats per case for each of the three controllers. Compute slip RMS error, peak slip, delivered emulated vehicle acceleration, torque oscillation and recovery time after the surface step. Present a comparison table with spread across repeats and overlaid plots, and compare the hardware results with the simulation results for each controller.
Checkpoint: A comparison table with spread across repeats.
- 10
Report
Write up the quarter-vehicle model, the wheel-in-the-loop set-up, the three controllers and the results. Be clear about which signals are measured, wheel speed, and which are emulated, vehicle speed and road force, and discuss what this means for how far the results carry over to a real vehicle. Include plots, the comparison table and a demonstration of a launch on the icy surface with and without traction control.
Checkpoint: Report with plots, tables and a demonstration.
Testing & validation
- Simulation and hardware responses compared for each controller
- Slip RMS error, peak slip and acceleration on each surface
- Recovery after a sudden dry-to-icy surface change
- Controller output never exceeds the rider's torque request
Expected results
A wheel-in-the-loop traction-control testbed with a real spinning wheel and an emulated road, and a quantified comparison of three slip controllers across surfaces and a sudden surface change.
Research angle for your M.Tech thesis
Research questions: which slip controller gives the best trade-off between acceleration and stability on low-friction surfaces, and how robust is each to an unknown surface change and vehicle-speed estimation error? Metrics: slip RMS error, peak slip, delivered acceleration, recovery time, torque oscillation. Baseline: rule-based torque cut. A publishable result would add online friction estimation or a slip observer and show measured gains over the baseline in repeated wheel-in-the-loop trials.
Take it further
- Estimate surface friction online and adapt the slip target
- Add lean-angle awareness for two-wheelers using an attitude estimator
- Combine traction control with regenerative braking slip limits
Viva and review questions
Why not just minimise slip to zero?
Traction force needs some slip; the friction peak is at a small positive slip, so the target is a slip value near that peak.
How is vehicle speed obtained?
On the bench it comes from the vehicle model; on a real vehicle it would be estimated from undriven wheels or an IMU-based observer.
Why might sliding-mode control chatter?
Its switching term changes sign rapidly near the sliding surface; a boundary layer smooths it at a small cost in accuracy.
Why never exceed the rider's request?
Traction control should only reduce torque; adding torque beyond the request would surprise the rider and be unsafe.