PIC 18F45K22 was one of my favourite microcontrollers. I have used it on many boards.
Of course, it may seem like a trivial control unit but it can be very useful and versatile to manage any system according to temperature, humidity and time, taking into account 1, 2 or 3 of these parameters. And what about the satisfaction of having made it?
The purpuse of this control unit
The purpose of this control unit is to maintain an ideal habitat for my water turtles
(Trachemys scripta scripta ).
Their optimal habitat is one with:
- a temperature of 20 to 28 °C
- humidity 50-70%.
- 10-12 hours of light
Initially, I had solved the problem with two mechanical din rail clocks to regulate
pump, heater and light hours.
Then, as I had the turtle tank in my room, I found the ticking of the two clocks and the operation of the pump annoying... I had to find a solution! And here is the idea of this control unit.
By managing temperature, humidity and time with this controller, I have also been able to improve the habitat of the gentle tortoises:
- I set the pump off time from 11.30pm to 8am allowing me to go to bed without being disturbed by its operation.
- I set the heater to run from 7.00 to 17.00.
- The UV light from 8.00 to 20.00 (energy saving, does not generate heat).
- The IR heating lamp is controlled according to the temperature read by the temperature sensor.
Let's create this control unit
I have built the control unit using demo boards that I produce.
Everything was assembled on the larger demo board and the connections made with wire-wrap.
The software was written and compiled with CCS C with which I am very comfortable
and from the statistics on their website, they believe it creates more contained
machine code than other compilers.
It was April 2012 !! Ten years ago !!
Source code and statistics
You can download the source code.
It is covered by the GNU/GPL licence.
Compiled with CCS v.4.123
Resource usage: about 61% ram and 70% rom.
By modifying the program to handle 6 relays, ram usage is about 91%.
70% of the time spent writing the software was managing the navigation menu and all the display screens.
It took me three weeks to develop the electronic circuit and make this assembly.
For the development of the software it took 3 months, but I started from a software that I had already written 4 years before, in 2008.