Online course · Engineering
Sensors, Motors and Motor Control: PWM, Encoders, PID and IMU Fusion
Read sensors, drive motors safely and tune a real PID speed loop on a Pico 2
Created by TrainSkool Trainer
- Engineering
- Intermediate
- English
- 27 lessons
- 24h 5m
- 8 assessments
- Certificate
Coming soon Launch price ₹1,999
This course is not open for enrolment yet.
About this course
For engineering and diploma students, makers and junior firmware engineers who can blink an LED and read a serial monitor, and now want to measure the real world and move things in it reliably. Running example: Kaveri Embedded Labs, a fictional Coimbatore firm building a conveyor speed controller for a coir mill and a pump controller for a banana farm. On a Raspberry Pi Pico 2 (with ESP32-C3 alternatives) you will read and calibrate analog, I2C and timing sensors, filter noise (moving average, fixed-point IIR, median, 1-D Kalman), drive DC motors through an H-bridge with safe power, run servos and steppers with acceleration profiles, decode encoders and measure speed, tune and harden a PID speed loop, and fuse IMU data with a complementary filter. Every lesson has a lab on a real board with a wiring table, expected serial output and a PASS line. Prerequisite: our Pico 2 or Embedded C course, or equivalent C and GPIO experience. Included: 27 text lessons with slides and quick checks, 27 auto-checked C exercises, seven chapter projects, chapter quizzes, a capstone with a 100-point rubric, a graded final exam and a certificate of completion. Lessons are text and slides; trainer videos are coming later. No job or placement guarantees. Not affiliated with or endorsed by Raspberry Pi Ltd, Espressif, STMicroelectronics or Arm. What you will be able to do: - You will be able to convert ADC counts to calibrated engineering units and state the error budget - You will be able to filter noisy sensor data with moving-average, fixed-point IIR, median and 1-D Kalman filters - You will be able to set PWM frequency and duty on the RP2350 and drive a DC motor through an H-bridge safely - You will be able to position a servo and run a stepper with a trapezoidal acceleration profile - You will be able to decode a quadrature encoder and measure speed by window and by period - You will be able to implement, tune and harden a discrete PID speed loop with anti-windup and feedforward - You will be able to read and calibrate a 6-axis IMU and estimate tilt with a complementary filter - You will be able to integrate it all into a tested conveyor and pump controller with a safe state machine
What you'll learn
- Convert ADC counts to calibrated engineering units and state the error budget
- Filter noisy sensor data with moving-average, fixed-point IIR, median and 1-D Kalman filters
- Set PWM frequency and duty on the RP2350 and drive a DC motor through an H-bridge safely
- Position a servo and run a stepper with a trapezoidal acceleration profile
- Decode a quadrature encoder and measure speed by window and by period
- Implement, tune and harden a discrete PID speed loop with anti-windup and feedforward
- Read and calibrate a 6-axis IMU and estimate tilt with a complementary filter
- Integrate it all into a tested conveyor and pump controller with a safe state machine
Course content
Chapter 1 · Module 1: Sensor Fundamentals - Signals, ADCs, Accuracy and Calibration
- Code lab: The Sensor-to-Motor Bench: Pico 2, Power and SafetyA bug on a laptop prints a wrong number. A bug on a motor controller drives a conveyor into a jam, runs a pump dry or burns a driver chip.20 topics · 75 min
- Code lab: ADC Fundamentals: Resolution, Reference and SamplingMost physical quantities arrive as a voltage: a thermistor divider, a potentiometer knob, a soil probe, a current sensor's output.22 topics · 80 min
- Code lab: Accuracy, Precision, Noise and CalibrationA sensor reading is a claim about the world, and every claim has an error bar.19 topics · 80 min
- Code lab: Digital Sensors: I2C Registers and Timing-Based SensorsMany sensors hand you numbers over a bus such as I2C, or encode the measurement in time, like an ultrasonic echo pulse.26 topics · 85 min
Chapter 2 · Module 2: Filtering Noisy Signals - Averages, IIR, Median and Kalman
- Code lab: Moving Averages and Ring BuffersIn chapter 1 Divya Raman wired the setpoint knob to GP27 on her Pico 2 and printed the raw ADC counts.18 topics · 55 min
- Code lab: The Exponential (IIR) Filter in Fixed PointThe cold room that Kaveri Embedded Labs monitors in Coimbatore stores banana and vegetable crates at about 13 degrees C.18 topics · 55 min
- Code lab: Median Filters, Debouncing and Outlier RejectionAt Pollachi Coir Works the bale conveyor ends at a stacking bay.18 topics · 60 min
- Code lab: A First Kalman Filter (1-D)The Theni banana farm cooperative wants its drip-irrigation pump to switch on when the soil dries out and off when it is wet enough.26 topics · 60 min
Chapter 3 · Module 3: PWM and DC Motors - Drivers, H-Bridges and Safe Power
- Code lab: PWM on the RP2350: Frequency, Wrap and Duty3 V) or fully off (0 V). The Pollachi Coir Works conveyor must run at 40 percent while bales are loaded, and the Theni drip pump must deliver a gentle flow at night.19 topics · 55 min
- Code lab: DC Motors, H-Bridges and Flyback ProtectionMany beginners wire their first motor straight to a GPIO pin, or to one transistor with no diode.19 topics · 60 min
- Code lab: Driving a DC Motor Well: Direction, Braking, Ramps and Current Sensing2 made the motor turn; turning is not control. A Pollachi conveyor that steps from stop to 60 percent jerks the belt, throws coir off the bales and draws a surge that can trip the driver.27 topics · 65 min
Chapter 4 · Module 4: Servo and Stepper Motors - Position Without Feedback
- Code lab: Hobby Servos: 50 Hz Pulses and Their LimitsIn Module 3 you made a DC motor spin, but a DC motor on its own has no idea where its shaft is.19 topics · 45 min
- Code lab: Stepper Motors and Step/Dir DriversA servo gives you an angle within half a turn. Many machines need something else: a position anywhere along a long travel, repeatable to a fraction of a millimetre, held firmly when stopped.20 topics · 50 min
- Code lab: Motion Profiles: Trapezoidal Acceleration for Steppers2 the stepper moved at a constant 1600 microsteps per second from the first pulse to the last.23 topics · 50 min
Chapter 5 · Module 5: Encoders and Speed Measurement
- Code lab: Quadrature Encoders and x4 DecodingIn Module 3 you drove the conveyor gearmotor at a fixed duty and watched the belt move.16 topics · 45 min
- Code lab: Measuring Speed: Counts per Window vs Pulse PeriodA count tells you where the belt is. The PID loop in Module 6 needs to know how fast it is moving, every millisecond, with as little noise and delay as possible.17 topics · 45 min
- Code lab: Counting Reliably: Interrupt Load, PIO and Overflow1 is correct, but it has a cost.21 topics · 50 min
Chapter 6 · Module 6: PID Control - From Proportional to a Tuned Speed Loop
- Code lab: Feedback and Proportional ControlPollachi Coir Works runs a bale conveyor that carries pressed coir-fibre bales from the press to the loading bay.15 topics · 35 min
- Code lab: Integral and Derivative in a Discrete Loop1 the conveyor model settled at 120 RPM when asked for 200, and no proportional gain fixes that.14 topics · 35 min
- Code lab: Tuning PID on a Real Motor2 ended with three gain sets: one slow, one overshooting, one clean. Where did the good numbers come from?14 topics · 40 min
- Code lab: Production PID: Anti-Windup, Limits, Feedforward and Setpoint RampsA tuned PI loop passes its step test on a clear belt. Then at Pollachi a bale stalls the belt for a second, an operator presses stop and restarts, the supervisor jumps the speed from 150 to 250 RPM.21 topics · 40 min
Chapter 7 · Module 7: IMUs and Sensor Fusion - Tilt, Vibration and the Complementary Filter
- Code lab: Reading a 6-Axis IMU over I2CThe KEL-CV1 conveyor at Pollachi Coir Works runs for ten hours a day, carrying compressed coir bales from the press to the loading bay.20 topics · 40 min
- Code lab: IMU Calibration: Gyro Bias and Tilt from GravityRaw IMU numbers are close to right, and close is not good enough. 32 deg/s on X.19 topics · 40 min
- Code lab: The Complementary Filter2 left Divya with two tilt estimates and a problem with each. The accelerometer gives an absolute angle that never drifts, but it jumps around whenever the conveyor shakes or the belt starts.25 topics · 40 min
Chapter 8 · Module 8: Capstone - KEL-CV1 Conveyor and Pump Speed Controller
- Code lab: Capstone Brief and System ArchitectureEvery chapter so far has given you one part of a motor controller: a clean sensor reading, a filter, a PWM output, an H-bridge, an encoder count, a PID loop and an IMU angle.17 topics · 45 min
- Code lab: Build Guide: Integrating Loop, Safety and LoggingWith the bench proven, Divya must make the pieces from chapters 1 to 7 run together.20 topics · 55 min
- Code lab: Test Plan, Deliverables and RubricA controller is finished when someone other than its author can prove it meets the brief.21 topics · 60 min
Assessments and certificate
- Module 1 quiz: Sensor Fundamentals - Signals, ADCs, Accuracy and Calibration8 questions · 15 min · pass mark 70%
- Module 2 quiz: Filtering Noisy Signals - Averages, IIR, Median and Kalman8 questions · 15 min · pass mark 70%
- Module 3 quiz: PWM and DC Motors - Drivers, H-Bridges and Safe Power8 questions · 15 min · pass mark 70%
- Module 4 quiz: Servo and Stepper Motors - Position Without Feedback8 questions · 15 min · pass mark 70%
- Module 5 quiz: Encoders and Speed Measurement7 questions · 15 min · pass mark 70%
- Module 6 quiz: PID Control - From Proportional to a Tuned Speed Loop8 questions · 15 min · pass mark 70%
- Module 7 quiz: IMUs and Sensor Fusion - Tilt, Vibration and the Complementary Filter8 questions · 15 min · pass mark 70%
- Sensors, Motors and Motor Control: PWM, Encoders, PID and IMU Fusion — final assessment20 questions · 40 min · pass mark 70%