These typically resolve the position of the magnet to at least 256counts , and usually use I2C or similar. You can daisy chain the chips with SPI too. These are good, but can be finicky about spacing above the magnet.
This magnet could go on the wheel.
Alternatively if you use a 2pole magnet, you can use a magnetic compass chip, and this can be about 10mm away from the magnet, which might help in your geometry, I've used a magnetic compass chip this way, as a proof of concept for retrofitting the Austria Microsystem chips as an upgrade to reed switches.
Off the shelf linear actuators almost always use a 2pole to 6pole ring magnet attached to the motor or a gear shaft with a screw through the middle. And then standard hall effect switches.
Note if making your own , you must use "Latching" hall effect sensors
I also did a batch of about 100 of gluing encoders to the back of a gear motor,
(insert picture here???? the upload image from computer button has dissappeared?)
This had a 4mm stub shaft sticking out the back of the motor. You take a "Diametrically polarised" disc magnet (about 5mm across) , pick it up with bamboo tweezers put a pinhead of polyurethane on the magnet, then place it on the slowly rotating motor shaft, give it a nudge with the tweezers and it will centralise. You then put two half-pea sized globs on the PCB and push it onto the rear of the motor, and secure with a rubber band while the PU sets. The power is on all the time, so you should see both LED's flashing.
These don't usually work on the type of gearmotor you have there, as the motor shaft is flush on this motor style.
You can just take some of the 3 leaded Hall effects, solder them to a bit of veroboard, and glue this on the motor, The magnet/hall effect combo is quite tolerant of positioning. (Unlike slotted disk optos)
Ok Doing the Quad encoder in Firmware
(a) There is a booby trap in the way Atmel do the pin change interrupts, while you can get a pin chnage interrupt on every single pin, in practice there are only 4 pin change interrupts, one for each port, i.e. A , B,C,D. So you must hook up the "A" channel of your first motor to say any of the A pins, and the "B" channel of your second motor to say any of the B pins, and the third one to any "C" pin. The "B" encoder channels can go aon any pin.
(b) The PCI is set up to go off for any change on hall effect A , so all the ISR has to do is add one if hall effect A and B are both the same , or subtract one if different.
Here is some sample code:
Ew_pulse_isr: If Ew_quad_b = Ew_quad_a Then Ew_position_long = Ew_position_long - Ew_step_long Else Ew_position_long = Ew_position_long + Ew_step_long Return
Note you also get a free "multiply by scaling factor" thrown into the above!
in my case Ew_position_long is a fixed point representation, where the top 16bits are the sun angle in minutes, and the bottom sixteen are the fraction, (so you just map the top 16 bits as an integer and ignore the fraction) the scale factor is embedded in Ew_step_long which equals 8509 with my particular gearing, this is basically a fraction i.e. 8509/65536 = 1/7.7019 , so in my case I move 1 minute (= 1/4 of a degree) with 7.7 counts , and as there are two counts per revolution, this is nearly 4 turns on the motor.
@David, Yes a limited bed size, but as a test bed for the idea it has everything going for it. Even the ability to put in the drill holes.
And it will also fit on my lathe and vertical drill so I get the best of both worlds if the idea is a failure. As luck would have it my Kistarter backing for Microduino presents me with a Microduino stepper kit for 3D printing, so the table can also work for small part printing.
I shall order the table today and wait for all the other bits to come together. Looks like much of the glue circuits will be on Veroboard which is always my fall back PCB.
Thinking about it, I can always put the table to work as a micro milling cutter and mill some circuit boards straight from the copper.
Will try everthing out with and up down fibre pen and paper before moving to a board.
I can see that this is going to turn into a Crusty Bits blog at some stage. Watch out Max!
Life got hectic when I started to rebuild my old UK101 in an FPGA, little did I think I would be looking at home PCB manufacture.
A relay lens is a lens or lens set that replicates an image on a different imaging plane with little or no modification. http://en.wikipedia.org/wiki/Relay_lens A borescope is an extreme example.
In this case a double convex lens can focus the floor on the optical mouse chip without having the chip too close to the floor. I once built a sensor to track the slimey encrusted bottom of a ship for a ship hull inspection robot where the lens also sealed against seawater and provided a 3:1 optical motion reduction so the robot could go faster than the mouse wanted to track. The robot wheels tended to slide on the hull but the optical tracker could track without touching.
Hi David: LOL. The pig did cross my mind. (As in male-chauvinist...ha ha.. I could not resist that one.) I don't want to distract from the topic anymore, but I'm just saying that school boys can squeal as much as girls, and some of them even have higher voices for a time. And yes there are usually electronics involved when boys squeal. (I know...I gave a coworker an Enocean energy harvesting dev kit. She came back the next day and said her teenaged son squealed and didn't want to go to the concert or sports event that night with his dad. He wanted to stay home and tinker with the dev kit.)
@Douglas: For a three wheel robot like that, especially running on carpet, I prefer to use a pair of optical mice for movement feedback. It is better if you can use a relay lens to space the mouse sensor up from the floor a little.
Tell me more (like whats a "relay lens") -- can you email me at email@example.com?
@David: And I seem to remember you were going to have an on-board accellerometer?
Yup -- also gyroscopic sensors and a magnetometer. Also ultrasonic range sensors. However, talking to Adam (Aeroengineer) yesterday, he pointed out that untrasonic measurements can be affected by temperature and humitidy, so I'm going to have to have those sensors also. Since this is just a platform for me to play with, I'm going to load it with sensors and then get the robot to use whatever is most appropriate for what it's trying to do at the time (mostly this will involve sneaking up behind the dog and then making a loud noise :-)