Design of temperature detection circuit implemented by single chip microcomputer
Source: InternetPublisher:spectrum Keywords: Microcontroller temperature detection power supply and other power supply circuits Updated: 2021/01/20
This article provides a low-cost temperature detection circuit that utilizes the redundant I/O ports of a microcontroller. The circuit is very simple and easy to implement, and is suitable for almost all types of microcontrollers. Its circuit is shown in the figure below:
In the picture:
P1.0, P1.1 and P1.2 are the three I/O pins of the microcontroller;
RK is a 100k precision resistor;
RT is 100K - thermistor with 1% accuracy;
R1 is an ordinary resistor of 100Ω;
C1 is a 0.1μ ceramic capacitor.
Its working principle is:
1. First set P1.0, P1.1, and P1.2 to low level output to discharge C1 until it is completely discharged.
2. Set P1.1 and P1.2 to input status, set P1.0 to high level output, charge C1 through the RK resistor, clear the internal timer of the microcontroller and start timing, detect the status of P1.2 port, when When the P1.2 port detects a high level, that is, when the voltage on C1 reaches the gate voltage of the high-level input of the microcontroller, the microcontroller timer records the time T1 from the start of charging to the P1.2 port transitioning to a high level.
3. Set P1.0, P1.1, and P1.2 to low-level output to discharge C1 until it is discharged.
4. Then set P1.0 and P1.2 to the input state, set P1.1 to high level output, charge C1 through the RT resistor, clear the internal timer of the microcontroller and start timing, and detect the status of the P1.2 port. When the P1.2 port detects a high level, the microcontroller timer records the time T2 from the start of charging to the P1.2 port transitioning to a high level.
5. From the voltage formula of the capacitor
It can be obtained: T1/RK=T2/RT, that is, RT=T2×RK/T1. The resistance value of the thermistor RT is calculated by the microcontroller. And the temperature value can be obtained through the look-up table method.
As can be seen from the above, the error of the temperature measurement circuit comes from the following aspects: the timer accuracy of the microcontroller, the accuracy of the RK resistor, the accuracy of the thermistor RT, and the output voltage value of the microcontroller, the gate embedded voltage value and capacitance accuracy. Therefore, if the accuracy of the thermistor and precision resistor is appropriately selected and the operating frequency of the microcontroller is high enough, better temperature measurement accuracy can be obtained.
When the microcontroller uses a 4M operating frequency and RK and RT are resistors with 1% accuracy, the temperature error can be less than 1°C.
If P1.2 has the function of external rising edge interrupt, the program can be simpler and the effect will be better.
- How to Make a Soft Latch Circuit
- Introduction and principle analysis of switching regulated power supply
- Single-power supply circuit for ISO122P/ISO124
- A small and easy-to-make fast charger
- 3~15V 10A adjustable voltage regulated power supply
- Electric bicycle battery charger circuit
- Design of electric vehicle charger
- Mc34063 MP3 Switching Charger
- A low-cost, high-reliability battery charger for electric vehicles
- Circuit diagram explanation: simple switching power supply circuit diagram
- Teach you a reliable new method to implement overvoltage protection for electronic signal inputs
- Isolation technology that maximizes power efficiency and minimizes radiation
- Single chip multi-microcomputer system sharing RAM circuit
- Basic application circuit of AD590d
- Small power electric heater temperature detection control circuit
- M62430 typical applications
- Milk thermostat controller circuit
- Typical circuit for connecting MAX1101 and microcontroller
- Microcontroller remote key input circuit
- Microcontroller universal digital tachometer circuit