Thermometer with DS18B20 sensor and two-digit LED display
I made myself a two-digit thermometer with a red ELD-515SURWA seven-segment display (soldered out of a Euroster 1100E thermostat) and a DS18B20 sensor.
The electronics fit on a 2x8 cm cutout of a 6x17 mesh universal board.
The housing is a white 2xRJ11 6P4C surface-mounted telephone socket.
Power supply from a 5 V / 120 mA switching power supply.
Schedule <br/span>
Firmware
The brain of the chip is the AT89C2051. The program in assembler takes 410 bytes. I attach the source and hex.
The thermometer can show a temperature from -9 to +99 °C.
I use the smallest resolution of the measurement i.e. 9 bits and show only the integer part of the result.
By using three wires (i.e. supplying power via a separate wire rather than parasitically), you can ask the sensor if it has finished measuring. When this happens, the program reads scratchpad , checks the CRC and updates the value on the display.
Multiplexing takes place in a timer interrupt at 1302 Hz. During the time-critical operations of receiving and sending a bit on the 1-wire bus, the interrupts are blocked (up to half a millisecond during 1-wire resets); I did not notice with the naked eye the effect of such multiplexing hang-up on the brightness of the display.
| -- | No sensor |
| E1 | The sensor reported completion of temperature measurement immediately after measurement order |
| E2 | The sensor failed to report completion of temperature measurement in a timely manner |
| E3 | CRC error data received from scratchpad a sensor |
| __ | Temperature ≤ -10 °C |
| 90c64cdcfda ^^ | Temperature ≥ +100 °C |
The sensor here measures the temperature of the hot water at the outlet of the cooker. I cleaned a piece of tubing with sandpaper and on a drop of thermally conductive paste applied the sensor with the inscription side to the tubing, stuck it on with silver repair tape and then wrapped it with a couple of layers of sponge.
It seems that despite these treatments the thermometer nevertheless underestimates the water temperature by about 2-3 degrees....
Comments
AT89C2051- I started my uC adventure with it 20 years ago. Did you write the procedure for handling 1Wire and communicating with DS18B20 yourself? How do you limit the current of the diodes in the display... [Read more]
Yes, these are my battle-tested procedures, here used in the trivial case of a single sensor on a ~20cm wire. I converted their delays to a 12 MHz clock. So far the smallest pull-up I've had was 1.5k,... [Read more]
Well yes, if the WK display is ok but the control method is a bit unusual, not very energy efficient. Regards Added after 2 [minutes]: And haven't you thought about a resistor ladder with... [Read more]
I didn't know there were such. This kind of circuit would not fit on such a small board. [Read more]
Just out of curiosity - what was dictated by this board size? It seems that the enclosure allowed the use of a slightly larger board. [Read more]
Years ago I used assembler, then fell in love with C++, I remember from assembler that it was like ploughing acres of field with a hand plough. Respect and admiration, especially for your original solution... [Read more]
The following shows that the output in the low state can accept 20mA while in the high state the current flowing out is negligible. I wonder what was dictated by the choice of this and not another uC. ... [Read more]
Way from PCF8574 note [Read more]
The choice of board and prock was mainly dictated by the fact that I had one, but I also wanted to see if I could do such a small chip with such an old proc. The port load is high, the ports have a strong... [Read more]
The microprocessor used is very cool, for many one of the first in an electronic career, due to BASCOM. The relatively small amount of ROM is enough for small projects and to practice assembler, because... [Read more]
Bascom was not as bad as it was painted. Here an example of a thermometer on an ATTiny2313 with a DS18B20. http://mirley.net/minitermometr_uniwersalny.html This project is also on the electrode as far... [Read more]
And it still isn't :) [Read more]
Many times. Well it didn't want to work the first time :) Hmm, I've done error handling though, and I don't keep flying by no matter what happens on the bus :) Well, and I put the microcontroller... [Read more]
In Bascom, one short command and the uC sleeps, error detection on the 1Wire bus - it's just testing the state of a dedicated variable, processing data from DS18B20 and converting it to degC with simultaneous... [Read more]
Tum no less sometimes it's nice to insert an insert in asm ..... [Read more]
Bravo for the assembler. Pity not at2313 :) . [Read more]
When you write identical functionality in assembler on ATtiny2313, we'll compare the conciseness of 8051 vs AVR machine code :) It seems that the AVR must lose by a landslide because: - it's RISC -... [Read more]
But in which category? Because certainly not in performance. [Read more]
Your board would fit another twenty resistors without any problem. Using SMD resistors instead of chip resistors. SMD resistors of size 0805 and 0603 fit best on such universal boards. The use of SMD... [Read more]