Introduction: Arduino and Apple HomeKit Integration - Control Your Home From Siri! IoT Is Here

About: @arduinoblogger

This Instructable will give you a quick and easy way to add an arduino board to Apple's HomeKit on an iOS device. It opens up all sorts of possibilities including Scripts running on the server, combined with Apples HomeKit "Scenes", it makes for a powerful combo!

This is by no means a complete solution or ready for long term use but it demonstrates what's possible with a bit more work :) Check out my blog for future projects www.arduinoblogger.co.uk

Whats needed:

  • Arduino with Ethernet Shield or WiFi
  • Raspberry Pi or some other server
  • Solid State Relay or Normal relay with control circuit
  • Bread board - optional
  • Project Box
  • Some Time
  • iOS device
  • Extension Lead to carve up

Step 1: Setup the Server

This project requires the use of a server to run the HomeBridge software. I used a Raspberry Pi as I had it readily available but in theory anything that can run Node.Js should work!

You can follow this guide here to get this up and running on a Raspberry Pi. Other instructables are around to build a Raspberry Pi if you need those!

https://github.com/nfarina/homebridge/wiki/Running...

Once installed you need install a plugin and customise the config.json file

Step 2: Config and Plugins

Open your config.json file which should be in ~/.homebridge/config.json using your favourite text editor and add the following

{
"bridge": {

"name": "Homebridge",

"username": "CC:22:3D:E3:CE:30",

"port": 51826,

"pin": "031-45-154"

},

"platforms": [

],

"accessories": [

{

"accessory": "Http",

"name": "Living Room Lamp",

"on_url": "http://192.168.1.201:80/?on",

"off_url": "http://192.168.1.201:80/?off",

"http_method": "GET"

}

]

}

You will also need to install the homebride-http plugin. The HomeBridge software will make HTTP GET requests to the Arduino which will then turn the Solid State Relay on or off. The call looks like this:

http://192.168.1.X:80/?on

http://192.168.1.X:80/?off

To install the plugin type:

npm install homebridge-http

Step 3: Setup the Solid State Relay

I have used quite a heavy duty Solid State Relay. This can be (and will be in future versions of this) replaced for something much smaller. Obviously rate this for the load you intend to run off it.

This is effectively a 'Smart' extension lead now.

The positive Leg of the Solid State relay will connect to pin 5 on the arduino.

The negative will connect to the GND pin.

All usual warnings apply when dealing with 120/ 220 vdc - TAKE CARE.

Step 4: Connect the Solid Sate Relay and Upload the Arduino Code

Open up your arduino environment and upload this sketch.

Customise your IP address as needed.

This should now be ready for testing.

Launch homebridge on the server!

Step 5: Test!

Now that everything is in place its time to test!

Download Elgatu Eve from the App Store on you iOS device.

You should see Homebridge as an accessory available to be connected. Use the pin number 031-45-154, this can be customised in the config.json file.

Once connected you can move this around within the App into the desired Room etc. Give Siri a test! It should be able to control the relay using voice!

Step 6: Next Steps

The plan is to shrink this down and use something like a Nano and embed this in Lightswitches / wall sockets with much smaller Relays and use WiFi for a complete Home Automation system.

Hope someone gets some use out of this! Many thanks to Nick Farina for his work on the Homebridge Software!

A video is coming soon.

Check out my blog:

www.arduinoblogger.co.uk

Digital Life 101 Challenge

Participated in the
Digital Life 101 Challenge

Full Spectrum Laser Contest 2016

Participated in the
Full Spectrum Laser Contest 2016

Raspberry Pi Contest 2016

Participated in the
Raspberry Pi Contest 2016