Hi there.
Im trying to modify gearbox like this one.

Im trying to add encoder, optical or hall sensor, and something to control over it mx1508 + atmega328. To use it as i2c slave, and control rotation and speed. So it will act more live servo.
I know that thay can be purchased with encoder, but they are 10x expensive, not my case, i need realy lot of them.
Also i know that IR sensors its easyest way to do that, with QRE1113 or TCRT5000.
But i more interested in hall sersors, currently i have both of them analog and digital, and im trying to measure speed by detection coild magnet field, its not working for digital one, but it works for analog, i see small rising and falling edges. Do any one have tried something similar? maybe you have some ideas how to turn this in to working prototype? cause i think this wave signal is based on motor voltage (and/or hall sensor supply), and i need some idea for bulletproof code to make it work, i mean exact measure by wave generated by coil rotations.
If it will not work, i will try to add magnet to first gear and use digital sensor, but as i said more interesting its to scan for coil magnetic field.
You will to explain what this means. Are you trying to sense the magnetic field of a motor with a magnetic shield around the field coils? At least the picture shows such a motor.
When motor rotates,

you can see that 1 coli is between magnets and it are powered, so it produce magnetic field, and i trying to measure rpm by detecting it with analog hall sensor.
The main problem for me here, that for accurate result i need to use something like interrupts, but i can't do it with analog input, and u can't use there lm393 curcuit there to convert analog in to digital signal, cause based on motor supply reading of hall sensor is different i think.
And when i adjest potentiometer on lm393 circuit for one voltage, lets say 5V, and use this motor with 9V, it will not work, i will need to adjust it again.
TT motor with encoder is good, but i think i need more accurate rotation, like in your last link,and they are too expensive.
But that image FAILS to show the magnetic shielding ring around the motor so those magnetic fields are either completely enclosed or there are very limited strength. If limited, they are also distorted. Take one of the motors apart to see the actual construction.
You mean metal cover of motor, decrease magnetic field from coil? so outside its no that big?
A bit offtop question, which atmega i can use to connect 4 hall sensors to interrupt, and connect it to 2 mx1508 to control 4 motors at the same time trough i2c, so it be standalone device only for 4 motors control
So, i made it in easy way, i glued magnet in to first gear printed some kind of positioner for it, and used digital hall sensor, works perfect for now. Thank you for help.