This project is a variation on the Remote Control Rolling Shutter project that I posted earlier, see:
The biggest difference is that I did not only prototype this project but I actually build it to be used in my home.
At home I have an electric fire place which has a heater on board. The problem with the heater is that it has a fan which makes a lot of noise. Since I like the fire place to generate some heat, I bought an Infra-Red Panel and mounted it above the fire place.
The electric fire place can be controlled via a Remote Control which uses the popular NEC protocol. The Remote Control has two buttons, ‘on’ and ‘standby’. My project was to use this Remote Control to control the Infra-Red Panel too. Of course I could create a circuit that switches it on when you press the ‘on’ button on the Remote Control but I do not always want to switch the panel on when I switch on the fire place.
What this circuit does is the following:
- When the ‘on’ button on the Remote Control is pressed for more than 3 seconds, it switches on the Infra-Red Panel
- When the ‘standby’ button on the Remote Control is pressed it switches off the Infra-Red Panel immediately
- If the Infra-Red Panel is switched on it will automatically be switched off after 4 hours. This is just a safety measure to prevent that the Panel stays on forever
- For safety reasons the circuit uses the on-board watchdog of the PIC. If for some reason the program hangs, the circuit will be reset and the Infra-Red Panel will be switched off
As always I used a PIC microcontroller and created all software without using any specific libraries. Arduino fans can use of course do the same or use the libraries that are available for e.g. the Remote Control decoding part.
Step 1: Required Components
You need to have the following components for this project:
- A piece of breadboard
- PIC microcontroller 12F615
- TSOP4838 Infra-Red receiver
- Fuse holder + fuse 4A/250V
- Ceramic capacitors: 2 * 100nF
- Resistors: 1 * 33k, 2 * 180 Ohm, 1 * 2k2
- LED: 1 Amber, 1 Green
- Diode 1N4148
- BC640 transistor
- Relays operating on +5 Volt and capable of switch sufficient mains power. I used: https://www.aliexpress.com/item/5pcs-SRD-05VDC-SL...
- 5 Volt Power supply sufficient to power the circuit. I used: https://www.aliexpress.com/item/5V-700mA-3-5W-AC-...
Step 2: Building the Electronics
You can build the circuit on a breadboard but be very careful with the Fuse and the Relays that switch the mains power for the Infra-Red Panel. Do not touch the mains power in any way!
In the pictures you can see the circuit as I build it on the breadboard. I needed to put it in a housing but since this housing is not visible – the whole circuit is placed behind the electronic fire place – I made it of MDF. The Infra-Red sensor and the ‘On’ LED are connected to a cable and are mounted with some tape under and at the front of electric fire place.
I did not measure it exactly but the circuit draws about 90 mA when the relays is switched on. The relay is the component that draws most of the current, about 55 mA. The power supply used can easily provide the required power for this circuit.
Step 3: The Software
As already mentioned, the software is written for a PIC12F615. It was written in JAL. Since I did not use any specific libraries the total code size is 626 bytes which fits nicely in the 1k program flash memory this specific controller has.
The software performs the following main tasks:
- Decoding the Remote Control messages. For this it uses a capture timer that captures the duration of the bits. The decoding routine works completely interrupt based and uses each bit level change of the RC message by constantly changing the interrupt edge level. This increases the reliability of the decoding routine.
- Switch on the relays when the ‘on’ command is received for more than 3 seconds. Note that the NEC protocol only sends a command once after which it sends repeat messages. The program waits for the ‘on’ command and then counts the number of repeat messages that have to be received within a certain time frame
- Switch off the relay when the ‘standby’ command is received
- Switch off the relay after being on for 4 hours
- Kicking the watch dog on a frequent basis. The watchdog will not reset the controller if it is triggered each 18 ms. The main program uses a loop time of 1 ms in which it kicks the watchdog and so prevents the dog from barking.
The PIC controller runs on an internal clock with a frequency of 8 MHz. The Intel Hex file and the JAL source files are attached.
Have fun building your own project and looking forward to your reactions.