Temperature Switch for 12 V DC fan — powered from solar battery bank

My brother-in-law mentioned that he needed a thermal switch for the fan in his shed. The building works as a heat-trap during the day, and he’d like a way of blowing the hot air out, so that it’s more habitable when he gets home from work.

I have an abundance of Picaxe chips, so that’s what I decided to use for this project, specifically the 20M2 variant. I also used a second chip to make a serialised LCD: This means the main chip only needs one data line to operate the LCD. It also made testing & development easier for me.
I could have used a RaspberryPi Zero, but I’m still at beginner level with Python, so this would have ended up as a winter-heating project instead!!

Generic LCD with a serial backpack, using an adaptation of PICAXE’s code for their AXE133Y modules: http://www.picaxe.com/Hardware/Add-on-Modules/Budget-Serial-OLED-Module/
The time taken to build this little board was absolutely not worth it — for about £4 a generic PCB can be bought, that will do the job!!

The chip running the main programme was mounted on a kit PCB from CPC — this little kit comes with everything needed to programme and house the PICAXE 20M2 chip:

The RKP20c kit used to home the main chip. Much quicker and easier than using stripboard! http://cpc.farnell.com/rk-education/rkp20c-kit/project-pcb-for-20pin-picaxe-genie/dp/ED00014?

The main programme measures the ambient temperature and compares this to the user-set temperature: if equal to or above, then the fan switches on. Hysteresis of 2°C is written in to the programme, which may need altering, but testing needs to be done.

The temperature probe is a DS18B20, and support for these devices is written in to the PICAXE firmware. This makes things easy!

A hole can be drilled for access to the programming socket, but it may not need reprogramming…

I’ve made this project modular for two reasons: 1) I only have short periods of tinkering time, and can easily forget where I got up to with large projects, and 2) it aids fault-finding.
A third benefit is being able to use manufactured modules / kits instead of Veroboard. E.g. the relay module kit cost about the same as a relay on its own!

When the user changes the trigger temperature, it is stored in EEPROM in case the power is turned off. The value is loaded upon power up, with the assumption that the user will have an optimum temperature.

All the boards in the enclosure. C/W from top left: microprocessor with main programme, serial LCD driver (stripboard), generic LCD (green), voltage divider (small piece of stripboard in yellow heatshrink), relay module, 5V regulator (bottom left).

As this is running from a solar installation, it makes sense to monitor the voltage of the lead-acid battery, AND have a cut-off should the voltage fall too low.
Because this is a 5V system; a voltage-divider is required to measure higher voltages, so that the chip isn’t fried by receiving a voltage higher than its supply voltage. This makes use of the established potential divider equation:

V_out = (R2 / R1 + R2 ) • V_in

There is also a piezeo disc that will sound a warning if the battery voltage is too low.

The yellow button in the middle changes the mode of the unit from ‘Auto’ to ‘on’ to ‘off’.

Auto mode shows the ambient temperature, user-selected temperature, and battery voltage (visible in all modes)

Over-ride mode shows ambient temperature, ‘FAN ON’ (the purple LED indicates the relay is activated), and battery voltage

‘OFF’ mode operates as a temperature gauge and battery monitor, for cases when the fan isn’t likely to be needed. It also mutes the piezo sounder for cases when the battery voltage is low.