Hello! Welcome to Embedic!
This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > Embedded Events > STM32-based Temperature Control System Simulation

STM32-based Temperature Control System Simulation

Date: 11-03-2021 ClickCount: 8829

Preparation

Simulation software: Proteus 8.9

Download, and install, pay attention to install in the root directory of C disk

Proteus configuration

In this paper, the software comes with Oven to achieve temperature feedback control.

Add STM32F103C6 module, LM016L LCD module, a yellow LED, a green LED, two 100 ohm resistors, a relay switch, a pair of 123k and 5k voltage divider resistors, and the Oven module.

After adding, connect the wires as shown in the figure, pay attention to the setting of the ad network label

To learn more about STM32 products, please click stm32

stm32

STM32 process

The temperature is obtained through the STM32's own ADC, compared with the set value, and then the power driver of the Oven is controlled through the IO port, thus achieving negative feedback. At the same time, the STM32 also needs to control the LCD information display.

Please download the program code first.

First use STM32CubeMX. Open ATest.ioc.

The previous configuration is done, jump to Project Manager and choose your favorite IDE for STM32 program development.

stm32

Open the project and start with the development of the display control. The code is available in the package, so here is only an excerpt

stm32

Because the program can not print floating point numbers for some reasons, here to do a floating point number printing

stm32

Here is the delay function

stm32

Here is the LCD control command function, in accordance with the LCD protocol will control the command to write the LCD screen

stm32

Here is the function of the LCD data command, when writing data, it will make the LCD display characters in the pointer position

stm32

Here is the LCD initialization function, the first line will be written to "Temperature:"

stm32

Here is the LCD command function

The following is the main function, all of their own code should be added in the corresponding USER CODE

stm32

Initialization variables

stm32

Initialize ADC, LCD

stm32

Here the ADC reading is first collected, followed by a call to printFloat to convert the floating point number to a string, followed by printing the string to the second line for display. The ADC reading is then used to determine if further heating is required based on the current ADC reading. Here the temperature is set to 30 degrees.

The program is finished, click compile and generate the hex file.

operational

Double click on the STM32 part in Proteus, open properties, add the hex file and click OK

For MDK, the hex path is in the project MDK-ARM\ATest\ATest.hex

stm32

Click Run in the lower left corner to start the simulation

stm32

You can see that the program is starting to run normally.

However, you will find that the temperature sometimes exceeds the limit, and it is slow, and the jitter will be bigger. Here we recommend using PWM for control, and the effect is the best.

  • Ti MSP430 series microcontroller introduction
  • Arduino core board with atmega328p-pu Microchip as the main control

Hot Products

  • TMS320C6474FGUN2

    Manufacturer: Texas Instruments

    IC DSP MILTICORE 561FCBGA

    Product Categories: DSP

    Lifecycle:

    RoHS:

  • TMS320C6748AZCE3

    Manufacturer: Texas Instruments

    IC DSP FIX/FLOAT POINT 361NFBGA

    Product Categories: DSP

    Lifecycle:

    RoHS:

  • PIC18F26K42-E/SP

    Manufacturer: Microchip

    IC MCU 8BIT 64KB FLASH 28SDIP

    Product Categories: 8bit MCU

    Lifecycle:

    RoHS:

  • ADSP-BF514BBCZ-4F4

    Manufacturer: Analog Devices

    IC DSP 16/32B 400MHZ 168CSBGA

    Product Categories: DSP

    Lifecycle:

    RoHS:

Customer Comments

  • Looking forward to your comment

  • Comment

    Verification Code * 

Compare products

Compare Empty