Back to homepage 🏠

Circuit design for taking the quilt automatically via STC89C51 single chip microcomputer

Circuit design for taking the quilt automatically via STC89C51 single chip microcomputer
2014-06-20 · 10 min read
  • Abstract:In this paper, the design and development of Based on SCM automatic sun close quilt devices. Drying apparatus automatically receive quilts control module consists of two parts, one light control chip control module, is a motor control module, there is a mechanical conduction module.

  • Key Words:MCU, light control sensor,sun close quilt,rack and pinion

The basic content of the research

Basic content

The main research directions are circuit and mechanism, which need a lot of time and experience.

The mechanical part adopts rack and pinion transmission to drive the extension or retraction of the device.

The circuit control part obtains the induction signal through the photosensitive sensor, and then controls the forward and reverse rotation of the motor. We start from the control circuit, and use the signal collected by the light control sensor to transmit to the system processing core MCU STC89S52. According to the light intensity at that time, we can judge whether we want to take it back. When the relative humidity in the air exceeds the set value (it is considered that it is going to rain or it has rained) or the light turns dark to a certain value (it is considered that it has been dark), the system will automatically send a signal to the motor, so as to control the automatic recovery device of the mechanical part.

Circuit design for taking the quilt automatically via STC89C51 single chip microcomputer

Motor module

The motor module is composed of four parts: motor 57byg250-76, control driver, switching power supply and coupling. The switching power supply changes 220 V AC into 12 V DC to provide power for the control driver. The control driver is connected with the single-chip microcomputer. The single-chip microcomputer sends out the command, which controls the motor 57byg250-76 to send out the action and complete the target action

First of all, we start from the control circuit. We use the signal collected by DS18B20 temperature sensor, rain sensor and photosensitive resistance to transmit to the system processing microcontroller AT89S52. According to the temperature, humidity and light intensity at that time, we can judge whether the clothes rack should be taken back. When the relative humidity in the air exceeds the set value (think it will rain or it has rained) or the light becomes dark to a certain value (think it has been dark), the system will automatically send a pulse signal to the stepper motor, so as to control the mechanical part to automatically retract the clothes rack. The control circuit is characterized in that the control circuit comprises a single chip microcomputer and a rain sensor module connected with it, a motor driving module, a qualitative photosensitive sensor module, a switch positioning module, a temperature and humidity display module and a quantitative photosensitive sensor module, and a power supply is connected with the above modules and a single chip microcomputer to supply power for the control circuit. [9] According to the above working principle and design ideas, we first completed the framework design of the whole system, and completed the circuit design diagram of several core parts as follows:

As shown in the temperature detection circuit diagram, DS18B20 pin GND is the power supply ground, DQ is the digital signal input / output terminal, and VDD is the external power supply access terminal. In this system, external power supply is used, DQ is connected to t2.0 terminal of at89b52, R1 is the pull-up resistance between signal and 5V power supply. When the DS18B20 receives the temperature signal, it transmits the signal from the DQ end to the MCU, which makes a series of judgments according to the signal. The generated pulse signal is output through P2 port (p2.0, p2.1, p2.2, p2.3, P2.4, p2.5) and sent to the driver chip L298N to process the corresponding pulse signal and drive the stepper motor to rotate. Rain sensor is the focus of this design, the design uses multi-point When there is rain, the WY resistance of rain sensor becomes smaller. At this time, the 5-pin voltage of comparator is higher than the 4-pin voltage, and the 2-pin output high level. The high level is collected by the single chip microcomputer P1.2, and the control output is judged by the program, so that the clothes hanger can automatically retract. When the weather is fine, the WY resistance of rain sensor becomes larger. At this time, the 5-pin voltage of comparator is lower than 4-pin voltage, and the 2-pin output low level. The MCU P1.2 collects the low level, and the program judges and controls the output, so that the clothes hanger can automatically extend

System hardware module

Product circuit module

STC89C51 is used as the core chip to control the operation of the system. The basic principle is as follows: first, when the light intensity is greater than the reference value set by the light control sensor, the light control sensor outputs "0" to the P1.0 pin of STC89C51. After receiving the signal, the MCU responds and outputs high and low levels to P1.1 and P1.2. The output signal is connected to the motor drive module for voltage stabilization and output to the motor, and the motor rotates forward; when the light intensity is less than the light control sensor, the motor rotates forward When setting the reference value, the light control sensor outputs "1" to the P1.0 pin of STC89C51. After receiving the signal, the MCU reacts and outputs low and high levels to P1.1 and P1.2. The output signal is connected to the motor drive module for voltage stabilization, and then output to the motor, and the motor reverses. Use the positive and negative rotation of the motor to control the operation of the mechanical part.

MCU module

Use STC89C51 to control the motor drive.

Motor voltage regulator module

Considering that the voltage directly output by MCU is not stable, it can not be directly connected to the two pins of the motor, because the voltage regulator module is used to control the output voltage.

Schematic diagram of overall circuit

Product mechanical module

The internal component module mainly includes the following parts: the board part for placing objects, the card slot for controlling the track of the board, the gear and the rack part. Among them, the gear is connected with the motor part. When the power is supplied to the motor, the gear rotates to drive the rack and the board to move, so as to achieve the function of extending or retracting the board and realize the drying and retracting. In addition, the circuit board is fixed on the right side of the device to save space. A small hole is opened on the top left of the shell of the product for the photosensitive sensor to extend and sense the strength of sunlight.

Software part

Bread board welding STC89C51 single chip microcomputer

The overall construction of demo

Originally planned to use 3D printing to achieve, but later due to the high cost of printing, so the use of cardboard to build a demo to experiment

Software program code

First of all, when the light intensity is greater than the reference value set by the light control sensor, the light control sensor outputs "0" to the P1.0 pin of STC89C51. After receiving the signal, the MCU reacts and outputs high and low levels to P1.1 and P1.2, and this process is maintained for 3 seconds. The output signal is connected to the motor driver module for voltage stabilization, and is output to the motor, and the motor rotates forward When the light control sensor sets the reference value, the light control sensor outputs "1" to the P1.0 pin of STC89C51. After receiving the signal, the microcontroller reacts and outputs low and high levels to P1.1 and P1.2, and this process is maintained for 3 seconds. The output signal is connected to the motor drive module for voltage stabilization, output to the motor, and the motor reverses. Use the positive and negative rotation of the motor to control the operation of the mechanical part.

#include<reg52.h>
typedef unsigned int uint16;
sbit in = P1^0;
sbit a = P1^1;
sbit b = P1^2;
void delayus(uint16);
void delayms(uint16);
void main()
	{	
		while(1)
		{  
			 if(in==1)
				{	
					a = 1;	b = 0;
					delayms(1000);
					a = 0;				
					b = 0;
					while(in==1);													
                    }
			else if (in==0)
				{
					a = 0;
					b = 1;
					delayms(1000);
					a = 0;
					b = 0;
				    while(in==0);	                                                                                                                           
				}
            }
	}

void delayus(uint16 t)
	{   
	 	while(--t);
	}

void delayms(uint16 t)
	{
		     
		 while(t--)
			 {
			     delayus(245);
				 delayus(245);
			 }
	}
Copyright © Hanlin Dai 2021