Keyfob Hey Siri

by Chemiker in Circuits > Arduino

96 Views, 0 Favorites, 0 Comments

Keyfob Hey Siri

cover.png

Wouldn't it be great to have "Hey Siri" voice control over your old Burglar alarm? You could activate your alarm from anywhere on the planet using your phone. You could use Apple's automation features, like automatic disarming when you return home. It turns out that any old alarm, or anything in general with a remote control keyfob, can be integrated into the Apple HomeKit smart home framework using an esp32 microcontroller, a few simple components, and the HomeSpan library. This tutorial requires you to have an iPhone and either an Apple TV or a HomePod. The latter devices provide the Apple Home Hub which is Apple's smart home server.

Supplies

2x PIC817 optocouplers

2x 330 ohm resistors

1x ultra small buck converter (~$1 to $3 each on ebay)

1x ESP32, S2, S3, C3, or C6 microcontroller (Read HomeSpan documentation)

1x1000 uF electrolytic capacitor

1x1N4001 or similar power diode


Note: I've designed this project to run from 12V because I have convenient access to a 12V behind a wall at my burglar alarm keypad. You may want a different power option.

Circuit Diagram

12.png
keyfob_recovered_schem_PNG.png

Solder the components to a perfboard, or get this board manufactured. To print the PCB, upload the entire zipped file to the "instant quote" part of jlcpcb. If you decide to use my PCB design, then you'll specifically need an esp32 devkit V4. The polarity of the optocoupler-keyfob connection needs to be correct. If you're not using exactly the same keyfob as me, then dismantle your keyfob, power it up, and measure the voltages on either side of the push buttons. My Bosch 880 alarm keyfob has a common +ve for all the push-buttons, but different keyfobs might be configured differently. After soldering the wires to the tiny exposed solder pads on the keyfob, I put some hot glue on the wires to protect the joins. 

The buttons on my bosch880 keyfob have to be pressed down for slightly less than 1 second to trigger any action. That functionality is programmed into the Arduino code (below). Install the very awesome HomeSpan library in Arduino via tools -> manage libraries -> search for HomeSpan. I installed HomeSpan v2.0.0 using Arduino V2.3.3 with the Espressif board manager V3.0.7. If you use the same versions that I did, then you’ll need to change the partition scheme in order to fit the firmware onto the flash memory. Under tools, change the partition scheme to Minimal SPIFFS (1.9MB APP), and then upload the code.

Finishing Touches

Once you've uploaded the code, open the serial terminal and change the baud rate to 115200. Enter a question mark into the serial terminal and press return. A pretty self-explanatory menu pops up, and you can connect your esp32 device to your wifi network. You'll have to change the Apple pairing code. That's done by entering the letter S followed by eight digits into the serial terminal and then return (no spaces or quotation marks). Open the home app on your iphone, click the little + symbol in the top right-hand corner, and then click "Add Accessory". The phone prompts for a QR code. Click "More options" and you should see your HomeSpan accessory. You'll need to enter that eight digit pairing code that you programmed in before. When naming your switch, avoid using the word "alarm" because that confuses Siri with other functions on your phone. I called my switch "security system" which works fine. That's it!, you now have a voice controlled switch on your iPhone that mimics your keyfob.