Motor Driver for micro:bit

From Waveshare Wiki
Jump to: navigation, search
Motor Driver for micro:bit
Motor-Driver-for-micro-bit-1.JPG

Motor driver for micro:bit, 2 DC motors
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

This is a motor driver module designed for the BBC micro:bit. Can drive 2 DC motots and 3 steering gears.

Features

  • micro: bit edge connector, directly pluggable.
  • Onboard connectors for two DC motors and three steering gears.
  • 5V regulator, supports 6V~12V input (VIN terminal). Output current up to 3A.
  • Onboard connectors for DC motor and standard steering gear.
  • Comes with developing resources and manual.

Specification

  • Power input range:6V~12V
  • Gear voltage: 5V
  • Logic voltage: 3.3V
  • Driver: TB6612FNG
  • Dimension: 65mm x 36mm
  • Holes size: 3.0mm

Pinouts

PIN Description
Vcc Power (6~12V)
GND Ground
A1 positive pole of motor A
A2 negative pole of motor A
B1 positive pole of motor B
B2 negative pole of motor B
P0 control pin P0 of steering gear
P1 control pin P1 of steering gear
P2 control pin P2 of steering gear

Programming Guide

Micro:bit has variety of programming methods like mbed, micropython, typescript, and other programming methods, as well as code online websites which are abundant.

The official recommendation is two programming methods: typescript and micropython. Typescript is the graphical programming language.

Typescript

Typescript is a kind of graphical programming, its website is: https://makecode.microbit.org/#

  • Open a browser and input the next URL

Open make.gif

  • Add Package

You can clone the package of Motor Driver HAT for micro; bit from Github. Click More..-> Add Package, then copy the URL to the Edittext. https://github.com/waveshare/pxt-Motor

1 addpackage motor.gif

Control Motor Rotation

Control two motors at the same time, and set their rotating direction and speed

Motor Driver HAT UserManual 2.gif

Stop motor when button A is pressed

Motor Driver HAT UserManual 3.gif

Control Servo

Control servo to rotate at a certain angle.

Motor Driver HAT UserManual 4.gif

Other blocks

There are also some blocks in Advanced->More that can be used to control servo

Motor Driver HAT UserManual 5.png

Python

You can get more information about python programming of micro: bit on this web page: https://microbit-micropython.readthedocs.io/en/latest/index.html

We provide python codes for this module, you can download it and have a try.

Unzip the demo code you download and open the file motor.py which is under the python directory with software mu.

Initiailing

Motor Driver HAT UserManual 6.png

Control Motor

Motor Driver HAT UserManual 7.png

Stop

Motor Driver HAT UserManual 8.png

Cotnrol Servo

Motor Driver HAT UserManual 9.png

Control servo to rotate in certain angle

Motor Driver HAT UserManual 10.png

Temp=angle/2+25 is the duty ratio, its range is 0~1023.

Example:

Motor Driver HAT UserManual 11.png

Motor1 moves forward, Motor2 moves backward, servo1 rotates 50 degrees, and servo2 rotates 150 degrees.

Resources

Documentation

Datasheet

Demo Code

Software

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)