From Waveshare Wiki
Jump to: navigation, search

DC Motor Driver Module For Raspberry Pi Pico
Driving Up To 4 x DC Motors





This is a DC motor driver module for Raspberry Pi Pico, driving up to 4 x DC motors


  • Standard Raspberry Pi Pico header, supports Raspberry Pi Pico series.
  • I2C controlled, supports 32 x different I2C addresses by setting the 5 address jumpers.
  • Onboard PCA9685 chip, provides 12-bit hardware PWM to adjust the motor speed.
  • Onboard TB6612FNG dual H-bridge motor driver, high efficiency, low heating.
  • Integrates 5V regulator, up to 3A output current, can be powered from the battery through VIN terminal.
  • Break out unused pins of Pico for easy extension.
  • Provides complete supporting manual (example demo for Raspberry Pi Pico C/C++ and MicroPython).


  • Operating voltage: 6~12V (VIN terminals)
  • Logic level: 3.3V
  • Pwm driver: PCA9685
  • Motor driver: TB6612FNG
  • Control interface: I2C
  • Dimensions: 65 x 56mm



Pico Quick Start

Download Firmware

  • MicroPython Firmware Download

MicroPython Firmware Download.gif

  • C_Blink Firmware Download

C Blink Download.gif

Hardware connection

Attach the Pico on the driver board, please take care of the direction according to the USB port silk screen printing.

Setup environment

Please refer to Raspberry Pi's guide: https://www.raspberrypi.org/documentation/pico/getting-started/

Use in the Raspberry Pi environment

Dowload Demo

1. Open a terminal of Raspberry Pi
2. Download and unzip the demo codes

sudo apt-get install p7zip-full
cd ~
sudo wget  https://www.waveshare.com/w/upload/5/5c/Pico-Motor-Driver-code.7z
7z Pico_pico-Motor-Driver-code.7z -o./pico-Motor-Driver-code.7z
cd ~/pico-Motor-Driver-code


  • The following tutorial is operated on Raspberry Pi, but due to the multi-platform and portable characteristics of cmake, it can be compiled successfully on PC, but the operation is slightly different, and users need to judge by themselves.

To compile, make sure you are in the c directory:

cd ~/pico-Motor-Driver-code/c/

Create and enter the build directory in the folder, and add the SDK: where ../../pico-sdk is the directory of your SDK. There is a build in our sample program, just enter it directly

cd build
export PICO_SDK_PATH=../../pico-sdk
(Note: Be sure to write the path where your own SDK is located)

Execute cmake to automatically generate Makefile files


Execute make to generate executable files, the first compilation time is relatively long

make -j9

After the compilation is complete, the uf2 file will be generated. Press and hold the button on the Pico board, connect the pico to the USB port of the Raspberry Pi through the Micro USB cable, and release the button. After connecting, the Raspberry Pi will automatically recognize a removable disk (RPI-RP2), and copy the main.uf2 file in the build folder to the recognized removable disk (RPI-RP2).

cp main.uf2 /media/pi/RPI-RP2/


Run in Raspberry Pi

  • Hold the BOOTSET key of the Pico board, then connect the Pico to Raspberry Pi by USB cable, then release the key.
  • Once the removable disk (RPI-RPI2) is recognized, copy the rp2-pico-20210418-v1.15.uf2 file to pico.
  • Open the Thonny IDE in Raspberry Pi, update it if it doesn't support Pico
  • Configure the port by choosing MicroPython(Raspberry Pi and ttyACM0 port) in Tools -> Options... -> Interpreter

If your Thonny doesn't support Pico, you can update it with the following command:

sudo apt upgrade thonny
  • Choose File->Open...->python/ and select the corresponding .py file to run the codes

Use in Windows

  • 1. Press and hold the BOOTSET button on the Pico board, connect the pico to the USB port of the computer through the Micro USB cable, and release the button after the computer recognizes a removable hard disk (RPI-RP2).
  • 2. Copy the rp2-pico-20210418-v1.15.uf2 file in the python directory to the recognized removable disk (RPI-RP2).
  • 3. Open Thonny IDE (Note: Use the latest version of Thonny, otherwise there is no Pico support package, the latest version under Windows is v3.3.3).
  • 4. Click Tools->Settings->Interpreter, select Pico and the corresponding port as shown in the figure.


  • 5. File -> Open -> the corresponding .py file, click to run, as shown in the following figure:




Demo codes


If you require technical support, please go to the Support page and open a ticket.