Behavior Control
This control is developed by:
AvatarDJ Sures
Created February 8
Updated February 8
Help Index

Wheel Encoder Counter

How To Download and Use This Control

  1. Make sure you have the latest version of EZ-Builder installed.
  2. Select Download This Control button below to download the file.
  3. Double click the downloaded file to open it.
  4. The installer will automatically add this control to EZ-Builder.
Download This Control

This control is compatible with firmware that counts wheel rotation for left and right wheels. You can see how this plugin was created by watching my live hack event here: https://synthiam.com/HackEvent/Dj-s-5th-Live-Hack-Session-17578

The Wheel Encoder UNO firmware can be found here: https://synthiam.com/Hardware/Hardware/Arduino-Genuino-Uno-17527

Connect your wheel encoders to port D2 (left wheel) and D3 (right wheel) on the UNO. There will be 2 EZ-Script variables created that hold the wheel encoder values for each wheel, respectively ($LeftWheelCount & $RightWheelCount).

There are ControlCommand() to reset the values, or force get the values on demand rather than automatic on a timer.

DJ Sures
Synthiam
February 17
Yah - you answered yourself in the question:). The shaft on the motor spins 131.25 times per 1 revolution of the output wheel shaft. Therefore if it’s 64 counts in a motor shaft revolution, you multiple 64 by 131.25 to get 8400. So if you used this arduino firmware, every 8400 counts is one wheel rotation.
February 17
I understood all that.
BUT (lol)
The encoder reads the main shaft rotation (at rear) not the output shaft rotation.
How does the encoder know where, lets say, count/click 8399 is at?


Does this make sense?
DJ Sures
Synthiam
February 17
The encoder doesn't - you can't easily use an encoder as a servo, if that's what you're asking. If you're attempting to use a wheel encoded motor as a servo, you'd need to first initialize the position and start counting from there.

Are you asking to use a encoded motor as a servo?

Because an encoded motor is designed for odometry.. just like your car. To count the number of wheel rotations so you can increase the confidence of how far your robot has traveled for navigation purposes.
February 17 — Updated February 17
Understood



You said "To count the number of wheel rotations so you can increase the confidence of how far your robot has traveled for navigation purposes."
So as I understand, if it counts the number of clicks, say 32, we know that the motor has turned half way around.

Then why would I care anything about 8400 COUNTS at the OUTPUT shaft?

It seems to me the only important number here is the counts per rotation of the rear shaft.

MMMM I'm starting to even confuse myself here ... lol.
DJ Sures
Synthiam
February 17 — Updated February 17
8400 counts is the wheel turning 1 complete rotation. 4200 counts is the wheel turning half a rotation.

If your wheel radius of your wheel is 10cm, then 8400 counts would be 10 cm of travel.

16800 counts would be 20cm of travel