Electronics > Electronics

Rotary encoder. Digital counter. Hall-effect

(1/2) > >>

mike_522:
Hi everyone! I'm hoping to get an advice/answer to the following questions:
1. I'm doing self-balancing robot and I have to implement optical rotary encoder for each wheel. In order to minimise processing power I'd like to make use of a digital counter. I don't quite understand what sort of data it will provide to my microcontroller. Will it be just a number of pulses and my MCU has to workout speed and distance relative to some time period? What about reset? Can anyone provide a tutorial how to build this kind of circuit?
2. As an alternative to optical encoder, I'm thinking of rotary encoder based on hall-effect. These types of sensors look more aesthetic, however I'm not sure about the cost and the complexity regarding implementing it. Any advice on that?
Thank you!

newInRobotics:
Probably the easiest shaft encoder You can make consists of black and white striped disk and IR emitter-detector pair. It works this way:

* IR emitter shines to striped disk.
* As disk spins IR beam gets reflected of every white area of the disk and gets absorbed by every black area of the disk.
* When IR detector gets hit by reflected ray, it's resistance decreases, when there are no IR rays hitting it - it's resistance increases.
* If You connect resistor to IR detector's input or output pin, You create resistive voltage divider. With every transition from black to white and vice-versa Your voltage divider will output voltage which will transition between voltage near Vcc and voltage near Gnd.
* What You do next it plug voltage divider output to Your microcontroller and set the connected pin to listen for voltage level change interrupt. When interrupt takes place, it should increment counter variable by one.
* Also, you should setup a timer to check counter variable value periodically and reset it to zero.
Using counter  variable value You can determine current velocity of motor shaft. Let's say that You have motor with gearbox that increases RPM three times. You decide to check counter variable every 1s. Also, You know, that Your striped disk consists of 360 stripes. So, You check counter variable value after 1s and find it to be 192 (which means that motor have spun 192), now You multiply it by 3 (gearbox gear ratio) and find out that the wheel connected to gearbox output shaft have spun 192 * 3 = 576 = 1.6 rotations. Lets say that wheel diameter is 5cm, hence it's circumference is PI * 5cm = 15.7cm. Now You know that You wheel has traveled 15.7cm * 1.6 = 25.12cm.

Don't bother Yourself with external counters, Your microcontroller is more than capable to handle 2 level shift interrupts, loads of other sensors and many many calculations per second.



mike_522:
Thank you newInRobotics! The reason why I'm interested in digital counter IC's is that I really need a lot of processing power. I'm planning to stabilize my system using pole placement technique, implement kalman filter and also make it avoid obstacles by employing some clever algorithm. 8bit 16Mhz Atmel chip will be struggling I think (I  only know AVR-C). Does anyone know popular digital counter IC chip? Optical encoder is a bit of a pain to be honest, things look much cooler with hall-effect encoder as you can make use of a tiny bit of the shaft sticking out from the other side of the motor.

Soeren:
Hi,


--- Quote from: mike_522 on November 09, 2012, 11:52:49 AM ---The reason why I'm interested in digital counter IC's is that I really need a lot of processing power.

--- End quote ---
It's very common for newbies to have very little feel for, what can be accomplished in a given time frame (and they rarely calculate it either).

That said, if you really want the counting to take place outside your microcontroller, just implement the counter of your dreams in another microcontroller - then you can make it communicate with the main controller in whatever way you wish.

One possible problem with an external counter (or divider) is, that if you want tight control, you need to read it very frequently anyway, so the time saving may be minimal and your resolution will suffer and could be just as good with a lower resolution encoder.



--- Quote from: mike_522 on November 09, 2012, 11:52:49 AM ---[...] by employing some clever algorithm.

--- End quote ---
How can you determine that you won't have enough time, when you don't know what the program are going to be?



--- Quote from: mike_522 on November 09, 2012, 11:52:49 AM ---Optical encoder is a bit of a pain to be honest,

--- End quote ---
Optical encoders are the staple food in rotary encoding in robots.



--- Quote from: mike_522 on November 09, 2012, 11:52:49 AM --- things look much cooler with hall-effect encoder as you can make use of a tiny bit of the shaft sticking out from the other side of the motor.

--- End quote ---
If you wanna use a linear hall to get sine/cosine output, you will need to handle it through A/D-C inputs and that's very processor intensive compared to simple digital ticks.

A rotary Hall decoder, on the other hand is expensive and needs very accurate positioning.

An optical solution is cheap and easy and if aestethics is your main goal, you're going to have a shell around the entire robot anyway, so nobody will see it.

Soeren:
Hi,


--- Quote from: newInRobotics on November 09, 2012, 09:42:11 AM ---Let's say that You have motor with gearbox that increases RPM three times.

--- End quote ---
All the gearboxes I use decreases the RPM ;)

Navigation

[0] Message Index

[#] Next page

Go to full version