News How to Use Your Raspberry Pi Pico With DC Motors

CooliPi

Reputable
Oct 4, 2019
72
22
4,535
Using PWM or Delta-Sigma modulation, it's possible to regulate torque of the motor (it's proportional to the current).

I used it once with L298.

Using hardware PWM or those bitbanging GPIO processors, it should be possible to make it analogue and very precise using delta-sigma modulation with the latter.
 
Mar 22, 2021
3
1
15
Hello, first I am relatively new to micro controllers / micropython so apologies in advance if I'm asking the obvious.

I tried to replicate this demo and I've had partial success. The programs starts and the motor begins to move. Almost immediately after the motor initiates movement the programs stops and gives me the following error.

Connection lost (read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?))

Now I soldered the DRV8833 board myself and it was my first time soldering. Could I have a bridge between 2 pins? (Multiple access on port?)

I took a couple of pictures of the soldering. Maybe something is obvious to you guys more experienced There are a couple of pins where I wonder if I have contact but I don't recognize any bridging. Unfortunately I can't seem to figure out how to attach a local image to this message. :(

My code is as follows...

import utime
from machine import Pin

motor1a = Pin(14, Pin.OUT)
motor1b = Pin(15, Pin.OUT)

def forward():
motor1a.high()
motor1b.low()

def backward():
motor1a.low()
motor1b.high()

def stop():
motor1a.low()
motor1b.low()

def test():
forward()
utime.sleep(2)
backward()
utime.sleep(2)
stop()

for i in range(5):
test()
print("test number", i+1)

Any suggestions would be greatly appreciated,

Bob
 
Mar 22, 2021
3
1
15
Still struggling with this almost a week later. Thusfar I have...

  1. Soldered a new DRV8833 chip. Confirmed continuity with a multimeter
  2. Substituted a new breadboard
  3. substituted a new motor, confirmed correct contact
  4. copy and pasted exact code from demo to eliminate typos

I'm really at a loss for what to look for next. Exact parts used assembly are

KOOBOOK DRV8833 Motor drive

and

Flormoon DC Motor

The code is listed above and I'm still getting the same error / behavior. The motor will turn for ~ ½ sec and then Thonny produces the following message,

Connection lost (read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?))

Any suggestions would be greatly appreciated.

Thanks,
 
Mar 22, 2021
3
1
15
@chabes Yes, just received a AAx4 battery back from Amazon today and it did work. I'm fairly new to this so I wasn't quite sure how to connect everything on the breadboard. Black / negative from the battery pack was connected to ground and I connected red / positive to the VCC of the of the DRV8833 drive. That worked. All other connections were as described in the tutorial.

Any idea why the demo was able to be powered from the pico but I needed the external supply?

Thank you for the reply... much appreciated.
 
  • Like
Reactions: chabes
Apr 3, 2021
2
0
10
@Bobber76 Sounds like you wired it correctly. I'm no expert, but I've run in to similar issues before with various other MCUs.

I have a few USB cables that kinda suck (especially the longer ones), and they have been the source of some of my issues in the past. Could be something similar going on for you.

If not the cable, maybe the specific motor you have might be more power hungry than the OP's motor.

Someone more experienced than myself could probably provide a more thorough response.

Glad to hear you got it to work!