A practical design for a vehicle air conditioning controller
2026-04-06 07:12:50··#1
With the development of society and economy and the improvement of people's living standards, travel is gradually becoming a fashion. Cars, as a convenient means of transportation, are the first choice for many. A comfortable riding environment, such as a suitable interior temperature and fresh air, is essential for long-distance travel. Therefore, developing an economical and practical vehicle air conditioning controller has become a demand. This paper uses the DC/DC converter chip MC34063AP1 as the system power supply, the Atmega8 microcontroller as the system core, supplemented by simple fuzzy control technology, button selection, and LED digital tube display. The entire control system has protection functions such as power undervoltage, overvoltage, temperature sensor short circuit, and open circuit. Main Functional Indicators The main functions of the automotive air conditioning control system are as follows: ● Multiple operating modes: automatic, cooling, defrosting, ventilation. ● Multiple fan speed settings: automatic, low speed, medium speed, high speed. ● Fault handling function. ● Panel button operation. ● Compatible with multiple display interfaces. Controller Basic Principle The block diagram of the automotive air conditioning control system is shown in Figure 1. The system consists of key scanning, voltage detection, temperature detection, fan control, compressor control, LED digital tube display, buzzer alarm circuit, and microcontroller. Figure 1 shows the block diagram of the automotive air conditioning control system. The main working principle of the microcontroller is as follows: Scanning the keyboard, when the cooling key is pressed and there is no fault alarm, the system compares the in-vehicle temperature sampled by the ADC with the preset cooling temperature. If the in-vehicle temperature is higher than the preset temperature, the condenser fan and compressor are turned on for cooling; when the in-vehicle temperature is 2°C lower than the set temperature, the compressor and condenser fan are turned off. If the forced cooling key is pressed at this time, the system will ignore the preset temperature and directly start cooling. The microcontroller's PB0 and PB1 ports output high and low signals to control the switching of the MOSFETs, thereby controlling the start and stop of the fan and compressor; the PC0 port samples the input voltage and compares it with the system default value to determine if the voltage is normal; the PC2 port samples the defrost temperature to determine the defrost operation; the PC3 port samples the in-vehicle temperature and outputs the calculated result to the LED digital tube display. System Hardware Design1. Introduction to the Main Control Chip The Atmega8 microcontroller features 8Kb of in-system programmable Flash memory, 512 bytes of EEPROM, 1Kb of SRAM, 32 general-purpose working registers, 23 general-purpose I/O ports, 3 timers/counters with flexible compare modes, 18+2 internal and external interrupt sources, 1 programmable SUART interface, 1 I2C bus interface, 4-channel 10-bit ADC, 2-channel 8-bit ADC, a programmable watchdog timer, 1 SPI interface, and 5 software-selectable power-saving modes. 2. Power Supply Section Figure 2 shows the system power supply circuit. The DC/DC converter chip used is the MC34063, which features integrated reference voltage, oscillator synchronization, and a wide input voltage range. Its output voltage can be expressed as Vout = 1.25(1 + R39/R40), and the output current can reach 500mA, fully meeting the power consumption requirements of this system. To reduce interference, capacitors C10, C12, and C13 are added to the input and output terminals of the chip for filtering. Figure 3 Voltage and Temperature Detection Circuit As shown in Figure 3, voltage and temperature detection uses a dedicated ADC sampling channel inside the microcontroller, which reduces system cost by eliminating the need for additional chips. The ADC reference voltage is equivalent to the microcontroller's operating voltage of 5V. The system input voltage is simply filtered by voltage divider R3 and R8 before being sent to PC0 (ADC0). This port samples 21 times continuously according to the voltage division ratio, and then the values obtained each time are added together to restore the system input voltage. RT1 and RT2 are negative temperature coefficient sensors. Their resistance decreases or increases as the temperature rises or falls. The corresponding ADC port performs numerical averaging filtering on the voltage values sampled multiple times and compares them with the known voltage/temperature range to obtain the real-time temperature. 4 Keyboard and Display Circuit As shown in Figure 4, due to the limited number of microcontroller I/O ports, the keyboard and display circuit uses port multiplexing. The SN74164 serial-in parallel-out chip is added to the 3-digit 8-segment LED digital tube driver to further alleviate the pressure of limited ports. The keyboard has seven keys: power on/off, cooling/ventilation, forced cooling, setting, up, and down, allowing for temperature and fresh air time settings. The LED digital display shows the current interior temperature, system preset temperature, and input voltage. When the buzzer sounds, it displays a fault code, facilitating maintenance and troubleshooting. Figure 4 shows the keyboard and display circuit. 5. Output Control Circuit The fan and compressor output control circuit is shown in Figure 5. The microcontroller output control signal is inverted by the ULA2003 to drive transistor Q2. The collector of Q2 is then connected to the control input terminal of the compressor's start/stop switch relay. When the relay changes from closed to open, diode D10 provides freewheeling current to the relay coil. To effectively control the transistor's on/off state, the system incorporates a high input voltage, high sink current ULN2003A driver chip. Internally, it uses a Darlington input voltage up to 50V and a maximum sink current of 500mA. Software Design The program design can be divided into two main parts: the main program and the interrupt service routine. The main program includes timers, ADC module initialization, keyboard display processing, and buzzer alarm. After the main program is initialized, the system checks the input voltage and temperature sensor for short circuits or open circuits based on the ADC conversion results. If any of these occur, the system cuts off all outputs and issues a fault code; otherwise, it displays the indoor temperature. Then, it scans the keyboard and performs corresponding operations based on the key values, such as switching between high, medium, and low airflow, turning cooling on/off, selecting forced cooling, setting the cooling temperature, and setting the fresh air delivery time. Figure 5 shows the output control circuit interrupt service routine, including timer T0 and T1 interrupt service routines. Timer T0 has a timing interval of 1ms. A variable 'a' is incremented by 1 each time the interrupt subroutine is entered if the fault flag is valid. The buzzer is activated before 'a' is less than 50; when 'a' is greater than 50, the buzzer is deactivated and 'a' is cleared. This distinguishes the key press sound from the alarm sound. Timer T1 has a timing interval of 1s and is mainly used for delay between the compressor and condenser fan. This means the time interval between two consecutive compressor starts must be no less than 6 seconds, and the condenser fan is deactivated 3 seconds after the compressor stops. Conclusion This controller uses an Atmega8 microcontroller, featuring a simple circuit structure, stable performance, powerful functions, high reliability, and low cost. Practical applications have proven its strong anti-interference capability and ability to operate stably for extended periods in both low and high temperature environments. Because it utilizes a Flash-based microcontroller, online upgrades are convenient, making it suitable for controlling air conditioning systems in economy cars, luxury buses, and large trucks.