Single chip microcomputer fan simulation control system

Publisher:WhisperingWaveLatest update time:2020-03-04 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

The principle of single-chip microcomputer is widely used. According to the requirements of the single-chip microcomputer principle and application course, two aspects of design are mainly carried out, namely the single-chip microcomputer minimum system and memory expansion design, and interface technology application design. Among them, the single-chip microcomputer minimum system mainly requires students to be familiar with the internal structure and pin function of the single-chip microcomputer, the use of pins, reset circuit, clock circuit, 4 parallel interfaces and the practical application of a serial interface, so as to form a minimum application system and program it for simple use. The electric fan simulation control system has the advantages of simple circuit, low cost, convenient operation, sensitivity and reliability, etc. It has good results after use, has high promotion value, and has a wide range of applications in many fields.


This paper designs an electric fan simulation control system with STC89S52 single-chip microcomputer as the core, and adopts the design idea of ​​LCD1206 direct indication, display status, and automatic reset. It can generate different output signals corresponding to the input signals according to the signals input by the keys, and finally display the corresponding status through LCD1206, which respectively displays the current real-time temperature of the motor and the current wind speed, making full use of the characteristics of the single-chip microcomputer system with simple structure, powerful functions, good reliability and strong practicality.


1. Solution Design

1.1 Introduction

I first designed the hardware circuit, which fully embodies the idea of ​​modularization and is mainly composed of the following modules:

  • STC89C52 single-chip microcomputer minimum system;

  • Button module: There are six buttons in total, three of which control the wind speed, and two control the motor's shaking and sleep timer functions;

  • LED indicator module: There are four green LED indicators, indicating the fan motor operating status, natural wild, ordinary wind, sleep wind, no wind

  • Motor temperature real-time measurement module: This system uses DS18B20 to measure the real-time temperature of the motor

  • Motor drive module: This system uses LM298N integrated driver chip to drive the motor to rotate

  • LCD display module: This system uses LCD1206 module to display the real-time status of the electric fan


1.2 Course Design Purpose

(1) Complete this course design based on the theoretical knowledge learned from courses such as microcontroller principles and interface technology;

(2) Learn and master basic circuit design and usage methods, and microcontroller programming and application methods;

(3) Improve the ability to conduct comprehensive analysis and solve practical problems.


1.3 Tasks and requirements

This design uses the STC89C52 processor as the core, and the single-chip microcomputer as the peripheral detection and control circuit design to realize the smart home system. The single-chip microcomputer system detects relevant information through sensors and sends corresponding information to the embedded platform. The embedded platform makes corresponding judgments and processing, and at the same time informs the owner and property management personnel through the network to make corresponding processing to ensure the property and personal safety of the owner.

The main design indicators of this design are:

  • Key input module, 4 keys to adjust "sleep wind", "natural wind", "normal wind" and "no wind" respectively

2 buttons control "shaking head" and "timing" respectively;

  • DC motor speed control, driven by LM298N chip;

(3) The current speed and motor temperature are displayed, and the status is displayed on the LCD.


2. Hardware circuit

2.1 Circuit system block diagram


2.2 STC89C52RC minimum system

2.3 Button Module

TIME BUTTON: Time button

SHAKE BUTTON: Shake button

NATURAL WIND Natural wind button

ORDINARY WIND Ordinary wind button

SLEEP WIND sleep wind button


2.4 LED indicator module

NATURAL WIND Natural wind indicator

ORDINARY WIND Ordinary wind indicator light

SLEEP WIND Sleep wind indicator light

NO WIND No wind indicator


2.5 Motor temperature real-time measurement module

Using DS18B20 to measure the real-time temperature of the motor


2.6 Motor drive module

Use LM298N driver chip to drive two DC motors


2.7 LCD Display Module

Use LCD1206 output to display the current status


2.8 Buzzer alarm module


3. Software Program 3.1 Main Function Program Flowchart

3.2 Keyboard Module Driver

#include "head_file.h"


sbit Natural_wind_button =P2^0;

sbit Ordinary_wind_button =P2^1;

sbit Sleep_wind_button =P2^2;


sbit Time_button =P3^6;

sbit Shake_button =P3^7;


void BUTTON_Config()

{

                                          Natural_wind_button = 1;  

      Ordinary_wind_button = 1;            

      Sleep_wind_button =1;


                                          Time_button = 1;

                                          Shake_button = 1;

}            


3.3 LED indicator driver

#include "head_file.h"

sbit Natural_wind_LED =P2^3;

sbit Ordinary_wind_LED =P2^4;

sbit Sleep_wind_LED =P2^5;

sbit NO_Wind_LED =P2^6;

sbit Buzzer =P0^3;

void GUIDE_Led_Config()

{

                                          Natural_wind_LED = 1;            

      Ordinary_wind_LED = 1;

      Sleep_wind_LED = 1;            

            

      NO_Wind_LED = 0;              

                                         

                                          Buzzer = 0;

}


4. Debugging results

  • summary

     After nearly a week of single-chip microcomputer course design, I finally completed the design of the electric fan simulation control system. Although it did not fully meet the design requirements, I still gained a lot. Through this course design, I became more familiar with the working principle of single-chip microcomputer chips and their specific usage methods. The focus of single-chip microcomputer course design is on the design of software algorithms, which requires very clever program algorithms. This has trained my ability to think independently and the habit of solving problems by looking up relevant materials. I also learned about the general steps of course design and the issues that should be paid attention to in the design.


    Course design requires each of us to do it attentively, seize the opportunity to learn, and combine theory with practice by consulting more information. When doing simulation, using what you have learned in your daily life and the guidance of teachers to students, you can experience the pleasure of seeking knowledge in unlimited exploration. When you make a work or a simulation experiment is successful, you can always feel that the fruits of labor are hard-won. While designing the course, I not only exercised my hands-on and brain-power abilities, but also broadened my knowledge. I am grateful to myself and the hard-working teachers.


I would like to thank the teacher for giving me such an opportunity to exercise. During the whole design process, I learned a lot of things, and also cultivated my ability to study and work independently. I established a good learning attitude and humbly asked for advice. I believe it will have a very important impact on my future study, work and life. It also greatly improved my hands-on ability, allowing me to fully experience the difficulties of exploration and the joy of success in the creative process. Although this project still has some shortcomings, what I learned during the design process is the biggest gain and wealth of this design, and I really benefited a lot.


Appendix 1: Overall Circuit Simulation

Appendix 2: Program List
Main.c //Main function
Button.c //Button driver program
ds18B20.c //ds18b20 driver program
guide_led.c //LED indicator initialization program
L298n.c //l298n driver program
Lcd1206.c //lcd1206 driver program
head_file.h //All header file declarations

Appendix 3: Component List
STC89C52RC microcontroller
1
touch switch
6
green LED lamp beads
4
12v DC motors
2
LM298N chips
1
DS18B20 sensor
1
LCD1206
1
1K chip resistor
4
4.7K chip resistors
1
100R resistor
2
motor driver programs

#include "head_file.h"

uchar t0, add0;

uchar t1,add1;

sbit EN0=P3^4;

sbit EN1=P3^5;


sbit IN0=P3^0;

sbit IN1=P3^1;

sbit IN2=P3^2;

sbit IN3=P3^3;


void L298_Config()

{

                 t0=50;

                 t1=50;

                 IN0=0;

                 IN1=1;

                 IN2=0;

           IN3=1;


}


void TIM_Config()

{

                TMOD = 0x11;

    TH0 = (65536-50000)/256;;

    TL0 = (65536-50000)%256;;

    ET0 = 1;

    TR0 = 1;


                TH1 = (65536-50000)/256;;

                TL1 = (65536-50000)%256;;

                ET1 = 1;

    TR1 = 1;


                EA = 1;

}


void TIM0() interrupt 1

{

                         TH0=(65536-50000)/256;

       TL0=(65536-50000)%256;


       if(add0==100)

       {

            add0=0;

                                                EN0=1;

       }

       if(add0==t0)

       {

                                                EN0=0;

       }

                         add0++;

}


void TIM1() interrupt 3

{

                         TH1=(65536-50000)/256;

       TL1=(65536-50000)%256;


       if(add1==100)

       {

            add1=0;

                                                EN1=1;

       }

       if(add1==t1)

       {

                                                EN1=0;

       }        

                         add1++;  


Reference address:Single chip microcomputer fan simulation control system

Previous article:Example of sending characters via 51 MCU serial port
Next article:Simple STC15F104E MCU Timing Alarm Production

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号