Discussion in "8051 Discussion Forum" started by    dstarke    Oct 22, 2007.
Mon Oct 22 2007, 07:10 AM
Thanks for the forum!

I have never implemented PWM before, and as such have no idea of what values for on/off times are a good starting point. I am trying to vasy the speed of a 12VDC fan using a MOSFET (IR540N) via a 7406 level shifter driven by an ATM89C55WD port pin. I think I would like to drive a counter externally with a 500 uSec pulse, and use it as the quanta for the interrupt to create on/off pulses. Is this too fine grain? What would be a reasonable nominal cycle time? 20mSec? Like I said, I have no real handle on the basic cycle time or what would be a reasonable minimum on time.

I can't figure out the formula for #levels vs min on-pulse vs cycle time vs Fan V+. Unless I am mistaken the fan speed is directly related to the fan-v+ and the integral of the on-pulses. Is it advantageous to use a larger fan V+ (like 15V for example) to provide more control?

I am writing the code in C (Keil) but can just as well use assembly (a small learning curve there).

Thank you in advance for yout kind input, and RTM is greatfully received if you can direct me to the relevant manuals.


Mon Oct 22 2007, 08:45 AM
well i never took PWM this serious

Lets just discuss the factors one by one.
first Fan V+ - It will increase the speed of motor and if its higher than the maximum rating of fan then it can ultimately burn the coil. So i Whatever voltage you use keep it <= max rating.
the more important is the current being supplied to the coil. That should be enough to generate sufficient torque. here also.. keep the current less than the max rating.

Now talking about the minimum pulse time.. i say.. there is no specific, it depends on the motor how fast it reacts to the change in polarity of the voltage. So all you can do is experimenting..
What i did was.. used timer in Mode 0 and varied the value to be loaded in THx of the timer..
lets say..
if THx is loaded with a value X when Pulse is ON or high, then THx should be loaded with value 255-X when Pulse is OFF or how.

I found that there is no directly proportional change in the speed vs the loaded value, rather there is a parabolic change in the speed.. i mean.. variation in o/p at higher values are pretty close to each other than the lower values.

So you might need to do experimentation according to the components you use and value you load. PWM seems difficult but its not so difficult.. its just need some experimentation thats all... So give it a try..

I cannot see your circuit too clear but as per the parts you mentioned the circuit seems to be ok. you have connected all the things necessary. As you are just sinking the current so just a normal NPN can also be used in place of that MOSFET. but make sure of the current and voltage that can be handled also heat sink if necessary.

regarding the code.. you can try working on it but there is also an assembly code posted by me in the forum "Project Doubt" with topic name temperature controlled fan.. if you want to see it then you can take it as a reference.

Get Social


Powered by e107 Forum System


Thu Jun 11 2020, 06:27 AM
sir could please send the code for I2C and wifi interfacing with 8051
Tue May 19 2020, 10:29 PM
Does anyone have microcontroller programming software for STC15F104W (core 8051, 4 k, 128 byte, 6 I/O pin, UART ... DIL8), that works?
Sat May 02 2020, 07:38 PM
Tamu Gurung
Hi I am looking for a assembly language program for a digital decimal counter. Time counts max limit of 2 mins starting from 2.00 mins and ending at 0.00. time is to be displayed on 4 7-segment LED displays. Edsim51 simulator to be used. Thanks
Wed Mar 25 2020, 01:39 PM
Sir kindly send the code file i2c for 8051
Fri Mar 13 2020, 10:36 PM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 12:55 PM
how can get hadwere of this project
Sat Mar 07 2020, 05:11 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 04:58 PM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?
Sat Feb 01 2020, 10:12 AM
Pearl Olin
Wed Jan 22 2020, 06:16 PM
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.



Thu Jun 25 2020, 03:46 PM
Mon Jun 22 2020, 03:03 PM
Tue Jun 16 2020, 05:10 PM
Sat Jun 13 2020, 09:43 PM
Thu May 21 2020, 12:44 PM
Thu May 21 2020, 01:28 AM
Wed May 20 2020, 07:05 PM
Wed May 20 2020, 11:52 AM


Guests: 35, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38215
Newest member: Mirza123
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 01 2020, 11:07 PM
PS: I am a new learner thats why my question may s...
Mirza123 Avatar
Posted By Mirza123
Wed Jul 01 2020, 02:05 PM
Thanks for the assistance. I have read the data sh...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 01 2020, 10:12 AM
See section 15 (Ports) of the data sheet. ...
wimac Avatar
Posted By wimac
Tue Jun 30 2020, 10:05 AM
How did you know that it is not 8051. Mirza123It i...
Mirza123 Avatar
Posted By Mirza123
Tue Jun 30 2020, 08:39 AM
It seems ports on the AT89LP2052 is not like on th...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jun 30 2020, 08:34 AM
It seems ports on the AT89LP2052 are not like on t...
Mirza123 Avatar
Posted By Mirza123
Thu Jun 25 2020, 04:07 PM
Hello!i am trying to use AT89LP2052 ( AT89LP2052 h...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jun 17 2020, 09:42 PM
It is about capacitor? i should put it between Vcc...
cerouno Avatar
Posted By cerouno
Wed Jun 17 2020, 10:37 AM
Take another look at the power supply to the LCD.A...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jun 17 2020, 02:01 AM
Take another look at the power supply to the LCD.A...