基于stm32单片机智能浇花设计

单片机型号选择:STM32F103C8T6;物联网通信选择:WIFI
功能整体描述:
WIFI:ESP01S
显示OLED
温湿度模块:DHT11
土壤湿度模块
wifi模块ESP8266(透传)
两个继电器(加水,加湿)
三按键
蜂鸣器
指示灯""土壤湿度传感器:检测土壤的湿度,温湿度传感器:检测空气的温度和湿度,ESP8266无线传输模块实现数据的传输。屏幕:显示当前的温度、湿度和土壤湿度等信息。加水继电器和加湿继电器:分别用于控制水和湿度的供应,三个按键:用于用户交互,比如进入阈值修改界面其他设置操作。
在这里插入图片描述
图2.1 系统整体功能框图

实物图:
在这里插入图片描述
代码:

void userHandle(void)
{
    /*
         currentDataPoint.valueTempSet = ;
         currentDataPoint.valueHumiSet = ;
         currentDataPoint.valueSoilSet = ;
         currentDataPoint.valueAirTemp = ;
         currentDataPoint.valueAirHum = ;
         currentDataPoint.valueSoilHum = ;


       */
    uint8_t ret = 0;
    static uint32_t thLastTimer = 0;

    if((gizGetTimerCount() - thLastTimer) > 1000 )      //上报间隔读取温度2S
    {

        modeset(currentDataPoint.valueMODEL);
        //采集三种数据
		   	dht11Read((u8*)&currentDataPoint.valueAirTemp,(u8*)&currentDataPoint.valueAirHum);

        currentDataPoint.valueSoilHum =(uint16_t)(Get_Adc_Average(ADC_CHANNEL_0,10 ));
        currentDataPoint.valueSoilHum=(4095 - currentDataPoint.valueSoilHum)/41;
			  currentDataPoint.valuelight = (Get_Adc_Average(ADC_CHANNEL_1,10 ))/41;

        //显示三种数据
        OLED_ShowNum(40,2,(uint16_t)currentDataPoint.valueAirTemp,2,16);
        OLED_ShowNum(40,4,(uint16_t)currentDataPoint.valueAirHum,2,16);
        OLED_ShowNum(40,6,(uint16_t)(currentDataPoint.valueSoilHum),2,16);
        OLED_ShowNum(90,6,(uint16_t)(currentDataPoint.valuelight),3,16);
			
			
        if(currentDataPoint.valueMODEL==0) //自动模式
        {
            if(currentDataPoint.valueAirTemp > currentDataPoint.valueTempSet
                    || currentDataPoint.valueAirHum < currentDataPoint.valueHumiSet)
            {
                HUMON;
                currentDataPoint.valueaddhumiopen  = 1;
            }
            else
            {
                HUMOFF;
                currentDataPoint.valueaddhumiopen = 0;
            }
            if(currentDataPoint.valueSoilHum <  currentDataPoint.valueSoilSet)
            {
                LEDON;
                currentDataPoint.valueBoomOpen = 1;
            }
            else
            {
                LEDOFF;
                currentDataPoint.valueBoomOpen =0;
            }
						if(currentDataPoint.valuelight < currentDataPoint.valuelightset)
						{
						  LED1ON;currentDataPoint.valueLED = 1;
						}
						else
						{
						  LED1OFF;currentDataPoint.valueLED = 0;
						}
//            if(currentDataPoint.valueAirTemp > currentDataPoint.valueTempSet
//                    || currentDataPoint.valueAirHum < currentDataPoint.valueHumiSet
//                    ||currentDataPoint.valueSoilHum <  currentDataPoint.valueSoilSet)
//            {
//                BEEpON;LED1ON;
//            }
//            else
//            {
//                BEEpOFF;LED1FF;
//            }
						
						 if(currentDataPoint.valueAirTemp > currentDataPoint.valueTempSet )
            {
               OLED_ShowString(80,2,"*",16);	// currentDataPoint.valueTempAlarm = 1;
            }
            else
            {
                OLED_ShowString(80,2," ",16);	// currentDataPoint.valueTempAlarm = 0;
            }
						
				   if(currentDataPoint.valueAirHum < currentDataPoint.valueHumiSet )
            {
               OLED_ShowString(80,4,"*",16);	// currentDataPoint.valueTempAlarm = 1;
            }
            else
            {
                OLED_ShowString(80,4," ",16);	// currentDataPoint.valueTempAlarm = 0;
            }
						
					 if(currentDataPoint.valueSoilHum <  currentDataPoint.valueSoilSet )
            {
               OLED_ShowString(80,6,"*",16);	// currentDataPoint.valueTempAlarm = 1;
            }
            else
            {
                OLED_ShowString(80,6," ",16);	// currentDataPoint.valueTempAlarm = 0;
            }
        }
        thLastTimer = gizGetTimerCount();
    }
}

图纸:
在这里插入图片描述
源码:https://gitee.com/szangell_2240885967/jiaohua.git
演示视频:https://www.bilibili.com/video/BV1YMEuzCEce/
购买定制:739175369

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值