[SOLVED] Motor shield for NodeMCU

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
maple
Posts: 3
Joined: Thu Oct 26, 2017 9:20 pm

[SOLVED] Motor shield for NodeMCU

Post by maple » Thu Oct 26, 2017 9:46 pm

I am trying to run motor shield with NodeMCU (ESP8266 12N), motor shield doc: https://smartarduino.gitbooks.io/user-m ... index.html. As I am a newbie, there is maybe some big misunderstanding, which I cannot see after three days working on it.

NodeMCU is flashed with latest Micropython 1.9.2, powering the motor shield from 2×18650 lion batteries (approx 7.5 volts), using a shortcut between VIN and VM, so only one power for controller and motor. The code is after many hours of looking for the problem very simple:

Code: Select all

import micropython
import machine
a1 = machine.Pin(5, machine.Pin.OUT)
a2 = machine.Pin(0, machine.Pin.OUT)
b1 = machine.Pin(4, machine.Pin.OUT)
b2 = machine.Pin(2, machine.Pin.OUT)
a1.value(1)
a2.value(1)
b1.value(1)
b2.value(1)
No PWM, just put HIGH on those pins and look what I can see on motor shield output A+/A-/B+/B-. Controller looks good, I can measure 3.3V on those pins (D1-D3), but nothing on shield output. Between A+ and A- I found 0.2V, between B+ and B- there is about 0.5V.

I bought several pieces of those motor shields and all of them are the same. No output voltage on motor pins.

Photo of my super simple setup
Image
(on photo the power LED is off, but of course, I know about that power switch :-) ).

Does anybody have any idea? I tried also program the pins using Arduino IDE (reflashed the NodeMCU), but no luck too.
Last edited by maple on Sat Oct 28, 2017 11:56 am, edited 2 times in total.

User avatar
pythoncoder
Posts: 3157
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Motor shield for NodeMCU

Post by pythoncoder » Fri Oct 27, 2017 6:04 am

The data on that shield is rather limited (in particular no schematic) so it's hard to comment. My first port of call with questionable hardware is to test it, running it as the manufacturer intended. But you've done that, with no joy. If it doesn't work with NodeMCU firmware and the Arduino IDE then you might get better support from the manufacturer.
Peter Hinch

User avatar
maple
Posts: 3
Joined: Thu Oct 26, 2017 9:20 pm

Re: Motor shield for NodeMCU

Post by maple » Fri Oct 27, 2017 6:21 am

Thanks a lot. I found some post on instructables here: https://www.instructables.com/id/Motori ... h-ESP8266/ with the same motor shield. Author writes about very bad documentation and some commenters are discussing removing 2 resistors from that shield (?)

I will try to concact manufacturer. After all (before trashing those shields) I will try to remove those resistors :-)

User avatar
benalb
Posts: 22
Joined: Fri May 19, 2017 1:23 pm

Re: Motor shield for NodeMCU

Post by benalb » Fri Oct 27, 2017 3:39 pm

maple wrote:
Thu Oct 26, 2017 9:46 pm
I am trying to run motor shield with NodeMCU (ESP8266 12N), motor shield doc: https://smartarduino.gitbooks.io/user-m ... index.html.
(...)
I've got the same shield, and it works, with this code you can get the idea:

Code: Select all

from machine import Pin, PWM

""" nodemcu pins from the motor shield """
pin1 = Pin(5, Pin.OUT)  # D1
pin2 = Pin(4, Pin.OUT)  # D2
pin3 = Pin(0, Pin.OUT)  # D3
pin4 = Pin(2, Pin.OUT)  # D4

""" named after the L9110 h-bridge pins """
BIN1 = PWM(pin1, freq=750)
BIN2 = PWM(pin3, freq=750)
AIN1 = PWM(pin2, freq=750)
AIN2 = PWM(pin4, freq=750)

""" TODO: variable speed """
speed = 950 

def stop_all():
    for each in (BIN1, BIN2, AIN1, AIN2):
        each.duty(0)

def backward():
    BIN1.duty(0)
    BIN2.duty(speed)
    AIN1.duty(0)
    AIN2.duty(speed)

def forward():
    BIN1.duty(speed)
    BIN2.duty(0)
    AIN1.duty(speed)
    AIN2.duty(0)

def left():
    BIN1.duty(speed)
    BIN2.duty(0)
    AIN1.duty(0)
    AIN2.duty(speed)

def right():
    BIN1.duty(0)
    BIN2.duty(speed)
    AIN1.duty(speed)
    AIN2.duty(0)
Image
https://imgur.com/a/3HRY4

User avatar
maple
Posts: 3
Joined: Thu Oct 26, 2017 9:20 pm

Re: Motor shield for NodeMCU

Post by maple » Fri Oct 27, 2017 6:52 pm

Thanks a lot for your advice and code. But according to this https://www.instructables.com/id/Motori ... h-ESP8266/ ant mainly the first comment, there is some version of this motor shield, which cannot run until you remove those two 100 ohm resistors. My items are have the same problem :-(

I measured precisely all those resistors and there are 1K on input to L293DD, but they have 100 ohm pull down to GND. Which means, the input signal from NodeMCU controller cannot reach the L293DD. I do not really know, why they are there - L293DD can handle up to 7V on its input and NodeMCU produce 3.3V output.

I have removed those two 100 ohm resistors (first and third from left, when antenna is on the right side) and the shield is working now.

Image

Hope, this discussion can help somebody else to fix same problem with the shield.

mrogojanu
Posts: 2
Joined: Mon Dec 10, 2018 7:58 pm

Re: Motor shield for NodeMCU

Post by mrogojanu » Sun Dec 16, 2018 8:41 pm

[quote=maple post_id=22787 time=1509130322 user_id=3339]
Thanks a lot for your advice and code. But according to this https://www.instructables.com/id/Motori ... h-ESP8266/ ant mainly the first comment, there is some version of this motor shield, which cannot run until you remove those two 100 ohm resistors. My items are have the same problem :-(

I measured precisely all those resistors and there are 1K on input to L293DD, but they have 100 ohm pull down to GND. Which means, the input signal from NodeMCU controller cannot reach the L293DD. I do not really know, why they are there - L293DD can handle up to 7V on its input and NodeMCU produce 3.3V output.

I have removed those two 100 ohm resistors (first and third from left, when antenna is on the right side) and the shield is working now.

[img]https://i.imgur.com/n2O26OLl.jpg[/img]

Hope, this discussion can help somebody else to fix same problem with the shield.
[/quote]

Thank you! I tried everything and nothing was working. Removing the 2 resistors as shown above resolved my problem.

Post Reply