Controlling a DC Motor

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
chipfryer27
Valued Contributor
Valued Contributor
Posts: 786
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 187 times
Been thanked: 205 times

Controlling a DC Motor

Post by chipfryer27 »

Hi

Never having much need to control a motor and then only pulling mA before, I find myself needing to control a much more beefier beast and I wonder if anyone would share some pointers regarding such?

My application doesn't actually need speed control, on/off is fine, but if I used PWM to slowly build up the speed would the inrush be reduced and if so by much? 12v DC with normal load current of just under 2A, peak load around 2.5A (briefly). I can actually take care of inrush in straight on/off switching but wondered if some code could assist?

Regards

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Controlling a DC Motor

Post by medelec35 »

Hi.
If it was me I would select LOGIC N-Channel MOSFET with low RDS, e.g. FQP30N06L to control the motor.
Although it has a built-in protection diode, I would still use a reversed bias diode across the motor.
I would recommend to use a pulldown resistor between the gate and 0V e.g 4.7K - 10K.
This is to ensure motor does not run when power is first applied.
Start off fairly slow, but not too slow as lack of back emf within the motor will cause high current flow.
I would also include a low value power resistor in series with the source of FET and 0V.
Use ADC of microcontroller at the junction of FET source and power resistor.
As the current of the motor increases ,the voltage of ADC will increase proportionally.
You can set a trigger point to cut the power to the motor, if for instance there is too much strain on the motor.
When I controlled a golf trolley about 10 years ago, I used a PWM frequency of 10KHz.
On Monday I can see if I can retrieve the circuit I used?

Hope this helps?
Martin

chipfryer27
Valued Contributor
Valued Contributor
Posts: 786
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 187 times
Been thanked: 205 times

Re: Controlling a DC Motor

Post by chipfryer27 »

Hi

Thanks for your usual sage advice, appreciated.

I hadn't thought on using the ADC function but seems a very sensible addition especially as there will be at least one ADC free.

I've now got a little more info which wasn't available when I posted. A colleague gave details of the motor I mentioned but it transpires it is a pump which may or may not be the one that will actually be used. It will be either a pump or compressor (he's not sure yet) and it is expected to only run for a couple of seconds at a time (no idea why). I don't have any more details yet but I'll update when I do. His initial request was to just switch the DC motor I mentioned on and off but like most things it's rarely that easy..:).

I'd be very interested in the circuit you mentioned if you are kind enough to share. There isn't any great hurry in this as my colleague still needs to establish which pump he will use and how long it will run for etc.

Thanks again for the advice.

Regards

chipfryer27
Valued Contributor
Valued Contributor
Posts: 786
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 187 times
Been thanked: 205 times

Re: Controlling a DC Motor

Post by chipfryer27 »

Hi

It will be a 12vDC 5W pump that will be controlled and it will be switched on/off for around five to ten seconds at a time, perhaps once or twice every ten minutes or so. AC/DC power pack he intends using is rated at 3A @ 12v. Apparently he has a few of these kicking around and will make use of them wherever he can.

I don't expect too much in the way of problems.

Regards

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Controlling a DC Motor

Post by medelec35 »

Sorry for the delay.
The Motor I used was much more powerful than 5W, but the circuit I used gives you the idea:
DC Motor Control.png
(46.47 KiB) Downloaded 1284 times
Martin

chipfryer27
Valued Contributor
Valued Contributor
Posts: 786
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 187 times
Been thanked: 205 times

Re: Controlling a DC Motor

Post by chipfryer27 »

Hi

Thanks for the circuit. Definitely going to incorporate the current sensing as you suggested earlier, even though it transpires I'm only using a modest motor. I'd kinda hoped, by his initial blabber, that it would be more Tonka Toy than Matchbox...:)

Regards

Post Reply