The IoT Church

My father in law is the Pastor at our local Church in Brooklands Manchester, over the years I have helped introduce some IT solutions. It’s become a great excuse to try new things out on a small scale and see how consumer technology can be used to solve real life problems.

Recently the church got internet connectivity for the first time and I jumped on this as an opportunity to bring a bit more automation.

The problem was fairly simple, during the week the Church hosts several sessions ranging from children’s play groups to open meals. There are large LCD screens dotted around the venue all connected to a central computer which, during these sessions display the weeks notices via powerpoint.

Previously I had setup some rudimentary automation using a time switch to turn on the power to the PC, used windows startup to kick off a presentation and a complicated set of scheduled task’s to turn the PC back off at the correct time. This was prone to failure, the timeswitch failed a few times and the scheduled task’s needed maintenance for every change.

The new solution I came up with was to use a combination of Google Calendar, Dropbox a WIFI enabled Plug and IFTTT.

First I setup a new shared calendar in Google, this was going to be our new method of turning the computer on and off.

capture

Next I got hold of some WIFI Plugs and had a play around with the options. Using these I could turn on, turn off or toggle the power (On, off, On) or (Off, on, Off).

After a bit of experimenting I had a nice simple IFTTT recipe that turned on the socket when a ChurchOn event started in google calendar.

My next issue was that I needed dropbox to complete a synchronisation so the latest powerpoint was used each day. I wrote a quick bat file (going back to my college days now) that did a 200 second countdown before opening the powerpoint file located in dropbox. This gave dropbox plenty of time to download the latest file. Adding in a switch to load the .pptx in presentation mode was the finishing touch of a very simple but effective bat file.

Next was the challenge of turning the computer off, I did not want to simply cut the power to the computer so had to investigate other options. I still wanted to use google calendar so a bit of googling later I came across this article  that talked about turning off a computer with a text message trigger and dropbox file write. This gave me the general approach for my turn off event.

Again I used google calendar to trigger the IFTTT command, this time with a ChurchOff event. Next I linked the recipe to dropbox and asked dropbox to create a new text file called shutdown.txt

ifttt

Next I setup a quick script to check for the file, delete it if it finds it then shutdown the computer. Finally I created a scheduled task to run the script every 5 minutes.

So google triggered my alert into IFTTT which told Dropbox to write the file, when the file synced to the church computer the scheduled task kicked in, deleted the file and shut the PC down.

echo off
set FileToCheck=”C:\Users\church\Dropbox\PPS for Church Monitors – 2016\Marks Code\shutdown.txt”
if not exist %FileToCheck% goto done
del %FileToCheck%
shutdown /s /t 60
:done

The one final niggle I had to contend with was the state of my WIFI Socket, the computer had turned off but the switch was still on. Sometimes the simplest method of fixing things is the best, there is only ever a single event on at church in a day so a final IFTTT recipe using the clock as a trigger turns off the socket at midnight ready for the next day.

I will probably re-visit this for a more complicated (more playing) solution later but for now the pastor is happy, he can control the powerpoint from home and modify schedules using his mobile phone

As expected playing with all this stuff is great fun, I tried a few different approaches to this but I am fairly happy with the end result. I also purchased a 2nd WIFI Plug for experimenting with at home. At the moment every tweet I get (@mrotheram) flickers a light in our lounge, why, well if nothing else just to wind up my wife a little.