Controlling a DC motor by PWM at constant speed HELP PLEASE!

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
PeterLe
 
Posts: 3
Joined: Tue Oct 15, 2013 12:47 am

Controlling a DC motor by PWM at constant speed HELP PLEASE!

Post by PeterLe »

Hello !

I am trying to control a constant speed for DC motor.

I found that lesson 13 is very useful for my project.
http://learn.adafruit.com/adafruit-ardu ... s/overview

But I would like to attach a break to my motor to simulate a mechanical load.
So when,
- I set the constant speed by PWM ( for example 1200 rpm);
- I pull the brake (softly) and the motor will slow-down it's speed (for example 800 rpm).

My controller needs to increase the PWM length so that even with the load (the brake) the motor should run at 1200 rpm.

Can anyone help me how to attach the break to my motor and the code to control the constant speed for the motor.
Thank you very much!!!!

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling a DC motor by PWM at constant speed HELP PLE

Post by adafruit_support_bill »

There are many ways to create a load on your motor. But in order to control the speed you first need to measure the speed. One way to do this is with a hall-effect sensor and a magnet mounted on the output shaft of the motor. http://www.adafruit.com/products/158
You monitor the motor speed in your code by timing the rate of pulses from the hall sensor. When you detect that the motor is slowing, you can increase the PWM duty cycle to correct it.

PeterLe
 
Posts: 3
Joined: Tue Oct 15, 2013 12:47 am

Re: Controlling a DC motor by PWM at constant speed HELP PLE

Post by PeterLe »

Thank you very much for your fast response :)
Below are 2 questions:
1. So for the break part, can i use a potentiometer?
2.
One way to do this is with a hall-effect sensor and a magnet mounted on the output shaft of the motor.http://www.adafruit.com/products/158
I am just a sophomore student, I have no idea about this, could you be more specific, it will be best if you could give me a schematic.
Thank you very much.

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling a DC motor by PWM at constant speed HELP PLE

Post by adafruit_support_bill »

1. So for the break part, can i use a potentiometer?
Typical potentiometers are not designed to dissipate significant power. You would need a rheostat. But that is only going to limit the voltage to the motor. That is not quite the same as applying a braking force or load. If you want to create a load to demonstrate your speed control, you need to do it mechanically. You could mount a wheel to the output shaft and apply some friction. Or use a pulley system to lift a weight.
could you be more specific, it will be best if you could give me a schematic.
It is not as simple as a schematic. There are mechanical considerations of where and how to mount the magnet and sensor. The manufacturer's application notes are linked from the product page and have lots of detail about how to use these sensors.
http://www.melexis.com/prodfiles/0003715_hallapps.pdf

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Controlling a DC motor by PWM at constant speed HELP PLE

Post by zener »

I would suggest something like a bicycle brake. So you could put a disc on the motor shaft and have a little clamp with some friction material on it, maybe felt or something. Then tighten it a little and it will slow down the rotation. If the motor is small then it will not take much drag to slow it down. Another device similar to a hall effect switch is a reed switch. This works just like a regular switch except it is activated with a magnet. Like this:

http://www.radioshack.com/product/index ... d=12706326

or this

http://www.adafruit.com/products/375

Radio shack used to stock things like this.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Controlling a DC motor by PWM at constant speed HELP PLE

Post by adafruit_support_rick »

I think a simple reed switch would float at 1200rpm. A Hall sensor would work better.

PeterLe
 
Posts: 3
Joined: Tue Oct 15, 2013 12:47 am

Re: Controlling a DC motor by PWM at constant speed HELP PLE

Post by PeterLe »

Thank you Zener and Rick.
I will try to build it and I will update my progress. :D :D :D

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Controlling a DC motor by PWM at constant speed HELP PLE

Post by zener »

adafruit_support_rick wrote:I think a simple reed switch would float at 1200rpm. A Hall sensor would work better.
That might be true. We used to use this one:

http://www.hamlin.com/specsheets/59060.pdf

It has stated operate and release times of 1.0ms. I am not sure exactly how those are defined. It might not get to 1200 RPM. A photo interrupter might be a good solution also.

http://www.mouser.com/ds/2/365/GP1S094H ... 181193.pdf

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”