Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By HermannSW
#20438 Hello,

until now I did work wit ESP9266-01 and ESP8266-12, with Arduino ESP8266 IDE and NodeMCU, and pretty much ignored adding any capacitators to my ESPs althouch I did control a micromotor directly without motor controller before.

Below you can find Fritzing diagram of my setup:
    * LD33V gives me 3.3V for ESP8266-01 from 5.2V.
    * Logic Level Converter (LLC) converts the 3.3V signals from ESP8266-01 to 5V for motor controller L293D
    * TXD and GPIO0 signals from ESP8266-01 control Input1 and Input2 of L293D
    * PWM pin Enable1 is connected to 5.2V fixed (orange)

If I run this with 3.7V or 7.4V (1/2 LiPos) all is fine, I can reliable telnet over Wifi into ESP8266 NodeMCU, set both lines to output by gpio.mode(x,gpio.OUTPUT) [x=3 or x=10] and then toggle the lines by gpio.write(x,1-gpio.read(x)). It allows me to start the motor and stop the motor, with rotation in the direction I selected. Slow with 3.7V (its a 9-15V motor), quite some speed with 7.4V.

Now if I put third Lipo in play to get 11.1V motor voltage, the motor keeps running but after some seconds resets the ESP8266-01 and I have to pull power to get it stopped.

Things get worse if I control Enable1 via ESP8266-01 line and set Input1 to 5V. This works with 3.7V (but only on/off via digitalWrite, PWM seems to have no effect on speed). If I connect 2nd Lipo to get 7.4V the motor starts very fast and then resets ESP8266-01 before I even have a chance to copy in the toggle command into telnet session for turning off.

So my questions are:
    Where do I have to add capacitators to make ESP8266-01 immune to motor spikes?
    What else needs to be added to diagram?
Image

Photo from yesterday:
Image


Hermann.
User avatar
By tytower
#20496 Wouldn't you need a diode accross the motor terminals ? When you turn off any power to motor the field in the motor will break down so its got to have somewhere to go
Does the motor only turn the one way or both?
User avatar
By HermannSW
#20513 Hi,

> Wouldn't you need a diode accross the motor terminals ?
>
You are right for eg. L293 motor controller, but the L293D I use has the diodes already:
http://www.ti.com/lit/ds/symlink/l293.pdf#page=2

> Does the motor only turn the one way or both?
>
Mostly in one way for eg. linefollower robot application, but both ways for 2-wheel balancing like this:
Image

I learned from a colleague that I should add a 0.1μF capacitor between the motor connectors.

And http://www.esp8266.com/viewtopic.php?f=13&t=3402#p19434 seems to suggest adding a capacitor between GND and VCC of ESP8266 as well (and a 3.3V Zener Diode for RXD of ESP8266).

Hermann.
User avatar
By kenn
#20529 Why is UTXD connected to the 5/3.3v converter? [ah. being used as an output. nevermind]

Also, those flying wires might pick up alot. Definitely add some capacitors between Vcc and Gnd right by the ESP-01.

Finally, you might get a bit more immunity by connecting the Gnd wire for the ESP-01 directly to the battery -ve rather than to the regulator - makes for a shorter path and rejects any noise induced in the line from the battery -ve to the regulator.