Control motor DC


#1

hallo guys…
I need your help. How to control DC motor speed and timing it? So, I can stop it in the right time.
thanks


#2

Hello @younatan_mint and welcome to the Cayenne Community!

Controlling a DC motor’s speed and direction depends on the Motor itself, and the platform you’re wiring it into (Arduino vs Raspberry Pi). Let us know a bit more about what you’re planning to use here, and I should be able to get you pointed in the right direction.


#3

Define your variables! What is the motor voltage? How much current does the motor draw at full load?

Here’s a “commercially produced” motor controller-
http://www.digikey.com/en/product-highlight/m/maxim-integrated/maxrefdes89-full-bridge-dc-motor-driver-mbed-shield

-but you would be better off with an understanding of H-bridges- here’s the BEST article I’ve seen on transistors/H-bridges/power drivers-
http://www.ermicro.com/blog/?p=423


#4

Also- to define “actuator position” (OR motor speed/direction)- you need a position sensor- usually a variable resistor (on servo motors) or a rotary encoder, or “limit” switches.

Using a (potentiometer), -as the actuator arm moves, the variable resistor sweeps between 0 volts and +Vcc, and is fed back through the motor control logic. The bigger the difference between the variable resistor input, the faster the motor turns (in either direction). If the potentiometer is at exactly 50%, the motor should be at rest (for a bi-directional motor), or, for a unidirectional motor (continuous rotation)- the potentiometer would be at zero volts.

A “rotary encoder” either keeps a pulse count, or it encodes a binary value that corresponds to position.

A limit switch just tells the motor controller “STOP! You’re THERE”.

It’s all the same, whether it’s a diesel-electric locomotive or a toy quad copter- the principal is all the same. :wink:


#5

Meh- I’d argue that the “platform” makes little difference.
The interface may change, but the electronic principal is the same no matter what platform you’re using.

-just my 2 bits… :wink:


#6

No worries – agreed in principle :slight_smile:

I thought it would be handy to know if younatan_mint needs help wiring and integrating it into Cayenne. We’ll see what they have to share soon.


#7

hehehe- that’s software. I’m a programming ignoramus! :slight_smile: BUT- it would be nice if you included a library for this PWM controller chip. I THINK you already have that library set up in Cayenne…not sure…

The Adafruit .pdf is an EXCELLENT read! Very understandable. Thankyou, Adafruit!
http://www.digikey.com/product-detail/en/nxp-semiconductors/PCA9685PW-Q900,118/568-5931-1-ND/2531218