PIC Microcontroller project – 24 hour clock and thermometer displayed via 16f690 microcontroller and LCD programmed in C
I got to thinking that an interest in hi-fi can be a bit geek ( in a good way ) so I thought one of my latest geek projects might be of interest to some of you. You could build the project ‘as is’ without learning embedded C programming or you could use the project as a spring board to extra geekiness and weekend fun – I’ll leave that to you
Learning embedded C can be hugely rewarding and creative. The tool chain needed to get you started is either free (MPXLAB IDE and XC8 C compiler are both free downloads from the Microchip website and the pickit 3 needed to download compiled C code to your target microcontroller (16f690 in this case) is less than 50GBP.
You might be wondering why this project might be interesting to hi-fi enthusiasts. Well I have a few suggestions … the finished project will allow you to keep tabs on the temperature of your listening room via an LM35 temperature sensor, which is important not just for your own comfort, but electro-mechanical devices such as turntables, phono cartridges and loudspeakers or headphones perform best at temperatures that are comfortable to humans like you and me – 18 Celcius to 23 Celcius for example.
The other feature, the 24 hour clock is simply a clock as implemented at the moment, which is always useful in a gadget, but with additional software development could be used to time the hours of phono cartridge use, or if you have a valve amplifier the hours of valve usage. Either way it’s a great feature as it is and leaves further firmware development up to your imagination.
Here is a roughly drawn but accurate schematic circuit diagram and also the full C source code plus full build details – if you have any questions or queries please ask! Have fun…
Here is the finished prototype with a few changes in the firmware – degC now replaced with a more elegant representation, plus some fine adjustments to timer 1 overflow to fine tune the clock accuracy
Here’s a top view showing the sandwich construction of the thermo_timer – the front is a layer of 4mm clear acrylic, then brass pillars stand this off from the strip board circuit board. Another set of brass pillars then stand off the second layer of 4mm clear acrylic.
Here is the rear of the prototype which shows how simple the circuit really is – just a Microchip PIC 16f690, an LM35 temperature sensor which generates 10mV/ degree Centigrade, a contrast potentiometer for the LCD, and two push buttons to set hours and minutes of the clock.
Schematic circuit diagram of 16f690 thermometer clock project
And here is the C source code for the clock thermometer project, which has been complied with the free Microchip XC8 C complier and downloaded to the 16f690 with Microchip MPLABX IDE. Feel free to copy and use/ enhance this code to learn more about the C language and the PIC range of Microcontrollers, as I did and am still doing I’d be really pleased if you would link to this page if you find it helpful.
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
JLCPCB Prototype: Only $2 for 10pcs 10×10cm, 24 hours Quick Turn, DHL Delivery in 3 days
Current Project / Post can also be found using:
- 16f690 project
- 24hr timer source code for Pic16f877a