Designing an Intelligent Herbal Pot System Using STM32 Microcontroller

The system displays "Welcome to the Smart Pot System, please wait" upon power-up. After a two-second delay, the normal interface appears.

On the first screen, the first line shows "Temperature Threshold Setting", the second line displays the current temperature reading, the third line shows the value from the DS18B20 sensor, and the fourth line indicates the PWM output level.

Button operations on the first screen:

  • Pressing B4 briefly switches to the second screen.
  • Pressing B5 briefly increases the tempearture threshold.
  • Pressing B6 briefly decreases the temperature threshold.
  • Pressing B7 briefly initiates heating.

The second screen's first line reads "Time Threshold Setting", the second line shows remaining time, the third line displays the set time value, and the fourth line is blank.

Button operations on the second screen:

  • Pressing B4 briefly switches to the third screen.
  • Pressing B5 briefly increases the time threshold.
  • Pressing B6 briefly decreases the time threshold.

The third screen's first line shows "Water Level Threshold Setting", the second line indicates current water level, the third line displays the set water level, and the fourth line shows status (OK or NG).

Button operations on the third screen:

  • Pressing B4 briefly returns to the first screen.
  • Pressing B5 brief increases the water level threshold.
  • Pressing B6 brief decreases the water level threshold.

After connecting to the Bluetooth module via a mobile device, the system periodically transmits current temperature, set temperature, and heating PWM values.

void initialize_hardware(void)
{
    HAL_Init();
    setup_variables();
    configure_pid_controller();
    configure_system_clock();
    initialize_gpio_pins();
    initialize_uart_interface();
    configure_timer_for_pwm();
    setup_adc_converter();
    delay_ms(100);
    configure_uart_reception();
    delay_ms(50);
    enable_uart_receive_interrupt(&huart1, &uart_buffer, 1);
    start_pwm_output(&htim1, TIM_CHANNEL_1);
    initialize_oled_display();
    setup_oled_content();
    if (initialize_temperature_sensor() == SUCCESS)
    {
        read_initial_temperature_value();
    }
}
void manage_system_operations(void)
{
    acquire_sensor_readings();
    regulate_heating_process();
    transmit_bluetooth_data();
}
void transmit_bluetooth_data(void)
{
    static uint8_t transmission_counter = 0;
    transmission_counter++;
    if (transmission_counter >= UPDATE_INTERVAL)
    {
        transmission_counter = 0;
        printf("Target Temperature: %4.1f\r\n", target_temp);
        printf("Current Temperature: %4.1f\r\n", measured_temp);
        printf("PWM Duty Cycle: %d\r\n", pwm_duty);
    }
}

Tags: STM32 microcontroller Embedded Systems Temperature Control Bluetooth Communication

Posted on Sat, 13 Jun 2026 17:10:33 +0000 by drbigfresh