Thumbnail

Wheel Encoder Counter

Compatible with firmware that counts wheel rotation for left and right wheels with wheel encoder.

+ How To Add This Control To Your Project (Click to Expand)
  1. Make sure you have the latest version of ARC installed.
  2. Select the Get button in this page to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to ARC.
  5. Load ARC and press the Project -> Add Control button from the menu.
  6. Choose the Navigation category tab.
  7. Press the Wheel Encoder Counter icon to add the control to your project.

Manual

This skill is compatible with Arduino UNO firmware that counts wheel rotation for left and right wheels.

Main Window


User-inserted image


1. Get Wheel Values Button
Acquires the encoder values for each wheel.

2. Reset Values Button
Resets the encoder values back to zero.

3. Get Wheel Values & Reset Button
Resets the encoder values back to zero then starts acquiring the encoder values again. 

4. Update every 1000mS Checkbox
When checked this option will automatically update the encoder values once a second.

5. Debug Checkbox
When checked this option will show the encoder values to the Status Display.

6. Status Display
When the debug checkbox is checked this will display a text readout of the encoder values.

How to Use Wheel Encoder Counter


1) Download the Arduino firmware onto an UNO.

2) Connect your wheel encoders to port D2 (left wheel) and D3 (right wheel) on the UNO.

3) Add the Wheel Encoder Counter Skill (Project -> Add Skill -> Navigation -> Wheel Encoder Counter). There will now be 2 script variables created that hold the wheel encoder values for each wheel, respectively ($LeftWheelCount & $RightWheelCount).

4) Connect the UNO to ARC.

5) Start spinning your wheels (with encoders). Then press the "Get Wheel Values" button to get the $LeftWheelCount & $RightWheelCount values. 

6) If you would like the values to be automatically updated and shown on the status display check the "Update every 1000mS" and "Debug" checkboxes.

Video




Resources


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

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

You can see how this skill was created by watching the live hack event here: synthiam.com/HackEvent/Dj-s-5th-Live-Hack-Session-17578

#2   — Edited
It was a post several years back about motors and wheel encoders.
I believe ToyMaker and Dave were discussing it.
Toymaker had motors with 64000 clicks for just one wheel revolution.

How many clicks per/revolution do you think a Arduino can handle?
If this makes any sense.
PRO MEMBER
Synthiam
#3   — Edited
That seems quite high - of 64,000 ticks per rotation. The firmware associated with this plugin counts with an unsigned 16bit integer, so the maximum count is 65535 per wheel. It would be easy to change to 32bit unsigned integer, which the maximum count would be 4,294,967,295 ticks

To see how i made the firmware and plugin, watch this live hack event here: https://synthiam.com/HackEvent/Dj-s-5th-Live-Hack-Session-17578
#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?
PRO MEMBER
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?
PRO MEMBER
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.
PRO MEMBER
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