# pwm to control a dc motor

Discussion in 'Sensors and Actuators' started by mariomoskis, Mar 14, 2012.

1. ### mariomoskis

82
0
Mar 13, 2012
Hello, i am trying to control a dc motor( 3V) with a CI 555 and one transistor 2N2222,so when i change the value of my pot the speed of my motor must change too.
the voltage which i have at the output of my 555 is Vcc-1

this is the circuit:
http://imageshack.us/photo/my-images/834/problemaph.jpg/

so i need to know the values of R and R1 to get the next:

transistor:
in saturation Vc=Vcc-3=Ve
in cut-off Vc=Vcc Ve=0V

somebody could help me?

thanks

2. ### jackorocko

1,284
1
Apr 4, 2010
What is the gain of the transistor?

This will tell you what you need for base drive current of the transistor. Then you can use ohms law and figure out the resistor value needed for R1. Why exactly are you using R?

Last edited: Mar 14, 2012
3. ### mariomoskis

82
0
Mar 13, 2012
the transistor has gain aprox β=222

and the motor can comsume until 0.3A

4. ### mariomoskis

82
0
Mar 13, 2012
R is for this:

i need R because i want the next at my transistor:

http://imageshack.us/photo/my-images/560/sinttulozgc.jpg/

and at the output of the 555 i always have Vcc-1, so i need R at the emisor of the transistor because in saturation(when my motor consume energy) i need fix Vcc-3,and get that the motor won´t have more than 3V

do you understand more or less? i don´t know so much english and it is difficult to explain this

5. ### jackorocko

1,284
1
Apr 4, 2010

The current gain of the 2n2222A is 40 @ 500mA Ic, refer to the datasheet here http://www.uib.es/depart/dfs/GTE/staff/jfont/InstrETT/2n2222.pdf

0.3A/40 = .0075A of base current needed. Double this number, because a little extra won't hurt.

so then you take the 555 output voltage, which you have it as 7V, using ohms law we get

7V/.015 = 466 ohms R1

I still don't understand why you need R. It will be in series with the motor so the overall resistance of that branch of the circuit will increase limiting current to the motor. Besides, using PWM will control how much voltage the motor sees.

Last edited: Mar 14, 2012
6. ### jackorocko

1,284
1
Apr 4, 2010
example: If you pulse 12V to a motor with a duty cycle of 60% on time, then the motor will only see 7.2V

Last edited: Mar 14, 2012
7. ### mariomoskis

82
0
Mar 13, 2012
then,how could i fix 3V in my dc motor in saturation? because the 555 need al least 4.5V of supply voltage,

so for example if i want Vcc=8V,in saturation i want to have Vc=Vcc-Vmotor=8-3=5V,so i need 5V at my emisor to get fix this 3V on my motor,yes?
so i though about put a resistor to get it,or maybe put a zener diode of 4.7V

because i want to fix 3V on my motor,and changing the duty cicle with my pot i would like to change the speed of the motor.
i don´t want to fix a duty cycle for one supply voltage,i want a supply voltage and can change my duty cicle from 0 to 100

i think that i need a voltage on my emisor in saturation to get this,i don´t know if this is possible?

Last edited: Mar 15, 2012
8. ### jackorocko

1,284
1
Apr 4, 2010
speed is directly related to the voltage seen by the motor. If you always put 3V across the motor it will run at the same speed regardless of anything else.

When you use PWM, the duty cycle ON time determines what voltage the motor sees. It is always a percentage of Vcc.

IE, if you have 12 Vcc, and the 555 has a duty cycle ON time of 25%, then the motor will see 3V across it. If you increase the ON time of the duty cycle the voltage the motor sees will increase as well as the speed the motor runs at. Don't know how to make it any clearer then that.

Last edited: Mar 15, 2012
9. ### mariomoskis

82
0
Mar 13, 2012
ah ok
so the motor sees the effective voltage, not the peak voltage?

then my mistake is that i am trying to fix the peak voltage and later change the effective with the duty cycle?

which formula relationed the effective voltage with the peak voltage for a pwm signal?

10. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,489
2,830
Jan 21, 2010
Set your max duty cycle to correspond to the motor voltage divided by the supply voltage.

There are limits as to how far you can go with this, but I suspect it will work fine in your case.

11. ### mariomoskis

82
0
Mar 13, 2012
sorry could you explain it more clear,i am new on this and it is little diffiucult at the beginning

the motor works from 1.5V to 3V and i want 3V, the supply voltage should be higher than 4.5V(minimun voltage which need the 555)

thanks

12. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,489
2,830
Jan 21, 2010
Let's say you run the circuit from 6V.

The max duty cycle should be 50% which will give an average 3V to the motor.

A duty cycle of 25% corresponds to approx 1.5V.

However you may find that the motor works at duty cycles significantly lower than 25%, even though the minimum voltage it will run successfully at is 1.5V.

13. ### mariomoskis

82
0
Mar 13, 2012
and are there a way to do it for example with duty cicle from 0 to 100%, or will i need more voltage range for my motor?

which formula are you using to relationed the duty cicle with the voltage which see my motor and Vcc?

Last edited: Mar 16, 2012
14. ### jackorocko

1,284
1
Apr 4, 2010
I would think the easiest way to get 0 to 100% duty cycle would be to use a uC aka, microcontroller with PWM output pins.

If you know the frequency of the square wave, then you can find the time period.

time period in Seconds = 1/freq

1/1000Hz = 0.001S

If you have a pulse of 12V and you need 4V seen by your load, then you need to find what percentage 12V is 4V

4V/12V = 0.3333333 = 33%

so now you need to take 33% of the time period

0.001 * .33 = 0.00033 = 330 microSeconds ON time

A 1kHz PWM square wave with an ON time of 330 microSeconds and OFF time of 670 microSeconds will deliver 4V to your load

Last edited: Mar 16, 2012
15. ### mariomoskis

82
0
Mar 13, 2012
but i refered for example this:

vcc=???
i fix 3V to 100% duty cycle
and i fix 1.5V to 0% duty cycle
so i would like to change the speed in a bigger range of duty cycle or something like that

not as i have now vcc=12V, 3V duty cycle 25%,1.5V duty cycle 0%

do you know what i mean? is it possible?

16. ### jackorocko

1,284
1
Apr 4, 2010
Yeah but I don't know why you would want to do that. It involves bringing Vcc down to 3V

Because a 100% duty cycle is ON. If you want to run your motor at 100% duty cycle then Vcc needs to be 3V. If you want 1.5V from 3, then you need a 50% duty cycle. Because a 0% duty cycle would be OFF

17. ### mariomoskis

82
0
Mar 13, 2012
yes i know,but if i would put a diode with fix value at the emisor,could i get it without Vcc=3V?

1,284
1
Apr 4, 2010
Nope.

19. ### mariomoskis

82
0
Mar 13, 2012
ok,thanks
the formula is for example for Vcc=6V:
3/6=sqrt(duty cycle) or 3/6=duty cycle??

and one thing more,now i will generate the pwm signal with a module ni9401(digital output) of compact rio,i don´t know if you know it,but it will generate a pwm signal 5V and it need current between[100microA to 2mA], i thought about the next circuit:

http://imageshack.us/photo/my-images/338/crio.jpg/

is it correct?
and the transistor has gain 40 and the motor load 0.3A so i will need al least 0.3/40=7.5mA at the base, but the digital output that i said you must be [100microA to 2mA]
how could i down this current more, maybe a voltage divisor?
do you understand what i mean?

thanks

20. ### jackorocko

1,284
1
Apr 4, 2010
From the datasheet is says that it will source/sink 100uA - 2mA. You will probably need more then 7.5mA to make sure the transistor goes into saturation. How exactly did you come up with 7.5mA???

The ni9401 will not give you what you want with a 2n2222A. You will need to find a transistor that has a higher gain, like a darlington pair. A mosfet(you may need a driver IC if using a mosfet) might be a viable option or use something other then the ni9401 to generate the square wave.

Last edited: Mar 17, 2012