 Yeah, so I would like to share how I learned to automate my home ceiling fan to control it using HomeKit and Google Home. So first, a bit of introduction about myself. I'm not a hardware engineer. My background is in biology, but I'm an iOS developer. So the final year of my studies, I founded the first two companies. The first one, it tells us about the arrival time. The second one is a company that makes mobile apps for clients. Then few years back, I started another company with my friend. It makes productivity apps in the app store. So this is my first home automation project, not the hardware one. So there's no sound, right? Sorry. Yeah, there's no sound, but... But this project uses Google Home, and you ask Google Home for the bus arrival time. No sound? OK, it's fine. So this is my first home automation project, so it's just purely software. Then about the current project that I'm going to talk about is my first hardware project. So I've always wanted to try something with home automation and hardware. So the best way to learn is to find a project to do it. So why automate my home fan? So I have two ceiling fans. One in the living room and one in the bedroom. They are identical models, and they are two separate remotes. But the wall switch is quite annoying. You can only turn off from the wall. And when I turn on on the wall, I have to go to the remote and turn it on again. So I have to rely on the remote. Also I've been using Apple HomeKit to control my likes and door locks. And there are limited options for RF remotes that work with HomeKit. So that's why I thought this is the perfect project to start with. So I needed to choose the right platform and hardware. Since I'm already using Apple HomeKit to control hue lights and August lock, so it's a natural choice for me. So HomeKit is a framework to control devices at home. So you can control from iPhone, Apple Watch, or Apple TV. Then Homebridge is an open source Node.js server that emulates the HomeKit API. So you can add plugins to add support for devices that don't support HomeKit. And then Raspberry Pi because it can run Homebridge. Also I met Sian a few months ago and she said I should start with Raspberry Pi first because I'm familiar with the UNIX environment. Since my remote is RF remote, so I bought some receiver and transmitter. I wasn't sure what frequency to get, but 433 mega seems to be the common one. So I just took a guess and I kind of got it right. So since I'm new to this, so I just bought a starter kit because I wasn't sure what I need for the project. So this is how I plan the project. First I need to set up the Raspberry Pi. Then for some basics, I googled out how to do some LED tutorial. And then I need to learn the signal from the RF remote and broadcast it to test if we can control the fan. After that I can do the HomeKit integration. So I spent my weekend on the project from stepping out to completion of the HomeKit integration. So the starter kit comes with a lot of parts that I didn't know that I need. For example the GPIO to breadboard, breadboard jumper wires. I didn't know all this so it's great that I bought the starter kit. And I googled out how to connect them. So the way I do things is I hack first and I understand later. So I don't really know why the pins are connected that way. So first thing, learning the RF signal. So I installed a program called P-Lite. It's an open source home automation solution that runs on small factor computers. It has a lot of functions but I'm just using the RF function. So to configure that, my transmitter is connected to pin 17 and the receiver to 27. So if I refer to this table, I can set where the sender and receiver location is. Then I need to... Yeah, that's what I did. I run P-Lite Debug to read signal from the remote. So when I run this, there are a lot of noise signals so I need to manually filter them. So the signal that comes from it is a series of numbers that measures the time difference between high-low and low-high transition. For some reason, there are just a lot of signals even when I'm not pressing my remote. So I had to go through each manually. Then I broadcast the signal to test whether they work using P-Lite send. So you see that that's what I copied from P-Lite Debug. Yeah, so this is the fan and then I run from command line. Yeah, it turns on the fan. So I repeat it for both remotes and all the buttons on the remote to turn it off and high, low and medium. So now that I can control the fan with the command line, I need to... I can start working on HomeKit integration. So in iOS, there's an app called Home. And it controls all accessories that are HomeKit compatible. And Homebridge emulates a HomeKit compatible hub. And a hub can have multiple accessories. So once I add Homebridge hub to HomeKit, anything I add to Homebridge will be automatically added to HomeKit. And to add a new accessory, I just need to create a Homebridge plugin. So for HomeKit integration, first I need to create an API to broadcast the signal. So this API is just writing a REST API that executes P-Lite send in the command line. Then so, yeah, so I have two fans. So one is the living room fan and one is the bedroom fan. And I set the signal, so zero is turning off, then one, two, three is low, medium, high. So I have to learn it for individual remotes. They can't be reused for other remotes. And then I took an existing plugin. So this plugin, it controls a three-speed fan, which is the same as my fan. It also has a temperature sensor, but mine doesn't have. So I remove the temperature sensor and I modify it to call my own API. Then configure Homebridge to add the fan. So this is Homebridge config file. So I set it, so the accessory RF remote fan is the accessory type. So I added two RF remote fans, one in the bedroom on the living room with the device ID. So the device ID is what I used to call the API so I can identify the fan. Then just restart Homebridge for changes to take effect. So once I've added Homebridge to HomeKit, then I can see all the accessories. So the living room fan and this is just a living room fan. Yeah, Homebridge you can use to add a lot of other things. So you can see that I even have an outlet for controlling mosquito repellent here. So integration is quite easy. So you can see that it already appeared in my phone. I can control the living room fan, set the speed here. And yeah, that's a very easy project to start with. And after that, I thought since I'm using Google Home, why not support that as well? So I use the same API that I wrote for Homebridge and then I use IFTTT. So IFTTT is a web service where you can have a trigger that trigger an action. So my trigger is Google Assistant, so it runs on Google Home. And then the action is Backhook. So Backhook I can run REST API. So I set up phrases that I can use to turn off the fan, set the fan speed. So I have a lot of these applets. These are called applets. They're all workflow, so yeah. So just different command to do different things with the fan. And yeah, that's all. Yeah, that's the end of the project. Yeah. Thank you, Homechain.