Stepper motors can be made to rotate more smoothly by providing simulated sine waves. The SLA7062 chip uses internal PWM to provide sinusoidal current waveforms to unipolar stepper motors. I have this working fairly well, but the PWM frequency is acoustically apparent and annoying.
Showing posts with label stepper. Show all posts
Showing posts with label stepper. Show all posts
Thursday, October 20, 2011
Sunday, August 2, 2009
Improved automatic cat feeder
I recently set up my automatic cat feeder (http://benkrasnow.blogspot.com/2009/02/automatic-cat-feeder.html) for a long-weekend vacation. This was probably the sixth time that I have used the feeder with great results each time. I also setup a motion-activated webcam that posted frame captures to a web server so that I could see the feeder (and cat) while I was away.
One day during the trip, I checked the web server and noticed the feeder had dispensed a huge amount of food. I've never seen my cat eat his fill and walk away from a dish with food in it, but he did this time so there much have been a truly massive amount. When I returned home, I saw what had happened: The cat had knocked over the darkroom enlarger timer, and by strange chance, the timer knob was turned from 3 seconds (an interval that dispenses a single-serving of food) to 20 seconds! The feeder emptied the entire storage chamber of food into the serving dish. It's not possible the cat knew what he was doing by messing with the darkroom timer, but it's also very strange that this happened by mere chance.
I never liked the timer approach to the cat feeder because it assumes the motor turns at a constant speed, and the darkroom timer is not easy to adjust accurately in the range of 2-4 seconds. I thought about adding a shaft encoder to make the system closed-loop. I also thought about using a mechanical means to control the shaft (ie a Geneva Wheel). Finally, I decided to use a strong stepper motor in open-loop control. I also wanted to keep the same gear reduction box that was originally coupled to the food dispenser. It's torque amplification is helpful, and it has also become a structural part of the feeder, so not easy to change.

I removed the old DC motor and pulled the armature off the shaft. I cut the shaft, then built a press-fit delrin coupler to mate the stepper motor shaft to the remaining piece of original shaft (with an integral helical gear on the end). I then made some spacers out of delrin and mounted the motor to the gearbox.
I used an Atmel AT-Mega8 AVR to turn the stepper motor through four shaft rotations when power is applied. I used PN2222 transistors to switch the unipolar motor windings. The transistors are driven through resistors by half the D port in the AVR. The gear reducer's output will spin about 1/6 of a turn, which will advance the "butterfly valve" in the feeder enough to dispense a single serving. I coded the Atmel chip using Atmel's IDE in C with WinAVR. I used PonyProg to download the code into the chip via a simple parllel port interface. I would normally use an Arduino or similar microcontroller for projects like this, but this one is so simple, a full-fledge microcontroller would be overkill and too expensive. The AT-Mega8 is about $6 and needs a $1 crystal. The Arduino is around $30.
My cat stuck his head into a pile of plastic shavings the garage and managed to get a couple scraps stuck in his whiskers.
Labels:
atmega8,
atmel,
avr,
cat feeder,
stepper
Subscribe to:
Posts (Atom)