Thursday, 29 November 2018

Autogate Adventures: Voice Control via Google Home. Part 1 of 2: Sonoff Basic

About a year ago I decided to maintain the autogate myself, and naturally could not resist adding a Bluetooth remote function, in addition to its keychain RF remote control. Later I added a Raspberry Pi Zero W IoT gateway, which let me control it from my smartphone. The next step would be to make it a smarthome device - voice control via my Google Home speaker or Google Assistant on my phone.

The obvious way would be to use an ESP8266 relay board, MQTT and IFTTT like I did for my ancient lantern, but there were a couple of problems. First the MQTT code would stop working after a few days. Secondly I had not figured out how to share the device on Google Home with my wife. So I though I would use a commercially-available IoT device, a Sonoff Basic.

Sonoff Basic was RM23 from Lazada
There was no trouble sharing the Sonoff Basic with home members and it was a lot more reliable. I had been using it to control some of the lights in the house. The Basic takes 230Vac input and puts out 230Vac when it turns on. But the autogate needed a dry (ie voltage-free) contact, so I simply added a 230Vac relay , an Omron MY2N.

Omron MY2N 230Vac coil relay, RM10 
I found difficult to mount in the available space in the autogate enclosure, so eventually replaced it with a solid-state relay, the Omron G3TA-IAZR02S.

The OMRON G3TA-IAZR025 was a whopping RM45
Sonoff Basic converted to output dry contact
It worked ... here's a video ... sort of. Trouble was the autogate controller needed a pulse to toggle the gate open and shut. The Sonoff Basic puts out a steady on or off command. Opening the gate was easy:

"OK Google Open autogate"

Now I need to deactivate the signal to the autogate controller, so

"OK Google Close autogate"

But the gate is still open, so now it is time to close it:

"OK Google Open autogate"

And then

"OK Google Close autogate"

It took all of 15 minutes before I got tired of it. I guess it is time for Part 2.


No comments:

Post a Comment