A4990 DC Motor Driver?

Hi All,
Some time ago I purchased 4 x A4990 DC motor driver Carrier boards, believing they will be an easy and compact way to drive small DC motors.
Well I’ve been struggling ever since, walked away, come back several times.
There seems to be very little support on the web or from Pololu for this “SIMPLE” carrier board.
There is support for their A4990 Arduino Shield but not the Carrier Board.
I wish the CODERS would stop using SIMPLE so often.
I can usually understand entry level coding and alter it to suit my projects but I struggle to develop new code.
Can anyone point me to some MicroPython code to help me get started controlling DC motors with my new Picos ^ A4990.
Thank you with great anticipation.
The Old Plumber

Hi Stephen,

Sorry to hear you’re having trouble! Let’s see what we can do…

The motor driver you’ve got is a standard dual H-bridge design, the workings of which are gone over in our guide (with some extra on controllers):

As shown in the guide, you’d be looking to give your motor driver a PWM signal from your Pico (and sometimes short some pins to GND/VCC on the driver board to get it to work, but luckily the A4990 needs none of that)

This image from Pololu’s site is pretty useful - it you’ll just need to wire up your Pico as shown there
image

You’ll want your Pico outputting PWM to your motor driver, check out this guide:
https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/7

You can even pull the EF1 pin high with a resistor between it and INH, and then measure it on your Pico to pick up when your driver board has an error (like overheating), but this is probably unnecessary for what you’re looking to do.

Hope this gives you some food for thought! Let me know if this triggers more questions.
-James

1 Like

Thanks heaps James, I’ll do some more study and give it another go, Stephen

Hi again James, I’ve had some success and have got a small DC Motor going back and forward with the following code.

SAS A4990 test2.py

DC Motor direction & fixed speed controlled by

Pico^A4990 Pololu Dual Motor control board.

import utime

Mot2 = Pin(14, Pin.OUT)   # GPIO 14 to IN2 on A4990

Mot1 = PWM(Pin(15))       # GPIO 15 to IN1 on A4990
Mot1.freq(1000)

RedLed = Pin(10, Pin.OUT)
BlueLed = Pin(11, Pin.OUT)
RedLed.value(1)
BlueLed.value(1)

while True:
    # Motor ACW for 3 seconds     
    Mot2.value(1)
    Mot1. duty_u16 (65000) # duty 90% of 65535 max.
    RedLed.value(0)
    BlueLed.value(1)
    utime.sleep(3)
    # Motor Braking for 1 seconds
    Mot2.value(1)
    Mot1. duty_u16 (0) # duty 0% of 65535 max.
    RedLed.value(1)
    BlueLed.value(1)
    utime.sleep(1)
    # Motor CW for 3 seconds
    Mot2.value(0)
    Mot1. duty_u16(1000) # duty 10% of 65535 max.
    RedLed.value(1)
    BlueLed.value(0)
    utime.sleep(3)
    # Motor Braking for 1 seconds
    Mot2.value(1)
    Mot1. duty_u16 (0) # duty 100% of 65535 max.
    RedLed.value(1)
    BlueLed.value(1)
    utime.sleep(1)

I’ll need some help with the code later on.

3 Likes