Skip to main content

RaspberryPi Grove TB6612FNG Motor Shield Library

PyPI pyversions PyPI version shields.io

This is an open source port of the official Grove Motor Shield TB6612FNG library for Arduino to Python for Raspberry Pi.

Features

Requirements

  • RaspberryPi I2C enabled
  • Python 3.13 or higher

[!NOTE] This library was tested in 2025 on Raspberry Pi 5 8GB with Raspberry Pi OS (64-bit Debian 1:6.12.47-1+rpt1 2025-09-16) with kernel version 6.12 running Python 3.13.5 and library version 0.3.0.

Getting started

1. Enable I2C on your Raspberry Pi

If you have not done so already, you will need to enable I2C on your Raspberry Pi. You can do this by running sudo raspi-config in your terminal, then navigating to Interfacing Options -> I2C and enabling it. After that, you may need to reboot your Raspberry Pi.

2. Install Python

You can install the latest version of python on your Raspberry Pi by running the following commands in your terminal:

sudo apt update
sudo apt install python3 python3-pip python3-venv

It is recommended to use a virtual environment for your python projects. You can create one by running the following commands:

python3 -m venv .venv
source .venv/bin/activate

3. Install the library

Install this library:

python3 -m pip install raspberry-i2c-tb6612fng

4. Example usage

import time

from raspberry_i2c_tb6612fng import MotorDriverTB6612FNG, TB6612FNGMotors

# create an instance of the driver, connected to i2c
driver = MotorDriverTB6612FNG()

# drive both motors forward
driver.dc_motor_run(TB6612FNGMotors.MOTOR_CHA, 200)
driver.dc_motor_run(TB6612FNGMotors.MOTOR_CHB, 200)

# pause for a second
time.sleep(1)

# stop the motors
driver.dc_motor_break(TB6612FNGMotors.MOTOR_CHA)
driver.dc_motor_break(TB6612FNGMotors.MOTOR_CHB)

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

Metadata

Release files for raspberry-i2c-tb6612fng 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raspberry-i2c-tb6612fng 0.3.0
File Size Uploaded
raspberry_i2c_tb6612fng-0.3.0.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for raspberry-i2c-tb6612fng 0.3.0
File Interpreter ABI Platform
raspberry_i2c_tb6612fng-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.0 kB

Release files / raspberry_i2c_tb6612fng-0.3.0.tar.gz

Download URL raspberry_i2c_tb6612fng-0.3.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5b3d1582b67fbabe0ff3d8c5af08b0864dc695927bb39fcde755f615c9403d10
BLAKE2b-256 checksum
How to use checksums
d84d93012be8c27f5a15a7fc5f2b23b4b659ae378e5cae6eb89e55c2ca7e3411
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Release files / raspberry_i2c_tb6612fng-0.3.0-py3-none-any.whl

Download URL raspberry_i2c_tb6612fng-0.3.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c12535aa556a470c9794bdd0de45d77b18341e01b473c7c6912ddf58e3d96ab6
BLAKE2b-256 checksum
How to use checksums
04d5beca47cd22703ed4c8df02566163e4252ded7f2990c38ebab6c2d85c9fe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page