WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Wemos ESP8266 based development boards and shields *** NEW***
admin
Site Admin
Posts: 725
Joined: Sun Aug 05, 2012 4:02 pm

WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by admin » Fri Nov 25, 2016 12:10 pm

Image





The WeMos I2C Dual Motor Driver Module is designed to be able to drive up to two DC motors from your WeMos mini or mini Pro development boards (See HCWEMO0002). Using PWM the shield is capable of independently controlling the speed and direction of each connected motor with a maximum average of up to 1.2A (3.2A peak). The shield, together with its supplied headers (3 x 10 way supplied unsoldered), allows for it to be easily inserted and removed from the WeMos Mini. Control of the shield is via the WeMos mini's I2C interface which can be configured via solder jumpers to one of 4 I2C addresses (0x30 default). A library and example sketch is provided by WeMos to make controlling the shield from your own sketches as simple as possible.



Image



Features:

I2C Interface
Power Supply Voltage: VM =15V MAX
Output Current: Iout = 1.2A (average) / 3.2A (peak)
Standby control to save power
CW/CCW/short brake/stop motor control modes


Pinout:

VM.........Motor Power Supply +(Max 15Vdc)
GND.......Motor Power Supply -
A1 A2.....Motor A
B1 B2.....Motor B
S...........Standby Control Mode
I2C Mode: Control TB6612's STBY with I2C protocol
IO Mode: Control TB6612's STBY with "S" pin

Shield Reset Mode:
Short: Reset with D1 mini (reset at power on or press D1 mini's reset button)
Open: Reset by "DTR" pin.



Image



Example Arduino Sketch:

Code: Select all

/* This sketch was created by WeMos.cc */

#include "WEMOS_Motor.h"

int pwm;

//Motor shiled I2C Address: 0x30
//PWM frequency: 1000Hz(1kHz)
Motor M1(0x30,_MOTOR_A, 1000);//Motor A
Motor M2(0x30,_MOTOR_B, 1000);//Motor B


void setup() 
{
  Serial.begin(250000);
}

void loop() 
{
  for (pwm = 0; pwm <= 100; pwm++)
  {
    M1.setmotor( _CW, pwm);
    M2.setmotor(_CW, 100-pwm);
    Serial.printf("A:%d%, B:%d%, DIR:CW\r\n", pwm,100-pwm);
  }
  
  M1.setmotor(_STOP);
  M2.setmotor( _STOP);
  Serial.println("Motor A&B STOP");
  delay(200);
  
  for (pwm = 0; pwm <=100; pwm++)
  {
    M1.setmotor(_CCW, pwm);
    M2.setmotor(_CCW, 100-pwm);
    Serial.printf("A:%d%, B:%d%, DIR:CCW\r\n", pwm,100-pwm);
  }
  
  M1.setmotor(_STOP);
  M2.setmotor( _STOP);
  delay(200);
  Serial.println("Motor A&B STOP");

  M1.setmotor(_SHORT_BRAKE);
  M2.setmotor( _SHORT_BRAKE);
  Serial.println("Motor A&B SHORT BRAKE");  
  delay(1000);
  
  M1.setmotor(_STANDBY);//Both Motor standby
  M2.setmotor( _STANDBY);
  Serial.println("Motor A&B STANDBY");  
  delay(1000);
}



Image

Schematic:
HCWEMO0010_Schematic.pdf
Arduino Library:
WEMOS_Motor_Shield_Arduino_Library.zip
The above library can also be downloaded from the following GitHub page: https://github.com/wemos/WEMOS_Motor_Sh ... no_Library



Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.
You do not have the required permissions to view the files attached to this post.

uppermill
Posts: 4
Joined: Sun Jun 18, 2017 3:09 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by uppermill » Sun Jun 18, 2017 3:13 pm

I connected the motor shield as illustrated in the diagram and run the test library but the shield does not start the motor.

I've tried an I2C scanner but it cannot find any devices.

Can you help?

Regards

Allan

andrew
Site Admin
Posts: 791
Joined: Sun Aug 05, 2012 4:15 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by andrew » Mon Jun 19, 2017 9:04 am

Can I first get a little more information about your setup:

What type of microcontroller or development board are you using with it?

Could you describe whats connected to each pin on the module?

Do you have any kind of part number for the motor(s) you are using with it?

When connected is anything on the module getting hot to the touch?
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

uppermill
Posts: 4
Joined: Sun Jun 18, 2017 3:09 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by uppermill » Mon Jun 19, 2017 3:52 pm

Andrew - the shields is connected to a Wemos D1 mini. VM and GND are connected to a 7.4V LIPO and the motor is a lego train motor connected to pins A1 and A2. Nothing is getting hot.

Regards

Allan

andrew
Site Admin
Posts: 791
Joined: Sun Aug 05, 2012 4:15 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by andrew » Tue Jun 20, 2017 9:20 am

Thanks for the answers, everything you're doing looks sensible. Just to be sure I've checked the posted sketch with a D1 mini Pro and Lite and it is defiantly working. Just a few more things:

When running the test sketch, if you open up the serial monitor window do you see any output? This should confirm the sketch is at least running.

The motor shield is very particular about the format of the data it receives and an I2C scanner will just cause the I2C bus to temporarily lock up. Also any bus data errors could cause issues. Is the shield plugged directly into the D1 or is it connected remotely via some wires?

Just as a sanity check, have you confirmed that the motor is working by connecting it directly to your LiPo?
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

uppermill
Posts: 4
Joined: Sun Jun 18, 2017 3:09 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by uppermill » Tue Jun 20, 2017 10:34 am

Andrew - thanks for checking it out.

The serial port does give output and I've had already checked the motor in the manner that you suggested.

I'll do some further tests.

Regards

Allan

uppermill
Posts: 4
Joined: Sun Jun 18, 2017 3:09 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by uppermill » Tue Jun 20, 2017 11:49 am

Andrew - looks like I have resolved the problem. It suddenly started working. Looks like I have a bad joint somewhere.

Thanks for all your help - much appreciated.

Regards

Allan

andrew
Site Admin
Posts: 791
Joined: Sun Aug 05, 2012 4:15 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by andrew » Tue Jun 20, 2017 2:13 pm

Ok, no problem.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

zjor
Posts: 1
Joined: Wed Jun 28, 2017 9:26 am

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by zjor » Wed Jun 28, 2017 9:30 am

I'm facing similar issue:

board: wemos d1 mini
motor: DC, working, tested standalone
VCC: 1.5Vx4 batteries, motor is working with it

I've connected everything as on the schema above and motor doesn't move. I changed Serial speed to 115200, connected via serial monitor and see that program prints out PWM values, but the motor is still not moving.

Could you please help?
I've heard that the firmware on the motor shield itself can be broken, could it be the issue?

Regards,

andrew
Site Admin
Posts: 791
Joined: Sun Aug 05, 2012 4:15 pm

Re: WeMos D1 Mini Motor Drive Shield (HCWEMO0010)

Post by andrew » Wed Jun 28, 2017 11:01 am

The only issue I've seen mentioned on the Wemos forum is that it is possible for the controller to lock up if an incorrect formatted I2C command is sent to the shield or a timeout condition occurs. This is not something we've seen happen in our own tests. However if that was the problem a simple reset should resolve it. Also, this issue should affect the test sketch in the first post so I think it would be unlikely that was the cause of your problem.

If the sketch doesn't work for you then I would suggest checking for a bad connection or bad solder joint on the header pins as this would be the most likeliest cause.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply