The thermometer shown here is “micro” not only because it is built around the ATtiny13 microcontroller, but also because it can be built as a miniature device when built from SMD components.
The temperature is measured by a DS18S20 high precision 1-Wire® digital thermometer from Maxim. The program inside the ATtiny13A microcontroller initiates a single temperature conversion, waits until the conversion has finished, then reads and displays the result. the temperature can be read by counting red and green blinks from a two-color LED. For example, 2 red and 3 green blinks will be produced if the temperature is 23°C. Blinks are easily readable because each blink lasts approximately 135 ms and is followed by a 400 ms pause.
The same LED pair is used to display other events, too:
1. When the temperature is negative (centigrade value), an R-G-R-G sequence with no intermediate pauses stands for the “–” sign (red and green blinks are clearly visible); 2. 0°C is displayed as a 1 second long sequence of short red and green blinks (red and green light blend together); 3. A communication error is displayed as a 1- second long red light. As indicated in the circuit diagram, two different two-color (red + green) LED types may be used: 3-terminal (with common cathode) or 2-terminal (with red and green LEDs in antiparallel connection). The ATtiny program is the same for both versions. Since LEDs consume most of the power, choose an appropriate value for R2 to suit your own needs. A 100 Ω resistor results in an 8 mA current flow through the LED that’s switched on.
During the display period, the LEDs are on at a 25% duty cycle, with 1 second conversion periods between two display sequences to reduce the average LED consumption to roughly 1.5 mA. This may be considerably lowered if two separate red and green low-current LEDs are used for display. But even with 20-mA LEDs, the circuit may be powered by a small 3 V Lithium cell for a good period.
Although in theory, the instrument can measure temperatures between –55°C and +125°C, in practice it seems prudent to stay within the –15°C to +50°C range.
The DS1820 can be detached from the rest of the circuit for as far as the 1-wire protocol allows; a 3-m (10 ft.) connecting cable was tested and everything worked well. If the sensor is properly insulated, you can measure the temperature of water or other non-aggressive liquids. But the most common use of the proposed circuit is to build a small and simple thermometer with low power consumption, which will be at hand and functional whenever you need it.
With JP1 closed the readout is in ‘modulo 5’ mode: each blink of the red LED now equals 5, while the green blinks are still unity. Thus 4 red and 3 green blinks will occur if the temperature is 23°C.
If JP2 is closed, the microcontroller goes into power-down mode if the temperature is measured and displayed for the first time. This option consumes minimum power. To repeat the measurement, switch off the thermometer, wait for 1 to 2 seconds and switch it on again.
The program developed for the project is called ‘EE_micro_T.bas’ and was written in BascomAVR for compiling and turning into object code. A small extract is shown here. The complete program is a free download . Those without access to an ATtiny13A programmer or BascomAVR may buy their ready-programmed IC through the same web page.
Readers preferring Fahrenheit temperature readout should modify the BascomAVR program accordingly. www.elektor.com/090634