Electronic – Driving a DC hobby motor using an AVR and a single power supply

avrmotor

I've recently begun experimenting with AVRs and am keen to progress beyond making blinkies to making things move. I've tried to start with something easy, but it seems I'm already foiled! What I'd like to know is this: is it possible to drive both an AVR and a motor from the same power source and without them interfering with one another?

The schematic below illustrates my initial attempt at doing this. The ATtiny is generating a ~3kHz PWM signal (1/3 duty cycle) on pin 5, with the intent of supplying a time-averaged voltage of 3V to the motor via the power transistor. When I wire this up though, the motor just seems to cough and sputter.
alt text

Thanks heaps in advance,

Tim

p.s. I'm just wondering about the fundamental possibility/impossibility of what I'm trying to do: I don't expect anybody to debug my circuit for me! 🙂

Best Answer

It's possible, sure. Is the 9 V drooping a lot under load and dropping it out of regulation? Is the voltage on both sides of the motor what you expect? You might need bigger capacitors to keep the supplies "stiff", and make sure the voltage drop caused by the motor's current in the ground wire isn't affecting the AVR's ground.