I've built a Kodi Hat several times, each time adding more features and making it more complex. For a while, I worked in the Hospital TV industry and I tried to start a business catering to that industry. As a result, my house has far more TVs than people.
I built a crazy complex Kodi Hat this weekend, and it didn't work. So, I decided to start from scratch and make it as simple as possible. This is my fourth or fifth revision and it is the easiest one yet!
Hats have a limitation in that it is difficult to add new features or modify them. The primary advantage of a hat is goes right over the Raspberry Pi, but most cases aren't design for a hat in mind.
So, this isn't really a hat, but a side board.
Making it an add-on board might allow for adding a supercapacitor shutdown feature in the future
Note: Something changed with GPIO 4. I updated OSMC, KODI and a few other things. In the past, setting GPIO as output to True, would make the pin go and stay high. Now, GPIO 4, goes high momentarily and the droips back to low. So, it doesn't work for fan control.
Note: The Raspberry Pi has run pins, which can be used to restart the Raspberry Pi. However, the restart is not safe. The microSD Card can be corrupt if the Raspberry Pi is not shutdown or rebooted in a safe manner.
My Kodi "Hat" supports:
an Infrared (IR) Receiver for remote control,
an Adafruit blue ring, reboot/shutdown button, and
a 3.3/5.5V fan.
A reboot button allows my family to be to reset the Raspberry Pi without damaging the system.
I am not an expert in electronics, soldering or prototyping. I found this project to be easy.
This project assumes you have a Raspberry Pi 3 B+ properly configured and running Kodi on OSMC.
Required Parts:
Most of the parts are sold in bulk. So, you will end up with a lot more spare parts than you need.
Pre-requisites:
Raspberry Pi 3 B+ running Kodi on OSMC
Logitech Harmony 650 Amazon $48.88
Parts:
Rugged Metal Push Button with Blue LED Adafruit $4.95
5V DC Fan Amazon $7.99
Perf Board Fry's $12.99 - lots of boards can be made from this
1x3 Breakaway header pins Adafruit $4.95
IR (Infrared) Receiver Sensor - TSOP38238 Adafruit $1.95, cheaper in packs of 25
3x 2.54mm female-to-female jumper wires Fry's $3.99
Reusable parts:
Needle nose pliers
Soldering iron
Tip Cleaner
Solder, well not reusable, but a lot comes in one coil
Small piece of masonite
Xacto knife or box-cutter
Optional - Medical scissors - short blade ~3/8 inches long, very sharp, strong metal - it can cut just about anything. I am not sure where I got it. I use it to trim away excess leads and to cut solder pieces to manageable lengths
Solder fan - don't breathe in solder fumes
Step 1. Components
If you want to try on a prototyping board first, start here: Instructable on prototyping on a perf board.
Components:
1x3 Breakaway header pins
IR (Infrared) Receiver Sensor - TSOP38238
Put the components' pins through the perf board holes. Bend the leads of the TSOP38238 at a right-angle so they touch the corresponding pins of the 1x3 Breakaway Header.
Step 2. Solder components and wires on the perf board
Instructable on soldering.
Ensure the soldering iron tip is clean.
Touch soldering iron to one pin, count to 3, touch the solder and remove the solder and then the soldering iron
Not all the pins on the header need to be soldered, just enough to make it stable
Trim off the excess leads
Step 3. Make sure the IR Receiver works
Shutdown and power off the Raspberry Pi using the command:
$ sudo shutdown -h 0
Attach the hat to the Raspberry Pi. Be sure the header and pins are properly aligned, otherwise, you might destroy the Raspberry Pi. Apply power to Raspberry Pi
I use a Harmony Logitech 650 with the Raspberry Pi running Kodi/OSMC set up to be controlled via a Silver Apple Remote. In the MyHarmony program, to control the Raspberry Pi, I use:
Activity: Broadcast TV - Watch TV renamed to Broadcast TV
Device: TV, whatever you have
Device: Apple TV
Rename the device to: Raspberry Pi
Manufacturer: Apple
Model: A1378
In Kodi, under My OSMC, set the remote to the Apple Silver remote
In Kodi, under Pi Config, Hardware Support, enable gpio_out_pin 17
Step 4. Connect Jumper Wires
Connect jumpers from hat to GPIO pins
Connect jumpers from fan to GPIO
Connect jumpers from Push Button to GPIO
Connection directions are in the scripts. The GPIO pin numbers can change to accommodate your needs
Step 6. Get simple fan to work