| [ Home | Comics | Robots | Humans | Projects | About | Account ] | |
30 May 2007 dwhall »
I ordered some motors from BG
Micro at 3pm on Thursday last week. They arrived two
days later at noon via the USPS! They are small MicroMo
motors with Faulhaber gearboxes and, best of all, built-in
magnetic quadrature shaft encoders.
I made the following measurements on just one of the motors using a crappy DMM:
Then today, I connected the encoder output (ChA only for testing) to pin PE4 on my Atmel ATmega103. I used that input so I could get edge-triggered interrupts. I wrote an interrupt handler in C that incr/decrements a 16-bit counter variable. The main program prints the counter variable to an LCD once every second. Here is the code (minus comments so it all fits):
#include <stdint.h> #include <avr/io.h> #include <avr/interrupt.h> |