Quick Announcements
IEEE Micromouse DeCal
Lab 3: Encoders
Micromouse Hardware Kit
Micromouse Electronics
What electronics do we need to control our robot?
Micromouse Electronics
What electronics do we need to control our robot?
Micromouse PCB Parts
Raspberry Pi Pico (Microcontroller)
Micromouse PCB Parts
Motor Driver
Motor
Motor
Motor Driver
Why do we need a motor driver?
Motor Driver
Why do we need a motor driver?
It’s designed to only do logic with low current signals -- motors require more current than the Pi Pico is able to supply
Motor Driver
Motor Driver
Direction | IN3 | IN4 |
Forward | HIGH | LOW |
Reverse | LOW | HIGH |
Brake | HIGH | HIGH |
Neutral | LOW | LOW |
Sensing
How do we...
Encoders!
1: M1 - Motor +
2: VCC - Encoder +
3: C1 - Encoder A Phase
4: C2 - Encoder B Phase
5: GND - Encoder -
6: M2 - Motor -
Measures rotation and direction
Gear Ratios
Motors are geared down 10:1, so we need 10 rotations of the motor for one rotation of the wheel
Encoders!
Generally – how do we measure position using this thing that spins?
We want to keep track of how many times it has spun and in which direction.
Encoders!
Relevant idea: forget the magnet stuff for a minute.
Imagine this is literally just a metal disc that spins and can be connected to some other circuitry.
How would we keep track of rotations?
Idea: Mechanical Encoder
We might want to keep track of one “spot” on the disc and measure every time it passes by
Physically implement this: add a “bump” on the disc and have it close a switch every rotation!
Idea: Mechanical Encoder
That’s great and all, but our resolution of measurement is low: we have no way of knowing what fraction of the disc we stopped at, all we know is the last complete revolution.
Say we’re just completing our 5th revolution:
5 ticks!
also 5 ticks!
6 ticks!
also 5 ticks!
Idea: Mechanical Encoder
That’s great and all, but our resolution of measurement is low: we have no way of knowing what fraction of the disc we stopped at, all we know is the last complete revolution.
Solution: add more bumps per revolution!
Idea: Mechanical Encoder
Now, every time a bump hits the switch we know it has gone that far around the disc. We can figure out how many bumps there are per revolution in order to track revolutions by counting bumps!
Going back to our encoders:
bumps/rev ⇒ ticks/rev :) ⇒ Pi Pico code
⇒
Instead of requiring physical contact with a switch, our encoders work by sensing the strength of magnetic field (via Hall effect sensors)
*Note: the bar magnet shown would correspond to 1 tick/revolution
*
Going back to our encoders:
The higher-resolution equivalent here is a magnetic disc with many N/S poles per revolution
(the magnetic equivalent of bumps)
Encoders!
Encoders!
B
A
Two Hall effect (magnetic field) sensors mounted 90 degrees apart
Magnet that spins with the wheel
Quadrature Encoding
www.edn.com
A
B
clockwise
counterclockwise
Quadrature Encoder Animation
s
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Quadrature Encoder Animation
B Channel
A Channel
A
B
Today: Encoders
Questions?
Attendance Form →