Battery in my thermometer died, so instead of replacing the battery I decided to build my own thermometer. As additional challenge I decided not to go to sleep until the project was finished (see timeline section below).
Hardware isn't too much complicated: it consists of ATtiny13 microcontroller, three 74HC595 8-bit shift registers that control 21 LEDs and a DS18B20 digital thermometer. It's powered by 12V wall adapter. At first I used 7805 linear regulator to get 5V, but on second thoughts I added step-down converter between wall adapter and 7805 to drop voltage to around 7V.
Shift registers are daisy-chained together, so only 3 pins of microcontroler are used (DATA, CLOCK, LATCH). Additional pin is used to control the minus sign. Temperature is read from DS18B20 via 1-Wire interface.
Circuit was built on perfboard to speed up the project. I tried to lay wires in a neater way than usual, so the board looks pretty good (although wires should be on components side). 7-segment displays are made from 5mm red LEDs. I chose this approach instead of using ready-made displays to achieve offbeat look.
Since this project was created in "speed-mode" the software isn't really tidy, but it's worked well for last 18 months. All it does is send "make reading" command to DS18B20, waits 750ms, reads the temperature, does a bit of calculations and shifts out data to displays. 1-Wire communication is implemented programatically. Nothing to write home about. In case you wanted to take a look at my code (it's ugly, I warn you), check GitHub link in Links section.
The only "mechanical" parts in this is project are plastic stand-offs with screws that enable the device to be placed vertically without collapsing.
- 18:30 26.02.2015 - project started
- 0:45 27.02.2015 - soldering finished, started coding
- 4:45 27.02.2015 - project finished
What I've learned
- data from DS18B20 is two's complement and how to decode it
- how to properly shift data to 74HC595
I really like this project – although it was a quick build, the thermometer’s been working for 18 months (I only had to change one burnt LED and solder new wires to the thermometer). The no-sleep-until-finished idea was pretty cool (at least that’s how I perceive it now, back when I was debugging my code at 3 a.m. I might have different opinion).