
目录一、项目成品图片二、项目功能简介1.主要器件组成2.功能详解介绍三、项目原理图设计四、项目PCB硬件设计项目PCB图五、项目程序设计六、项目实验效果 编辑七、项目包含内容一、项目成品图片哔哩哔哩视频链接https://www.bilibili.com/video/BV1XysmeyEdL/?spm_id_from333.1387.upload.video_card.click资料分享看文章末尾二、项目功能简介1.主要器件组成本设计由STM32F103C8T6单片机WIFI模块ESP8266-01SOLED屏幕DHT11温湿度传感器土壤湿度传感器光敏传感器二氧化碳传感器水泵模块风扇模块电路LED电路电源电路组成。2.功能详解1环境采集DHT11温湿度传感器采集环境温度和湿度、土壤湿度传感器检测土壤湿度是否正常、光照传感器检测光照情况和二氧化碳模块检测大棚二氧化碳气体浓度。2屏幕显示OLED屏幕显示当前大棚中土壤湿度光照强度湿度温度和二氧化碳气体浓度情况信息3自动补光通过光敏传感器检测光照强度当光照强度小于阈值自动点亮LED灯补光当光强度大于阈值自动关闭LED补光灯。4智能灌溉通过土壤湿度传感器检测土壤湿度当土壤湿度小于设置的阈值开启水泵灌溉反之关闭5CO2换气通过二氧化碳传感器检测二氧化碳当二氧化碳气体大于设置的阈值开启风扇反之关闭6阈值设置可通过土壤湿度二氧化碳光照强度阈值7远程控制通过WIFI连接手机APPAPP可以查看当前环境信息数据可调节阈值范围三、项目原理图设计四、项目PCB硬件设计五、项目程序设计#include stm32f10x.h #include delay.h #include usart.h #include USART2/usart2.h #include usart3.h #include oled.h #include timer.h #include adc.h #include menu.h #include pump.h #include key.h #include modules.h #include co2.h #include DHT11/dht11.h #include fan.h #include led.h #include light.h #include soil.h #include beep.h /****************破晓电子工作室******************* *** 破晓单片机 *** 项目:STM32智能大棚 *** BILIBILI:破晓单片机 *** 小红书:破晓单片机 *** 授权IP:破晓单片机 *** 淘宝:破晓单片机 *** 版本:V01.01 *** MCU:STM32F103C8T6 ******************破晓单片机***********************/ //显示界面 CaiDanJieGouTi KeyTab[SIZE_CAIDAN] { {0 ,0 ,0 ,0 ,0 ,Main_Menu0}, {1 ,1 ,1 ,1 ,1 ,Main_Menu1}, {2 ,2 ,2 ,2 ,2 ,Main_Menu2}, {3 ,3 ,3 ,3 ,3 ,Main_Menu3}, {4 ,4 ,4 ,4 ,4 ,Main_Menu4}, {5 ,5 ,5 ,5 ,5 ,Main_Menu5}, {6 ,6 ,6 ,6 ,6 ,Main_Menu6}, {7 ,7 ,7 ,7 ,7 ,Main_Menu7}, {8 ,8 ,8 ,8 ,8 ,Main_Menu8}, } ; //传感器变量声明 typedef struct { u8 temp;//ÎÂ¶È u8 humi;//ʪ¶È uint8_t soil; uint16_t light; uint16_t co2; }SensorModulesValue; typedef struct { uint8_t tempTV; uint8_t humiTV; uint8_t soilTV; uint16_t lightTV; uint16_t co2TV; }SensorThresholdValue; typedef struct { uint8_t LEDFlag; uint8_t FANFlag; uint8_t PUMPFlag; }DriveFlag; int main(void) { delay_init(); TIM3_Int_Init(9,7199);//定时器初始化 OLEDGUI_Config(); //OLED初始化 OLEDGUI_DispString(30,16,Init...,16,1); key_Init();//按键初始化 pump_Init();//水泵初始化 DHT11_Init();//温湿度初始化 led_Init();//led初始化 light_Init();//光照初始化 SOIL_Init(); //土壤湿度初始化 FAN_Init();//风扇初始化 beep_Init();//蜂鸣器 SensorThresholdSet();//阈值初始化 delay_ms(100); OLEDGUI_Clear(); //OLEDT清屏 uart1_init(9600); delay_ms(100); uart2_init(9600); delay_ms(100); uart3_init(9600); delay_ms(100); //WIFI初始化 delay_ms(100); memset((uint8_t *)currentDataPoint, 0, sizeof(dataPoint_t)); gizwitsInit(); while(1) { //获取按键值 key_scan(); //进入菜单界面显示处理数据 GetKeylnput(Keystatus); //获取传感器数据 SensorDataGet(); //数据上传 currentDataPoint.valueTempSensorData.temp; currentDataPoint.valueHumiSensorData.humi; currentDataPoint.valueSoilSensorData.soil; currentDataPoint.valueLighSensorData.light; currentDataPoint.valueCo2SensorData.co2; currentDataPoint.valueFanDriveFlagData.FANFlag; currentDataPoint.valueLightDriveFlagData.LEDFlag; currentDataPoint.valuePumpDriveFlagData.PUMPFlag; gizwitsHandle((dataPoint_t *)currentDataPoint); //数据下发 Sensorthreshold.tempTVcurrentDataPoint.valueTempyz; Sensorthreshold.humiTVcurrentDataPoint.valueHumiyz; Sensorthreshold.soilTVcurrentDataPoint.valueSoilyz; Sensorthreshold.lightTVcurrentDataPoint.valueLighyz; Sensorthreshold.co2TVcurrentDataPoint.valueCo2yz; delay_ms(100); } }六、项目实验效果 七、项目包含内容