Powering MD20A motor driver with picaxe

Gramps

Senior Member
This motor driver has 3 input pins. Direction, PWM and ground.
We tried sending PWM and ground using this code and nothing happens (accept a little hum)
The code does operate a small servo correctly.
Is the PWM frequency wrong?
Gramps

servo 4, 150 ; start servo on pin four and move to center
main:
pause 500 ; wait a half second
servopos 4, 200 ; move servo clockwise
pause 500 ; wait a half second
servopos 4, 150 ; move servo to center
pause 500 ; wait a half second
servopos 4, 100 ; move servo counter-clockwise
pause 500 ; wait a half second
servopos 4, 150 ; move servo to center

goto main ; return to main program loop


PN00218-CYT7 Cytron 20A 6-30V DC Motor Driver MD20A
 

AllyCat

Senior Member
Hi,

Servo Pulses are a very specialised (narrow width) form of "PWM", intended to signal the required speed, not to actually control the motor. Their maximum duty cycle is less than 10% (at 50 Hz), so (on average) the motor would "see" less than 10% of the available supply rail and will hardly turn, if at all.

You very probably need to use the normal PWMOUT or PWMDUTY commands (not the PWM command) on one of the dedicated pins, initially at a low frequency (say 100 Hz).

Cheers, Alan.
 

Gramps

Senior Member
Thanks! Motor driver is now responding!

;Test circuit for the DC Motor Driver MD20A
#picaxe 28x2
#no_table
servo 4, 150
init: pwmout C.2,150,100 ; start pwm

main: pwmduty C.2,150 ; set pwm duty
pause 1000 ; pause 1 s
pwmduty C.2,50 ; set pwm duty
pause 1000 ; pause 1 s
high B.1 ;CCW rotation
pwmduty C.2,150 ; set pwm duty
pause 1000 ; pause 1 s
pwmduty C.2,50; set pwm duty
low B.1 ;CW rotation
pause 1000 ; pause 1 s

goto main ; loop back to start
 
Last edited:
Top