2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
System functions:
After the system is powered on, the OLED displays "Welcome to the overload alarm system, please wait", and then enters the normal page display after five seconds.
The first line shows the weight value obtained
The second line shows the set weight value
The third line shows the GPS coordinates
The fourth line shows the system status, OK or Alarm
Short press the B3 button to increase the weight setting threshold
Short press the B4 button to reduce the weight setting threshold
After pressing the pressure sensor module, the system buzzer sounds and sends an alarm message to the mobile phone number.
After the mobile phone is connected to the system via the Bluetooth module, the system can periodically report the obtained weight value to the mobile phone.
and system status.
Schematic diagram of main functional modules:
Power clock burning interface:
Microcontroller and key input circuit:
Sensor acquisition circuit:
Display output circuit:
System main function module code
Initialization code:
- /* USER CODE BEGIN 1 */
-
-
- /* USER CODE END 1 */
-
-
- /* MCU Configuration--------------------------------------------------------*/
-
-
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
-
- HAL_Init();
-
-
- /* USER CODE BEGIN Init */
-
- InitVar();
-
-
- /* USER CODE END Init */
-
-
- /* Configure the system clock */
-
- SystemClock_Config();
-
-
- /* USER CODE BEGIN SysInit */
-
-
- /* USER CODE END SysInit */
-
-
- /* Initialize all configured peripherals */
-
- MX_GPIO_Init();
-
- MX_USART1_UART_Init();
-
- MX_USART2_UART_Init();
-
- MX_USART3_UART_Init();
-
- MX_ADC1_Init();
-
- /* USER CODE BEGIN 2 */
-
- //uart2打开接收中断
-
- HAL_UART_Receive_IT(&huart2, (uint8_t*)&uart2RecBuff, 1);
-
- //uart3打开接收中断
-
- HAL_UART_Receive_IT(&huart3, (uint8_t*)&uart3RecBuff, 1);
-
- InitOled();
-
- InitOledDisp();
-
- //初始化ESP8266
-
- ESP8266_Init();
-
- HAL_Delay(100);
-
- OledFill(0x00); //全屏熄灭
-
- RELAY1_ON();
-
- /* USER CODE END 2 */
Read sensor value;
- //读传感器值,AD值
-
- void ReadSensorVal(void)
-
- {
-
- getWeightVal = ReadADCChannel(ADC_CHANNEL_0);
-
- if(getWeightVal>setWeightVal)
-
- {
-
- BUZZER_ON();
-
- sysAlarm = true;
-
- if(sendMessage==false)
-
- {
-
- sendMessage = true;
-
- sim900a_SendMessage();
-
- }
-
- }
-
- else
-
- {
-
- BUZZER_OFF();
-
- sysAlarm = false;
-
- sendMessage = false;
-
- }
-
- }
Update BLE data:
- void UpdateBleData(void)
-
- {
-
- static uint8_t bleCnt = 0;
-
-
- bleCnt++;
-
- if(bleCnt>=BLE_UPDATE_INTER)
-
- {
-
- bleCnt = 0;
-
- printf("GetWeight:%04drn", getWeightVal);
-
- printf("SetWeight:%04drn", setWeightVal);
-
- if(sysAlarm==false)
-
- {
-
- printf("System is OK!rn");
-
- }
-
- else
-
- {
-
- printf("System is NG!rn");
-
- }
-
- }
-
- }
The information provided for this design includes schematic PCB (including three versions: PDF, AD, and EasyEDA), source code, system block diagram, main program flow chart, bill of materials (including manuals of the devices used), functional operation instructions, etc.
Information about each functional module: