51 single chip intelligent electric fan control system proteus simulation design (simulation + program + schematic diagram + report + explanation video)

51 single chip intelligent electric fan control system simulation design (proteus simulation + program + schematic diagram + report + explanation video)

51 single chip intelligent electric fan control system simulation design (proteus simulation + program + schematic diagram + report + explanation video)

Simulation diagram proteus7.8 and above

Program compiler: keil 4/keil 5

Programming language: C language

Design number: S0042

Explainer video

Simulation design of proteus intelligent electric fan control system based on 51 microcontroller

1. Main functions:

Use the knowledge you have learned to create a 51 microcontroller intelligent electric fan control system simulation design

(1) 3 independent buttons control "natural wind", "sleep wind" and "normal wind" respectively (the difference between the three is the stop time of the DC motor), and 3 LEDs show the difference.

(2) Each type of wind can be divided into 4 levels of wind speed adjustment according to the number of times the independent button is pressed, and 1, 2, 3, and 4 are displayed on the digital display tube.

(3) Design the overheating protection of the fan, and connect an external DIP switch to simulate the generation of overheating signal. When the DIP switch is turned off, the microcontroller detects an unstable state and the fan stops; when the DIP switch is closed, the fan continues to run.

(4) It has indoor temperature detection and display function.

Specific circuit implementation:

1. The four-digit digital tube displays the indoor temperature and fan gear. The first three digits display the temperature, and the last digit displays the fan gear.

2. Use DS18B20 to detect the temperature data and connect it to the P3.3 port of the microcontroller.

3. Natural wind, sleep wind, and normal wind gears are displayed through three LED lights, which are connected to P0.0, P0.1, and P0.2 respectively.

4. The overheating protection device is simulated by the DIP switch. The DIP switch is closed, the P0.3 port of the microcontroller is grounded, and the pin potential is pulled low. When the DIP switch is turned on, the pin potential is uncertain. If the microcontroller cannot detect the low potential, it will default to overheating.

5. Control the DC motor through L298, and use the oscilloscope to simulate the pulse width modulation PWM. The larger the duty cycle, the faster the fan rotates.

6. Four buttons control natural wind, sleep wind, normal wind and fan stop. Press the button to adjust the wind power in 4 levels: natural wind, sleep wind, and normal wind mode.

It should be noted that the 51 microcontroller chip in the simulation is universal. AT89C51 and AT89C52 are specific models of the 51 microcontroller, and the cores are compatible. Regardless of stc or at, the pin functions are the same and the program is the same. The chip can be replaced with 51 microcontroller chips such as STC89C52/STC89C51/AT89C52/AT89C51.

The following is a display diagram of this design information:

2. Simulation

Start simulation

Open the simulation project, double-click the microcontroller in proteus, select the hex file path, and then start simulation. The fan does not rotate when the simulation starts, and the gear button needs to be pressed to work.

img

The maximum speed of the fan rotation in the first gear is 14.5, the maximum speed in the second gear is 28.5, the maximum speed in the third gear is 41.5, and the maximum speed in the fourth gear is 55.6. The following are the simulation results of each mode in 4th gear.

Natural wind level 4, the temperature is 31 degrees, the maximum fan rotation speed is +55.6, the rotation interval is 0.2 seconds, the natural wind indicator light is on, the first three digits of the digital tube display temperature 31, and the last digit displays fan gear 4.

img

Sleep wind level 4, temperature 31 degrees, the maximum fan rotation speed is +55.6, the rotation interval is 0.8 seconds, the sleep wind indicator light is on, the first three digits of the digital tube display temperature 31, and the last digit displays fan gear 4.

img

Normal wind 4, the temperature is 31 degrees, the maximum fan rotation speed is +55.6, the rotation interval is 0.3 seconds, the normal wind indicator light is on, the first three digits of the digital tube display temperature 31, and the last digit displays fan gear 4.

img

Overheating protection

In any gear or mode, the dip switch is disconnected, the overheating protection mode is activated, and the fan stops rotating.

img

3. Schematic diagram

image-20230901231735067
Number of component models

Microcontroller AT89C51 1

Capacitor 10uf 1

Capacitor 30pf 2

Crystal oscillator 12MHZ 1

Resistor 10k 1

Button 4

Temperature sensor DS18B20 1

Driver L298N 1

Display LCD1602 1

Exclusion 10k 1

Digital tube 4 bit common cathode 1

Resistor 1k 1

DC motor 5V 1

LED yellow 3

Resistor 100 ohms 3

Pin header 2P 1

Capacitance 0.1uf 2

Capacitor 100uf 2

Voltage Regulator 7805 1

4. Program code

Use keil4 or keil5 to compile, the code has comments, and you can understand the meaning of the code in conjunction with the report.

img

Main function part code

sbit k1=P2^3;//按钮
sbit k2=P2^4;
sbit k3=P2^5;
sbit k4=P2^2;
sbit led1=P0^0;//LED
sbit led2=P0^1;
sbit led3=P0^2;
sbit out1=P2^6;//电机控制
sbit out2=P2^7;
sbit smg1=P3^4;//数码管
sbit smg2=P3^5;
sbit smg3=P3^6;
sbit smg4=P3^7;
sbit heat=P0^3;//过热

//数码管编码
uchar code smgduan[10]={
    
    0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar sec=0,time=0,mode=0;//系统变量
uchar miao=0,miao1=0,miao2=0,start=0;//间歇控制
uchar sudu=1;//档位
uchar wait=0;
uchar time1=0;
uchar bei=0;//暂停控制
uchar wendu=0;//温度
//延时
void delay(uint i)
{
    
    
	while(i--)
	{
    
    
		//输出pwm
		if(time1<99)
		 	time1++;
		else
			time1=0;
		if(start &&(miao<miao1))//启动
		{
    
    
			out1=1;
			if(time1<sudu*20)
			{
    
    
				out2=0;
			}
			else
			{
    
    
				out2=1;
			}
		}
		else //停止
		{
    
    
			out2=1;
			out1=0;
		}
	}
}
//主函数
void main()
{
    
    
	uchar k=0;
	out1=0;
	TMOD|=0X01;//初始化定时器
	TH0=0X3C;
	TL0=0XB0;	
	ET0=1;//打开定时器0中断允许
	EA=1;//打开总中断
	TR0=1;//打开定时器
	while(1)
	{
    
    		
		//按键检测
		if(!k1 &&(k!=1))//自然风
		{
    
    
			k=1;
			start=1;//启动
			led1=0;//指示灯
			led2=1;
			led3=1;
			miao1=3;miao2=1;
			if(mode!=1)
				mode=1;
			else
			{
    
    
				if(sudu<4)
					sudu++;
				else
					sudu=1;
			}
		}
		if(!k2 &&(k!=2))//睡眠风
		{
    
    
			k=2;
			start=1;//启动
			led1=1;//指示灯
			led2=0;
			led3=1;
			miao1=3;miao2=6;
			if(mode!=2)
				mode=2;
			else
			{
    
    
				if(sudu<4)
					sudu++;
				else
					sudu=1;
			}
		}
		if(!k3 &&(k!=3))//常风
		{
    
    
			k=3;
			start=1;//启动
			led1=1;//指示灯
			led2=1;
			led3=0;
			miao1=3;miao2=2;
			if(mode!=3)
				mode=3;
			else
			{
    
    
				if(sudu<4)
					sudu++;
				else
					sudu=1;
			}
		}
		if(!k4)//停止
		{
    
    
			start=0;
			led1=1;//指示灯
			led2=1;
			led3=1;
			mode=0;
		}
		if(k1 && k2 && k3)
			k=0;
		//显示
		P1=smgduan[wendu/10];smg1=0;delay(100);smg1=1;
		P1=smgduan[wendu%10];smg2=0;delay(100);smg2=1;
		P1=smgduan[sudu];smg4=0;delay(100);smg4=1;
	}
}

5. Design report

7508-word design report, including design block diagram, introduction, hardware design introduction, software design introduction, simulation debugging, summary and references.

img

6. List of design information contents

Material design materials include simulation, program code, explanation videos, functional requirements, design reports, software and hardware design block diagrams, etc.

0. Common usage problems and solutions – a must-read! ! ! !

1. Simulation

2. Program code

3. Functional requirements

4. Explanation video

5. Design report

6. Block diagram

7. Schematic diagram

8. Components list

9. Proposal report

10. Structure diagram

Altium Designer Software Information

KEIL software information

Proteus software information

Microcontroller learning materials

Defense skills

Common descriptions for design reports

Double-click the mouse to open and find more 51 STM32 Microcontroller Course Graduation Project.url

img

Data download link (clickable):

Guess you like

Origin blog.csdn.net/weixin_52733843/article/details/132632183