DIY Projects

Test of the Shield Motor I2C Wemos D1 Mini (or Pro) to drive 2x 15Vdc motors

Today, I propose to discover the Shield Motor I2C for Wemos D1 Mini. This small shield built around the Toshiba TB6612FNG driver allows to control 2 DC motors. The Shield is capable of independently controlling the speed and direction of each motor (A, B). The maximum permissible power is 1.2A per motor. It supports a power peak at 3.2A.

 

By default, the shield is located at address 0x30 on the I2C bus. The board comes with a library in C ++ as well as 4 examples of Arduino code. The firmware of the STM32F030 to control the shield via the I2C bus is not installed (or properly installed) on some clones. It is best to buy the Shield Motor directly on the official Wemos store on Aliexpress. In addition the board does not cost more.

Unpacking the Shield Motor I2C TB6612FNG for Wemos D1 mini

The Shield Motor I2C comes in an anti-static pouch with a simple connector set. It is therefore planned to close the Shields stack. This is quite logical considering the wiring to be made.

Communication with the shield is via the I2C bus. By default, pins D1 and D2 are used. The official page of the shield can be found here.

The Shield is built around Toshiba’s TB6612FNG circuit. The complete technical data sheet can be found here.

Technical characteristics

How to change the I2C address of the shield

By default, the Shield is at the address 0x30 on the I2C bus. On the back of the shield there are 2 jumper AD0 and AD1. By making a bridge by welding the two terminals of each jumper, one can change the address of the shield. The ‘-‘ means that the pot is open. The ‘x’ means that the bridge is closed by a weld.

AD1 AD0 Adresse
0x2D
x 0x2E
x 0X2F
x x 0x30 (default)

Welding of connectors

There are 4 connectors to be welded on the Shield Motor. One on each side that allows to stack the shield on the Wemos D1 Mini as usual. The third (USB side) is used to power the motor on an external battery (the Wemos is not powerful enough to power engines) and to drive for both engines.

The fourth connector opposite the motor connector is not documented. It seems that this is simply a serial port. Hackers can use it to reprogram the STM32F030 microcontroller used for I2C communication (full tutorial).

The DTR pin allows you to reset the TB6612FNG.

The jumper RST on the back of the board will have to be de-soldered to activate this mode. To weld the motor connector, I advise you to insert it on a breadboard to keep the shield vertical during welding.

Upload ESP8266 code

Wemos has developed a C++ library for Arduino. The source code as well as four basic examples are available on GitHub here:

To call the library in your Arduino programs, it will suffice to declare it at the beginning of the program

#include "WEMOS_Motor.h"

The Motor method is used to initialize an object for each motor A and B. The Motor class takes as parameter:

This gives, for example, for the motor A

Motor M1(0x30,_MOTOR_A, 1000);

To control the engine, we have the setmotor method which takes 1 or 2 parameters. The first parameter is the order to be executed. The second is the setpoint of the parameter. The commands offered by Toshiba’s integrated circuit TB6612FNG include the following:

You understand, there is nothing very complicated in the use of this library. As usual, we get a very compact assembly and very easy to integrate in our projects. We will see in an upcoming tutorial how to use it to recycle an old remote-controlled car. This shield, which costs less than €3 (excluding postage), will be easier to use than an L293D H-bridge.

Click to rate this post!
[Total: 2 Average: 4.5]
Exit mobile version