Motor - Wemos / Lolin Motorshield

.

Plugin details

Type: Motor

Port Type: I2C

Name: Wemos / Lolin Motorshield

Status: NORMAL

GitHub: P079_Wemos_Motorshield.ino

Maintainer: Unassigned

Used libraries: .

Introduction

ESPEasy’s Wemos / Lolin Motorshield plugin is used to control small DC brushed motors. It can also be used with other resistive or inductive loads. Such as low voltage light bulbs, LED strip lights, solenoids, etc. The attached load must be able to tolerate polarity reversal.

The Motor Shield connects to the i2c bus (default address is 0x30). The Shield is designed to plug directly onto a Wemos D1 mini (ESP8266). D1 mini details are found HERE

However, it can be installed on other ESP8266 variant devices using hard wire connections. It requires 3.3V, Ground, RST, D1 (GPIO5/SCL), and D2 (GPIO4/SDA).

The Shield has a TB6612FNG driver chip that can control two DC motors that draw 1.2A or less. Motor supply voltage can range from 2.5VDC to 15.0VDC. There is also a STM32F030 microcontroller onboard that handles the i2c communication for command processing.

Supported Hardware

There are two variations of the Motor Shield. Originally only the Wemos V1.0 Motor Shield was supported. This board requires modification (custom STM32F030 firmware and solder jumpers). But on mega-20200929 and later releases the plugin has been updated to support the Lolin 2.0 Motor Shield. The Lolin Shield requires no modifications which greatly simplifies a new installation.

Hardware Installation

For installation details, please click the link below that matches the Shield you are using.

Top View of V1.0 and V2.0 Motor Shields

Motor Shield Actions

Motor control actions can be executed locally using ESPEasy rules. They can also be sent remotely using HTTP and MQTT.

Please be aware that Motor Shield communication is one-way. So it’s not possible to directly read motor status from the ESPEasy plugin.

Commands Available

Command Syntax

Extra information

WemosMotorShieldCMD,<Motornumber>,<Action>,<Speed>
LolinMotorShieldCMD,<Motornumber>,<Action>,<Speed>
The WemosMotorShieldCMD and LolinMotorShieldCMD command keywords are interchangeable.
The LolinMotorShieldCMD command keyword is available on mega-20200929 and later releases.
All commands are case insensitive.

Parameters

HTTP Examples

Motornumber:

0 Motor A

1 Motor B

Action:

Forward Turn on DC Motor, Direction Forward

Backward Turn on DC Motor, Direction Backward

Stop Turn off DC Motor, no Brake

Brake Turn off DC Motor, apply Brake (short commutator)

Standby Turn off DC Motor and set MotorShield to low power mode

Speed:

0-100 (Motor PWM Duty, 0% to 100%)

Brake and Standby actions are available on mega-20200929 and later releases.

Turn on DC Motor-A, Direction: Forward, Speed: 99

http://<ESP IP address>/control?cmd=WemosMotorShieldCMD,0,Forward,99

Stopping DC Motor-A:

http://<ESP IP address>/control?cmd=WemosMotorShieldCMD,0,Stop


Local Command Testing:

Motor tests can be performed using the Command entry box found on ESPEasy device’s Tools page. For example:

WemosMotorShieldCMD,0,Forward,99

Change log

Changed in version mega:

improved 2020/09/25 Added support for Lolin V2.0 Motor Shield. Added Brake and Standby actions. Added Lolin V2.0 i2c communication test. Incorrect syntax usage now logs error.

Changed in version 2.0:

added Major overhaul for 2.0 release.

improved 2019/03/14 Moved from Testing to Normal and added links to firmware update.

Added in version 1.0:

added Initial release version.