Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: corrado33 on October 24, 2009, 10:02:43 AM
-
So as the title states, I need to drive 4 DC motors, therefore I need 4 PWM outputs. I'm making a palm powered robot, so I don't need an overly complicated microcontroller cause most of the processing will be done by the palm.
So should I just buy the cheapest microcontroller that has 4 PWM outputs? Microcontrollers themselves aren't that expensive, so I really don't care. I saw one of the higher numbered AtMega#### ones that had 4 PWM outputs. It was 7 bucks I think? The only problem is that it was square, and I couldn't find a socket for it. (Yeah I suck at searching DigiKey)
So, any advice?
-
Many processors today are not designed for sockets, they are designed to be soldered to a PCB as a surface mount device. Try to find that processor on some type of breakout or development board. SparkFun has a nice selection of such boards.
PWM output can also be done with software and an internal hardware timer. Most of the time it is better to use one processor.
-
Hi,
Even an 8 pin controller can be used for that.
Make the PWM either by a timer interrupt or by simply counting through a loop setting the relevant bits on the relevant times and resetting them in the end or v.v.
-
Gotcha, so specific PWM outputs just make PWM easier. I understand now. I thought PWM outputs were REQUIRED for PWM. THANKS!!
-
Hardware PWM comes at no expense (ie it just happens) but requires the number of hardware PWM channels to be available on the chip.
You can 'simulate' PWM by using a timer to generate interrupts to call your code which then flicks the output pins. BUT - bear in mind that with slow PWM frequencies the motors will judder or whine so you need a high'ish frequency. So if you are trying to do it in software then your mcu may spend most of its time in interrupts simulating PWM