Design of automatic spraying machine based on PIC microcontroller

Publisher:数字翻飞Latest update time:2011-10-24 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

At present, my country's artificial breeding industry is developing rapidly. However, the breeding methods are very backward. Most of them still use the traditional manual feeding method, which is time-consuming and material-consuming, unevenly fed, and not far away, which is not convenient for scientific breeding at a fixed time and quantity. This paper introduces a circuit design of an automatic feed sprayer in a fish pond. It has been proved in practice. The automatic feed sprayer can not only spray feed at a fixed time and quantity. Moreover, the feed is sprayed evenly and at a long distance, which can significantly save feed and greatly improve the breeding efficiency.

2 Hardware design of automatic spraying machine

In fish farming, most of the time, feed needs to be sprayed in the morning, noon and evening, and each spraying time is about two to three hours. Feed spraying is carried out intermittently by spraying for tens of seconds and stopping for tens of seconds. The specific number of times a day to spray feed, the length of spraying time, and the length of spraying stop time vary depending on factors such as fish species, feed species, fish breeding density, environmental climate, etc., and can be set by the user according to specific circumstances. In order to realize the above automatic control, this design uses a circuit with PIC microcontroller as the core, equipped with a power module, button display, clock circuit, and drive control (including spray direction control. Spray distance control, spray amount control) to form a complete system.


2.1 Design of power module

After the 220 V AC is stepped down and rectified and filtered, a +24 V DC voltage is obtained to supply power to the drive control circuit; after the +24 V DC is stabilized by 7805, it supplies power to the button display and other circuits; when the main power supply is powered, the main power supply supplies power to each circuit and charges the backup power supply (3.6 V rechargeable battery); when the main power supply is powered off, the backup power supply supplies power to the PIC microcontroller and the clock circuit to maintain normal timekeeping and save the preset information, while the display and drive control circuits stop working. The analog voltage input to the RA5 port of the PIC microcontroller is converted by A/D. If the conversion value is less than 154 (the corresponding analog value is 3 V), the microcontroller enters the low power consumption mode, at which time it is powered by the backup battery, only ensuring normal timekeeping and saving the preset information, and the button display and drive control circuits stop working. In this case, the circuit consumes only tens of microamperes of current.
2.2 Clock Circuit Design
This system requires relatively accurate time, so a hardware timing circuit is needed. The circuit is mainly composed of the 16-bit timer counter TMR1 inside the PIC microcontroller and the external 32.768 kHz crystal oscillator circuit. TMR1 works in the counting state. Every time the count reaches 16 384, a half-second (for the convenience of flash programming) interrupt output is generated for accurate timing. This method has a simple circuit, convenient programming, and accurate timing. In the low power state, TMR1 can work normally. Every time TMR1 overflows, it wakes up the microcontroller to detect whether there is a main power supply. If there is a main power supply, it will switch from the low power state to the normal working state.

2.3 Design of key display circuit

The key display circuit has 12 keys and 4-digit digital tubes, 2 second flashing LEDs and 8 status indicator LEDs. The status indicator can also be used for dynamic scanning display of 1-digit digital tube and other 4-digit digital tubes to save I/O ports. The 12 keys are designed as a 2×6 key matrix and share the I/O port with the scanning display segment, making full use of the I/O port resources of the single-chip microcomputer. At the same time, in order to avoid the mutual influence of the keys and dynamic scanning display, a diode (IN4148) is added for isolation. The functions of the 12 keys are setting key, right shift key, up key, down key, maximum spray distance plus key, maximum spray distance minus key, spray amount plus key, spray amount minus key, spray direction left and right position detection key, spray amount maximum and minimum detection key. The 8 status indicator lights indicate: setting time state, setting total spray time state, setting the first, second, third and fourth spray time state, setting the continuous spray time length state during spraying, and setting the pause time length state during spraying.

2.4 Design of drive control circuit

The drive control circuit is the focus of system design. The direction and amount of feed spraying involve the motor rotation direction control and left and right turn detection, while the spraying distance involves the motor speed control.

2.4.1 Spray direction control circuit

Since the sprayer is installed on the bank of the fish pond, in order to spray the feed evenly into the fish pond, the spraying direction is required to rotate continuously. That is, from left to right, then from right to left, and so on. The spraying direction is driven by a small DC motor with a power of several tens of watts. This circuit uses power tubes to form a bridge structure to control the forward and reverse rotation of the motor, and cooperates with two travel switches (buttons in the circuit) to detect whether it has rotated to the limit position to avoid the motor from continuing to work after rotating to the limit position, thereby damaging the motor or mechanical device. When I/O1 and I/O2 are 00, the four power tubes Q6, Q7, Q1O, and Q11 are all cut off, the voltage applied to the spraying direction motor is 0, and the motor does not rotate. When I/O1 and I/O2 are 01, Q7 and Q11 are turned on and Q6 and Q10 are turned off. When I/O1 and I/O2 are 10. Q7 and Q11 are cut off and Q6 and Q10 are turned on. In these two cases, the current flowing through the spraying direction motor is opposite to each other, and the motor rotates in the opposite direction. When I/O1 and I/O2 are 11, the four power
tubes Q6, Q7, Q10, and Q11 are all turned on, and the +24 V power supply goes to the ground through Q7, Q11, Q6, and Q10. At this time, the motor does not rotate, but when Q6, Q10, Q7, and Q11 are turned on, the internal resistance is very small, and the current flowing through is very large, which will damage the power tube. It is in a prohibited state.

2.4.2 Spraying volume control circuit

The demand for feed quantity of fish varies with fish species, breeding density, environmental climate and other factors, so the amount of feed sprayed must be controlled and set by the user according to different situations. Its working principle is that a small power reduction motor drives the size of the feed box opening. The motor works forward and reverse with the cooperation of the forward and reverse limit position detection button. Its circuit principle is the same as the control circuit of the spray direction.

2.4.3 Spray distance control circuit

In order to spray the feed evenly into the pond, not only the spraying direction must be rotated left and right, but also the spraying distance must be changed from near to far or from far to near. The maximum spraying distance can be set according to the size of the pond. The spraying of feed is completed by blowing compressed air. The spraying distance is determined by the speed of the compressed air, and the speed of the compressed air is determined by the motor speed. The single-chip microcomputer outputs a PWM signal, and the duty cycle of the signal determines the motor speed. The larger the duty cycle, the faster the motor speed, and vice versa. Therefore, this control method is simple and practical and can meet the design requirements.

3 Software Design

The system software adopts modular design, and is supplemented by measures such as watchdog, software trap, and software redundancy to improve the reliability of system operation.

In order to facilitate modification, the system software is completed by multiple people. It is divided into real-time clock module, key scanning module, scanning display module, normal working module, time setting module, spraying time setting module, first, second, third and fourth spraying time setting module, continuous spraying time setting module, and pause time setting module. The main program adopts scattered transfer structure to facilitate modification and improve program operation reliability.

4 Anti-interference design

The system has three motors working, which will generate strong electromagnetic interference. These interference signals are likely to cause abnormal phenomena such as system crash, program chaos, and damage to system parameters. Therefore, some anti-interference measures are taken in both hardware and software.
4.1 Anti-interference

The power input of the control system is connected to the power filter to filter out the high-order harmonics and pulse interference in the power grid. When selecting a single-chip microcomputer, choose a model with a hardware watchdog, or use an external watchdog circuit to effectively monitor the program from falling into an infinite loop fault. A 0.1μF decoupling capacitor is connected in parallel to the power input and common ground ends of each device. When wiring the PCB board, pay attention to separate wiring of digital ground and analog ground, and high-current power lines should be wired separately. The blank space of the PCB board should adopt a large area of ​​copper cladding design.

4.2 Software Anti-interference

First, software redundancy. Any output signal and setting are refreshed repeatedly, and the cycle is set to 4 ms. This can effectively avoid interference signals from interfering with key data such as output signals and settings.

Second, software traps. Software trap technology is to forcibly introduce the captured flying program to the reset address 0000H through jump instructions, so that the program can be put on the right track. Setting software traps between program modules and unused program spaces can effectively suppress program flying and make program operation more reliable.

5 Conclusion

The automatic spraying machine has started mass production. Users have reported that the machine not only meets the functional requirements, but also has high reliability, low failure rate and good use effect.

Reference address:Design of automatic spraying machine based on PIC microcontroller

Previous article:Application example of AT88SC1604 card controlled by single chip microcomputer
Next article:Application of STC MCU Expanding P4 Port

Latest Industrial Control Articles
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号