Let's Make Robots!

Picaxe PWM and servos

I have tried using picaxes PWM outputs on 2 robots now with limitted success. The biggest problem I have is that the PWM frequency although adjustable is very high (typically 16KHz with a 16MHz resonator). This causes the windings of the motor to have a much higher impedance resulting in poor torque. When I use the setfreq command to drop the clock speed very low (500KHz) then I get good torque even with a low dutycyle but the processor is so slow it is almost asleep.

I have considered using the PWM output to generate an analog output and then convert that into a low frequency variable dutycyle output but this still leaves me with problem #2. The servo command and PWM command use the same timer. I had hoped that this limitation would be eliminated with the X2 chips but unfortunately not. You need to alternate between using servos and controlling the speed of DC motors with one turned off while using the other.

I am now looking at the X2's timer 3 as a possible solution to PWM driving my DC motors.

It seems that the PWM command is more trouble than it is worth. Has anyone else used the PWM outputs much? What has been your experience?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fritsl's picture
I always make my own PWM's - simply by leting the code spit out the on/off's. Low tech, but result is PWM. Possibly have a look at the structure of Wall Racers, it's generating PWM without using the command, but ever self-ajusting pulses..
Aniss1001's picture
Can't help with your Pic(axe) problem. However I'd suggest using one of these ICs. They have their own timers, are also capable of controlling servos and I've seen them as low as 2.75$ at AVNET (allthough the DIP version has been out of stock there for some time)...
Chris the Carpenter's picture
I had the same problem with the "PWM and servo at the same time" thing. I have never noticed any torque problems but then again, Walter is extremely over powered to begin with. Now, I don't know your exact limitations in terms of what the boss-man will let you use, but I solved everything with a I2C servo driver. I found a stand-alone chip for $20 which works AWESOME. I'm sure if DAGU is looking at making a bunch of these things, that $20 chip would drop drastically in price.
robologist's picture
Perhaps in one word : "Arduino"
OddBot's picture
We will also produce an AVR or arduino version but I am trying to develope robots specifically for picaxe as they are now one of our customers. At this point I will change the design back to original and use cont. rotation servos.
mintvelt's picture

I kept running into problems with servos and motors on the picaxe 28X1. That's why I decided to use dedicated controllers for motors, arms etc and use a serial line to talk to them.

Lots of the motor driver boards have their own proc. It makes sense too. Easier to work out the timing for a dedicated PWM than to program it alongside all sorts of other stuff.

08M dual software PWM (I think you know that one) 

 

OddBot's picture
Unfortunately I have to keep the cost of SplatBot MkIV down and use a single processor. The original used the equivalent of cont. rotation servos so that the PWM command was not needed. I think I will be doing the same, ditch the DC geared motors in favor of cont. rotaion servos.
mintvelt's picture

Thats the downside of your glorious adventures in China. Us mortals who only build for ourselves, only have to weigh "I-wanna" vs. "my-budget" while you have to design with one eye fixed on production costs: ignoring your own "i-Wanna". Must be hard. 

maneuver's picture
I-wanna always win in the end. I just wish I-wanna would listen to I-need once in a while...
mintvelt's picture

I-need: whats that? ;) 

Currently; all my-budget and my-time is being claimed by two adorable babies. I-Wanna seems pretty unimportant at the moment. Thats OK though; I'll be back.... one day.