The circuit and BASCOM software detailed here were developed to regulate the temperature in a laminator. Although the laminator came with its own temperature controller. It didn’t meet the author’s requirements, specifically for creating printed circuit boards using a thermal transfer method. The setup, illustrated in the circuit diagram, centers on an ATmega48 microcontroller integrated with a 2-by-16 LCD panel and a rotary encoder. To measure temperature, an ordinary NPN power transistor in a TO220 package is employed, utilizing its base-emitter junction as the temperature sensor.
Unconventional but Effective Approach
Although not commonly seen today, this technique isn’t new; Elektor published a digital thermometer design decades ago that utilized an NPN transistor as a sensor. This approach offers the advantage of a broad linear temperature range spanning from -50 °C to +150 °C. The TO220 package proves particularly handy as it includes a convenient fixing hole and heatsink, ensuring good thermal contact. Note that the heatsink is electrically connected to the transistor’s collector. So an insulating washer may be needed.
Temperature Sensing with BD243C Transistor: Operating as a Diode
The BD243C transistor is configured as a diode by connecting its collector and base, powered by a 4.7 kΩ resistor from the 5 V rail. This arrangement results in an approximate 1 mA current flow through the diode. The voltage across the diode exhibits a relatively constant negative temperature coefficient of around -2 mV/K, resulting in a reasonably linear voltage-temperature relationship. The ATmega48’s internal A/D converter is used to measure this voltage, employing input ADC5 on pin 28.
Precision Considerations and Set Point Control: Utilizing Internal Reference Voltage
It’s important to note that the 1.1 V internal reference voltage in the AVR-series microcontroller is employed for precise A/D conversion of the diode voltage drop, approximately 0.6 V. This aspect should be kept in mind if adapting the design to a different microcontroller lacking the 1.1 V internal reference. The set point for temperature control is adjusted using a rotary encoder in one-degree increments.
Display and Status Indication: LCD Panel and LEDs
The display consists of a 2-by-16 LCD panel and two LEDs. The upper line of the LCD displays the measured temperature, while the lower line shows the current set point (both upper and lower temperature switching thresholds). P1 is used to adjust the LCD’s contrast. The blue LED (D2) indicates low temperature (below the lower switching threshold), the red LED (D1) signals high temperature (above the upper switching threshold), and both LEDs being lit indicate the temperature is within the desired range (between the lower and upper switching thresholds).
Output and Control: Logic Level and Optional ISP Connector
The controller’s output is the logic level on pin 27 (PC4), which can be used to drive a solid-state relay (SSR) in applications. The circuit diagram represents this with LED D3, symbolizing the optocoupler’s LED in the SSR. The optional ISP connector K1 can be omitted if a pre-programmed microcontroller is used. Calibration of the temperature reading is only possible via the ISP interface in the software, which is detailed in the ‘Downloads and products’ section. It involves determining the upper and lower switching thresholds experimentally, accounting for any temperature measurement errors.
Calibration Process: Adapting Software and Mapping Conversion Results
Calibrating the temperature measurement involves modifying the software. Specific lines in the program (105 to 107) need to be uncommented, while others (108 to 110) must be commented out. The display will then show the conversion results from the A/D converter. The sensor is submerged in a mixture of ice and water until the reading stabilizes, and this result is recorded. Subsequently, the sensor is placed in boiling water, and the procedure is repeated. Replace the number 546 in line 86 of the source code with the conversion result for the ice-water mixture.
Next, subtract the conversion result for boiling water from the ice-water result and divide by 100, substituting this value for the number 2.460 in line 87 of the source code. This calibration assumes a linear relationship between conversion results and temperature, expressed as y = mx + c, with ‘c’ being the A/D conversion result at 0 °C and ‘m’ as the (negative) slope of the base-emitter junction voltage-temperature characteristic. ‘m’ is calculated by dividing the difference between the conversion results at 0 °C and 100 °C by 100, providing a way to map conversion results to corresponding temperatures.