Behavior Control
Created
Updated
Index

Wheel Encoder Counter

Control Thumbnail

How To Download and Use This Control

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

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.

#4   — Edited
Unable to find the answer to this, so here it is to you guys.
I have no experience encoders.

Motor add:
This gear motor is a powerful 12V brushed DC motor with a 131.25:1 metal gearbox and an integrated quadrature encoder that provides a resolution of 64 counts per revolution of the motor shaft, which corresponds to 8400 counts per revolution of the gearbox’s output shaft.

Since the encoder is on the back of the motor shaft does it only read the 64 counts per revolution?
How can you tell, with accuracy what the counts per revolution is at the gearbox's output shaft?

Hope this is clear?
Synthiam
#5  
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.
#6  
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?
Synthiam
#7  
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.
#8   — Edited
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.
Synthiam
#9   — Edited
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