-->
Page 1 of 2

Newb needs help with esp8266 controlling a DC motor

PostPosted: Mon Apr 02, 2018 6:45 pm
by asn
I am trying to automate some blinds, and due to the size of the blinds, I can't fit a servo in the top, and have it line up with the rod inside that I am trying to turn. Someone suggested I use a DC motor instead of a servo.

I now have a small DC motor, but it only has a positive and negative connection. No PWM type of control. Is there a way I can use PWM type of commands with a DC motor?

Or is there a simple way to change the positive --> negitive, and negitive --> positive to reverse the motor?

I am using a ESP8266, and nodemcu with default.bas for the program.

thanks

Re: Newb needs help with esp8266 controlling a DC motor

PostPosted: Tue Apr 03, 2018 5:19 am
by btidey
You will need a buffer circuit to drive the dc motor. As you want to reverse it, the easiest option is to use a H-Bridge motor controller which can reverse the polarity of the drive.

The type you want will be determined by the voltage and current needs of the motor. An L298N unit would be suitable for modest voltage and current motors.

Re: Newb needs help with esp8266 controlling a DC motor

PostPosted: Tue Apr 03, 2018 11:27 am
by asn
Thank you.

To clarify I found a pinout of the L298 here: http://www.instructables.com/id/Control ... Dual-Moto/

Looking at that drawing, I connect #1 and #2 to the DC motor, then use #7 for the PWM commands? Does anything need to connect to #8 or #9?

Also I'd like to make sure I am not going to over power or burn up anything. My plan is to go with USB power aka 5V. The DC motor normally accepts 6V-12V, but will also run (just a little slower on 5V). The motor is: https://www.servocity.com/90-rpm-micro-gear-motor

And, does the brand of the L298N make a difference? Amazon has 5 packs of Daoki for $15, or Qunqi 2 for $10, or others for $7 or so each.

thanks again for your assistance

Re: Newb needs help with esp8266 controlling a DC motor

PostPosted: Tue Apr 03, 2018 3:08 pm
by schufti
try to get a ready built motorshield from aliexpress,
https://www.aliexpress.com/item//1859086104.html
much cheaper