当前位置:网站首页>51 MCU flowers, farmland automatic irrigation system development, proteus simulation, schematic diagram and C code
51 MCU flowers, farmland automatic irrigation system development, proteus simulation, schematic diagram and C code
2022-04-23 14:25:00 【Jiang Yuzhi】
The design requirements
1. Design a method based on 51 MCU flowers 、 Automatic farmland irrigation system ;
2. Able to detect soil moisture , When it is lower than the set lower limit , Start the water pump for irrigation , And provide corresponding audible and visual alarm indication ;
3. The upper and lower limits of humidity can be set by pressing the key ;
4. The soil moisture data and the upper and lower limits of moisture are passed LCD1602 The display shows ;
5. Complete the selection of system components 、 Circuit drawing and C Programming ;
System Overview
Design scheme of automatic watering irrigation system , With AT89C51 Single chip microcomputer is the control core , Using a modular design approach .
The components are :5V Power supply module 、 Soil moisture sensor module 、ADC0832 A / D conversion module 、 Water pump control module 、 Key input module 、LCD Display module and audible and visual alarm module , The structure is as follows .

Working principle is : The soil moisture sensor measures the analog signal of soil moisture , the AD The converter converts the analog signal into digital signal and then transmits it to 51 Single chip microcomputer , The single chip microcomputer compares the soil moisture data with the set upper and lower limits .
When the soil moisture is below the lower limit , Drive the water pump for irrigation , And provide audible and visual alarm . When soil moisture increases above the lower limit , The audible and visual alarm is off , But the pump will continue to work , Until the soil moisture continues to increase and exceeds the set upper limit .
The user can set the upper and lower limits of humidity by pressing the key , The soil moisture data and the upper and lower limit data are passed LCD The display screen shows in real time .


Schematic diagram

Simulation analysis
open Proteus Simulation file , Its suffix is .DSN. Double click the MCU , load AutoWater.hex file ( be located Keil C In the program folder ), Run the simulation , give the result as follows .

It can be seen from the picture that ,LCD Displays the currently measured soil moisture (Humidity) by 53%, The upper limit of humidity preset by the system (H:High Abbreviation ) by 60%, Lower limit (L:Low Abbreviation ) by 30%, The soil moisture is normal , Within the upper and lower limits .
here , Low humidity alarm light and buzzer are off , Relay RL1 Turn the switch to the bottom , The water pump is in a state of power failure .
By adjusting the sliding rheostat RV2( Click the two red arrows up and down with the mouse ), Change input to ADC0832 Sampling channels 0 To simulate the change of soil moisture .
Click on RV2 Downward red arrow , Simulate the reduction of soil moisture . for example , When the soil moisture changes from 53% Reduce to 23%, Below the lower limit 30% when , Red LED The warning lamp is on , The buzzer makes a sound , Relay RL1 Turn the switch to the top , The water pump is energized , Start automatic watering , The green water pump working indicator light is also on .

Click on RV2 The upward red arrow , Simulate the increase of soil moisture .
When the soil moisture changes from 23% Increased to 37%, When the lower limit is exceeded , The audible and visual alarm stops working , But the pump will continue to work , Until the soil moisture continues to increase above the upper limit , The process is as follows .


It should be noted that , The water pump stops working ( namely : Soil moisture exceeds the upper limit ) after , Adjust the RV2 Simulate the decline of soil moisture , When it falls within the upper and lower limits , The water pump will not start , Only when the soil moisture continues to drop below the lower limit will it start .
Press the key to preset the upper and lower limits of humidity .
Click on “ Set up ” key , Enter the upper and lower limit setting mode , First of all H The upper limit cursor flashes , At this point, you can click Add / Minus the key , Change the size of the upper limit .

After the upper limit value is set , Click on “ Set up ” key ,L The lower limit cursor flashes , Empathy , Click Add / Minus the key , Change the size of the lower limit .

After the upper and lower limits are set , Click again on the “ Set up ” key , Exit the upper and lower limit setting mode . for example , We set the upper limit of humidity H by 75%, Lower limit L by 25%, The results are shown in the following figure .

in summary , The simulation results meet the design requirements .
Part of the code
void main() // The main function
{
Init1602(); // Initialize the LCD function
init(); // Initialize the timer
init_eeprom(); // Start initializing the saved data
while(1) // Into the loop
{
for(m=0;m<50;m++) // read 50 Time AD value
sum = adc0832(0)+sum; // Read about AD value , Add the read data to the tired data sum
temp=sum/50; // Jump out of the top for After the cycle , Divide the total of the accumulation by 50 Get the average temp
sum=0; // After the average calculation is completed , Clear the total
temp = temp*0.390625; //ADC0832 Store data as 1 Bytes , The humidity display range is 0~100, therefore 1 Unit humidity =100/256=0.390625
// if(temp<=full_range)
// temp=(temp*100)/full_range;
// else
// temp=100;
if(set==0) //set by 0, It indicates that it is not in the setting state
Display_1602(temp,MH,ML);// Show AD Values and alarm values
if(temp<ML&&set==0) // The humidity value is less than the alarm value
{
flag=1; // Turn on the alarm
Relay=0; // The relay contacts are closed , Water pump operation
LED_R=0; // The red light is on
}
else if(temp>MH&&set==0) // The humidity value is greater than the alarm value
{
flag=0; // Turn off the alarm
Relay=1; // Relay contacts open , The water pump stops
LED_R=1; // The red light goes out
}
else
{
flag=0;
LED_R=1; // The red light goes out
}
Key(); // Call the key function
}
}
Information content
(1) be based on 51 Single chip microcomputer 、 Design of farmland automatic irrigation system ;
(2)Proteus Simulation file ;
(3)C Program files ;
(4) Schematic file ;
(5)Visio Flow chart file ;
(6) Reference material ;
(7) List of components ;
Data figure





Say the important thing again !!!
because 51 MCU flowers 、 The design of farmland automatic irrigation system is my original design , Get a full set of information ,
Please search to see my 【 Male 】( many *)“ Number ”: Jiaoyuan Xiaozhi
版权声明
本文为[Jiang Yuzhi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231412471741.html
边栏推荐
- Get the thread return value. Introduction to the use of future interface and futuretask class
- 51单片机的花卉、农田自动浇水灌溉系统开发,Proteus仿真,原理图和C代码
- ssh限制登录的四种手段
- 查找水仙花数-for循环实践
- 统信UOS PHP7.2.3升级至PHP7.2.24
- TUN 设备原理
- 差分隐私(背景介绍)
- LLVM - 生成for循环
- SHT11传感器的温度湿度监控报警系统单片机Proteus设计(附仿真+论文+程序等)
- 基于单片机的DS18B20的数字温度监控报警系统设计【LCD1602显示+Proteus仿真+C程序+论文+按键设置等】
猜你喜欢

Processing MKDIR: unable to create directory 'AAA': read only file system

API gateway / API gateway (IV) - use of Kong - Integrated JWT and fuse plug-in

数组模拟队列进阶版本——环形队列(真正意义上的排队)

TUN 设备原理

八路抢答器系统51单片机设计【附Proteus仿真、C程序、原理图及PCB文件、元器件清单和论文等】

51 Single Chip Microcomputer Design of traffic light system (with Proteus simulation, C program, schematic diagram, PCB, thesis and other complete data)

krpano全景之vtour文件夹和tour

字节面试编程题:最小的K个数

单相交交变频器的Matlab Simulink建模设计,附Matlab仿真、PPT和论文等资料

C语言知识点精细详解——初识C语言【1】——你不能不知的VS2022调试技巧及代码实操【2】
随机推荐
Qt界面优化:Qt去边框与窗体圆角化
asp.net使用MailMessage发送邮件的方法
man man随记和crontab的@reboot用法
JumpServer
顺序栈的基本操作
微信小程序轮播图swiper
SSH 通过跳板机连接远程主机
处理 mkdir:无法创建目录“aaa“:只读文件系统
Tongxin UOS php7 2.3 upgrade to php7.0 two point two four
LM317的直流可调稳压电源Multisim仿真设计(附仿真+论文+参考资料)
XX project structure notes
直流可调稳压电源的Proteus仿真设计(附仿真+论文等资料)
Nacos作为配置中心(四) 使用Demo
操作系统常见面试题目:
Redis源码分析之HSET流程与ziplist
LLVM - 生成for循环
基础正则表达式
差分隐私(背景介绍)
分分钟掌握---三目运算符(三元运算符)
API Gateway/API 网关(四) - Kong的使用 - 集成Jwt和熔断插件