Control Speed of DC Motor
Control Speed of DC Motor
Hi everybody,
I am trying to control rotation speed of vibrating motor using pyboard. Continuing from my previous post http://forum.micropython.org/viewtopic.php?f=2&t=267, I want to get the analog input from HC-SR04 ultrasonic range sensor and use it to control the power of vibrating motor rotation. My problems is, when I trying to rotate motor, the motor is not even rotating. I think the power should come from the batteries directly. Or I did something wrong.
Can anyone help me?
I am trying to control rotation speed of vibrating motor using pyboard. Continuing from my previous post http://forum.micropython.org/viewtopic.php?f=2&t=267, I want to get the analog input from HC-SR04 ultrasonic range sensor and use it to control the power of vibrating motor rotation. My problems is, when I trying to rotate motor, the motor is not even rotating. I think the power should come from the batteries directly. Or I did something wrong.
Can anyone help me?
Re: Control Speed of DC Motor
You can't drive a motor directly. It draws too much current. You need to use a motor driver board which is sized for your motor. If you only need to drive the motor in one direction you can use a simple MOSFET, otherwise you'll need a full H-Bridge.
Re: Control Speed of DC Motor
I use pin X5 with DAC object. I guess with it I can control the rotation power.fma wrote:How did you connect your motor?
So should I make motor driver board or do you have a recommendation where I can buy it?dhylands wrote:You can't drive a motor directly. It draws too much current. You need to use a motor driver board which is sized for your motor. If you only need to drive the motor in one direction you can use a simple MOSFET, otherwise you'll need a full H-Bridge.
Re: Control Speed of DC Motor
In most electronics stores, just look for H-bridge DC motor controllers. With those and pyboard PWM you will be able to controll speed and directon of the DC motor.
Re: Control Speed of DC Motor
Which country are you in?yllumi wrote:I use pin X5 with DAC object. I guess with it I can control the rotation power.fma wrote:How did you connect your motor?
So should I make motor driver board or do you have a recommendation where I can buy it?dhylands wrote:You can't drive a motor directly. It draws too much current. You need to use a motor driver board which is sized for your motor. If you only need to drive the motor in one direction you can use a simple MOSFET, otherwise you'll need a full H-Bridge.
Which motor are you trying to control?
Even small motors like these: http://www.pololu.com/product/114/specs have a stall current of 2.1A so you want your motor driver to be able to drive that much current. Something like http://www.pololu.com/product/1212 would work for those motors.
This motor: http://www.pololu.com/product/2360 only has a stall current of 0.36A, so you can use a much smaller motor driver: http://www.pololu.com/product/2136
The motors used in RC trucks often have stall currents of around 20A, and require much bigger motor drivers, like this: http://www.pololu.com/product/1455 or http://www.robotmarketplace.com/product ... 25-RC.html
This one: http://www.robotmarketplace.com/products/0-IBCv2.html will do 50A per motor (and is priced for it too), but its an extremely well designed motor driver.
Some other products I've used:
https://solarbotics.com/product/k_smd/
https://solarbotics.com/catalog/motors-servos/
And other places that you can get motor controllers:
http://www.lynxmotion.com/c-10-motor-controllers.aspx
http://www.robotshop.com/en/catalogsear ... t&dir=desc
https://www.sparkfun.com/search/results ... controller
http://www.parallax.com/search?search_a ... tor+driver
Re: Control Speed of DC Motor
I am using a very tiny vibrating motor. I want to control the power of rotation using dinamic voltage output from DAC pin, but because of a low current from that pin, so I have to use external power by using H-bridge or L293D chip. I have not try it yet.
Re: Control Speed of DC Motor
If you don't need to invert the polarity, a simple FET is enough. But in each case (FET or H-bridge), you will need to use a PWM output, instead of DAC output.
Frédéric
Re: Control Speed of DC Motor
How can I get PWM output from pyboard?fma wrote:If you don't need to invert the polarity, a simple FET is enough. But in each case (FET or H-bridge), you will need to use a PWM output, instead of DAC output.
update: I will try this module first http://wiki.micropython.org/contributedmodules/pwm
Re: Control Speed of DC Motor
That's whats available for now.
I have something working that hasn't been merged yet. I just need to code up the teensy version to make sure it works on both:
https://github.com/micropython/micropython/pull/815
I have something working that hasn't been merged yet. I just need to code up the teensy version to make sure it works on both:
https://github.com/micropython/micropython/pull/815