STM32 Project Share: Smart Dishwasher

Product images of the project:

STM32 Project Share: Smart Dishwasher

Bilibili video link:

https://www.bilibili.com/video/BV1e857zoERb/?share_source=copy_web&vd_source=097fdeaf6b6ecfed8a9ff7119c32faf2

(For material sharing, see the end of the article)

01

Project Introduction

1. Function Details

STM32 Smart Dishwasher

The functions are as follows:

  1. STM32F103C8T6 microcontroller as the main control unit

  2. Detection function: The system detects water level data and temperature data.

  3. Display function: Displays the detected data on the OLED screen.

  4. Control function: Controls the dishwasher’s start/pause/cancel through buttons.

  5. Dishwashing process: Relay 1 (simulates water filling) → Detects if the water level exceeds the threshold → Heating element heats to the preset temperature → DC motor starts (simulates dishwashing) → Relay 2 closes (simulates drainage) → Detects if the water is drained → Fan dries → Disinfection lamp disinfects.

  6. Threshold adjustment: The system sensor threshold can be adjusted through button settings.

  7. Gizwits Cloud APP: Connects to the network via the WIFI module, allowing data viewing and control through the APP.

2. Bill of Materials

  • STM32F103C8T6 microcontroller

  • OLED screen

  • DS18B20 temperature sensor

  • Water level sensor

  • TB6612 motor driver module

  • ESP8266 module (WIFI)

  • Fan module

  • DC motor

  • Water pump module

  • UV disinfection lamp

  • PTC heating element

02

Schematic Design

STM32 Project Share: Smart Dishwasher

03

PCB Hardware Design

PCB Diagram

STM32 Project Share: Smart DishwasherSTM32 Project Share: Smart Dishwasher

04

Program Design

#include "stm32f10x.h"                  // Device header#include "oled.h"#include "menu.h"#include "delay.h"#include "tb6612.h"#include "adcx.h"#include "pwm.h"#include "watersensor.h"#include "ds18b20.h"#include "relay.h"#include "key.h"#include "tim2.h"#include "tim3.h"#include "usart.h"#include "flash.h"#include "led.h"#include "heater.h"#include "buzzer.h"#include "myrtc.h"#include "iwdg.h"#include "gizwits_product.h" 

define FLASH_START_ADDR 0x0801f000
u8 Menu = 1; u8 select = 1;
u16 Water_level_value; u8 Temp_value; u8 Dishwashing_time; u16 Dishwashing_dynamics; u8 Drying_time, Disinfection_time;
u8 Dishwashing_Flag; u8 Dishwashing_time_Flag; u8 Drying_time_Flag; u8 Disinfection_time_Flag;
u8 hour,minute,second; u8 i;

void Dishwashing_process(void){ switch(Dishwashing_Flag) { case 1:
 Relay_ON(1); Heater_ON(); if(Water_level_value < system_data_buff[1])
 { Dishwashing_Flag = 2; Relay_OFF(1); } break; case 2:
 Heater_ON(); if(Temp_value < system_data_buff[2])
 { Heater_OFF(); Dishwashing_Flag = 3; } break; case 3:
 Motor_Direction(1,Dishwashing_dynamics); if(Dishwashing_time_Flag > Dishwashing_time)
 { Motor_STOP(); Dishwashing_time_Flag = 0; Dishwashing_Flag = 4; } break; case 4:
 Relay_ON(0); if(system_data_buff[1] < 15)
 { Relay_OFF(0); Dishwashing_Flag = 5; } break; case 5:
 Fan_ON(); if(Drying_time_Flag > Drying_time)
 { Fan_OFF(); Drying_time_Flag = 0; Dishwashing_Flag = 6; } break; case 6:
 LED_ON(); if(Disinfection_time_Flag > Disinfection_time)
 { LED_OFF(); Disinfection_time_Flag = 0; Dishwashing_Flag = 0; Buzzer_ON(); Delay_ms(500); Buzzer_OFF(); } break; case 7:
 Relay_OFF(1); Heater_OFF(); Motor_STOP(); Relay_OFF(0); Fan_OFF(); LED_OFF(); break; case 8:
 Relay_OFF(1); Heater_OFF(); Motor_STOP(); Relay_OFF(0); Fan_OFF(); LED_OFF(); Dishwashing_Flag = 0; break; default: break;
 }
}

void value_adjust(void){ if(KeyNum == 3) { switch(select) { case 1:
 KeyNum = 0; Menu = 4; break; case 2:
 KeyNum = 0; Water_level_value += 100; if(Water_level_value >= 4000)
 { Water_level_value = 100; } break; case 3:
 KeyNum = 0; Temp_value++; if(Temp_value >= 100)
 { Temp_value = 1; } break; case 4:
 KeyNum = 0; Dishwashing_time++; if(Dishwashing_time >= 100)
 { Dishwashing_time = 1; } break; case 5:
 KeyNum = 0; Dishwashing_time++; if(Dishwashing_time >= 100)
 { Dishwashing_time = 1; } break; case 6:
 KeyNum = 0; Dishwashing_dynamics++; if(Dishwashing_dynamics >= 1000)
 { Dishwashing_dynamics = 500; } break; case 7:
 KeyNum = 0; Drying_time++; if(Drying_time >= 100)
 { Drying_time = 1; } break; case 8:
 KeyNum = 0; Disinfection_time++; if(Disinfection_time >= 100)
 { Disinfection_time = 1; } break; default: break; } }
if(KeyNum == 4) { switch(select) { case 1:
 KeyNum = 0; Menu = 4; break; case 2:
 KeyNum = 0; Water_level_value -= 100; if(Water_level_value >= 4000)
 { Water_level_value = 4000; } break; case 3:
 KeyNum = 0; Temp_value--; if(Temp_value >= 100)
 { Temp_value = 99; } break; case 4:
 KeyNum = 0; Dishwashing_time--; if(Dishwashing_time >= 100)
 { Dishwashing_time = 99; } break; case 5:
 KeyNum = 0; Dishwashing_time--; if(Dishwashing_time >= 100)
 { Dishwashing_time = 99; } break; case 6:
 KeyNum = 0; Dishwashing_dynamics--; if(Dishwashing_dynamics <= 500)
 { Dishwashing_dynamics = 999; } break; case 7:
 KeyNum = 0; Drying_time--; if(Drying_time >= 100)
 { Drying_time = 99; } break; case 8:
 KeyNum = 0; Disinfection_time--; if(Disinfection_time >= 100)
 { Disinfection_time = 99; } break; default: break; } }

void Time_adjust(void){ if((KeyNum == 3) && (Menu == 5)) { KeyNum = 0; switch(select) { case 1:
 hour++; if(hour > 24)
 { hour = 0; } break; case 2:
 minute++; if(minute > 60)
 { minute = 0; } break; case 3:
 second++; if(second > 60)
 { second = 0; } break; }
}
if((KeyNum == 4) && (Menu == 5)) { KeyNum = 0; switch(select) { case 1:
 hour--; if(hour > 24)
 { hour = 24; } break; case 2:
 minute--; if(minute > 60)
 { minute = 60; } break; case 3:
 second--; if(second > 60)
 { second = 60; } break; }
}
int main(void){ OLED_Init(); PWM_Init(1000 - 1,72 -1); ADCX_Init(); Timer2_Init(9,14398); uart2_init(9600); uart1_init(115200); MyRTC_Init();
 LED_Init(); DS18B20_Init(); Motor_Init(); Fan_Init(); Relay_Init(); Key_Init(); Heater_Init(); Buzzer_Init(); IWDG_Init();
 GENERAL_TIM_Init(); userInit(); gizwitsInit();

 Water_level_value = FLASH_R(FLASH_START_ADDR); Temp_value = FLASH_R(FLASH_START_ADDR+2); Dishwashing_time = FLASH_R(FLASH_START_ADDR+4); Dishwashing_dynamics = FLASH_R(FLASH_START_ADDR+6); Drying_time = FLASH_R(FLASH_START_ADDR+8); Disinfection_time = FLASH_R(FLASH_START_ADDR+10);
 Delay_ms(1000); gizwitsSetMode(WIFI_AIRLINK_MODE); Delay_ms(1000);

 while (1) { MyRTC_ReadTime(); IWDG_Init(); switch(Menu) { case 1:
 Menu1(); System_data_state(); if(KeyNum == 2)
 { KeyNum = 0; Dishwashing_Flag = 1; } Dishwashing_process(); break; case 2:
 OLED_Clear(); Menu = 3; break; case 3:
 if(KeyNum == 1)
 { KeyNum = 0; select++; if(select == 5)
 { OLED_Clear(); } if(select > 8)
 { select = 1; OLED_Clear(); } }

 if(select >= 5)
 { OLED_Option(select-4); Menu3(); Data_Menu2(); } else
 { OLED_Option(select); Menu2(); Data_Menu1(); }

 value_adjust();
 if(KeyNum == 2)
 { KeyNum = 0;
 FLASH_W(FLASH_START_ADDR,Water_level_value,Temp_value,Dishwashing_time,Dishwashing_dynamics,Drying_time,Disinfection_time);
 Menu = 1; select = 1; OLED_Clear(); } break; case 4:
 OLED_Clear(); Menu = 5; hour = MyRTC_Time[3]; minute = MyRTC_Time[4]; second = MyRTC_Time[5]; break; case 5:
 Menu_Time();

 if((KeyNum == 1) && (Menu == 5))
 { KeyNum = 0; select++; if(select > 3)
 { select = 1; } }
 OLED_Time_Option(select); Time_adjust();

 if((KeyNum == 2) && (Menu == 5))
 { KeyNum = 0; MyRTC_Time[3] = hour; MyRTC_Time[4] = minute; MyRTC_Time[5] = second;
 MyRTC_SetTime(); select = 1; Menu = 2; } default: break; }
 userHandle(); gizwitsHandle((dataPoint_t *)&currentDataPoint); }}

05

Experimental Results

STM32 Project Share: Smart DishwasherSTM32 Project Share: Smart Dishwasher

Material Sharing (Baidu Cloud)

https://pan.baidu.com/s/1eFd74cOPtf0q9pOXD8dnlA?pwd=278h Extraction code: 278h

Scan the QR code below to purchase the physical productSTM32 Project Share: Smart Dishwasher

Leave a Comment