Chatting to your alarm clock

Teenwaker: IoT alarm clock controlled by chatbot

Marko Balabanovic

Every morning at 6:45 my alarm wakes me. Not because I need to get up at 6:45, but so that I in turn can start the long process of getting sleepy teenagers out the door and off the school. Occasionally they make it out on their own, managing their shifting adolescent sleep patterns (their cruel early start is apparently equivalent to 4:45am for a 50-year-old), and their screen-induced melatonin suppression. On good days, a couple of times a year, I reflect that our time as parents will be over all too quickly, and these little moments are precious. Mostly I complain bitterly. But no more, as I have now entirely automated myself. At least the part that wakes up the teenagers.

What I would generally do is provide a cheery but quite loud good morning, open the door and turn the lights on full, with two or three repetitions often required. Though the wonders of cheap and easily available home automation kit, we now have wirelessly controlled dimmer switches in the wall, that turn on the lights remotely, and a re-purposed doorbell that can play custom MP3s, providing a poor quality rendition of me saying good morning. The resulting alarm clock system is smart enough to know that 6:45am every morning actually excludes weekends, school holidays and bank holidays (and as I created that I wondered — why doesn’t every alarm clock for teenagers know about school holidays?).

The next step was to devolve control of the system back to the teenagers themselves, allowing for different times to be set or for the alarm to be turned off when needed. And what better way to do that than to build a chat interface, the medium of choice for kids communication? The trouble with creating an all-powerful home butler character, in the style of Amazon’s Echo (or Siri, Cortana and similar phone-based voice interfaces), is that expectations are set high and the scope of what it can and can’t deal with is somewhat mysterious. Another way to control our Internet of Things devices is to create a larger number of discrete chatbots, each responsible for a specific thing. So in this case we have one “alarm” chatbot for each teenager. And naturally, you expect that you can discuss alarm times with your alarm chatbot, but not that you can ask it about the weather or the latest news. This means that the required grammar and vocabulary is nicely limited, allowing for simpler and faster development, with no need to access cloud-based natural language processing powers. In thinking through the structured life of a school-age child we can simply even further. There is a default time to wake up on a school day that is rarely changed. The interface therefore is just to allow an override for the next 24 hour period, to turn the alarm off or to set it for a different time, after which it will revert back to the default.

Dunbar’s number is “a suggested cognitive limit to the number of people with whom one can maintain stable social relationships” (and is around 150), thought to be limited by neocortex size in primates such as ourselves. Groups of around 150 are remarkably common in human societies, from villages to army units to modern day businesses. And since the work of Cliff Nass and Byron Reeves in the mid-90s we’ve known that people will often respond socially to computers, as if they are people, attributing personality characteristics, gender stereotypes and attitudes. The question then is — would we treat an array of chatbots controlling IoT aspects of our home as a social network, with the human residents in the same environment? The advantage would be that we can immediately take advantage of various conventions to allow quite complex interactions. In a social network we already understand ideas around membership of different conversations, privacy and varying levels of visibility of messages, using @ mentions to specifically address certain people, status updates, authentication, differing levels of responsiveness, different conversation styles. To control the hundreds IoT devices we’ll soon have, in a house with a family of four, this provides a scaleable and natural setting that takes advantage of complexities we’re already evolved to manage well. The alternative, some kind of complex web-based dashboard or series of apps from multiple providers, doesn’t scale well as the number of devices grows, and is already dauntingly complex for most people. However then a question would be — does Dunbar’s number still apply? How far can we scale? Does Siri count as one of our 150, occupying a little bit of our brain capacity evolved to deal with social relationships? How about our relationship with Spotify, Netflix or our washing machine?

Technical details

For those curious how all this works… the hardware part turned out to be more straightforward than I expected, and most of the time was spent dealing with parsing different ways of expressing time. By plugging a 433MHz transceiver into our RaspberryPi, and running the Domoticz open source home automation server, we have the ability to control all kinds of cheap and easily available gadgets via a simple web API. LightwaveRF dimmer switches can easily replace existing regular light switches, and an MP3 doorbell comes with both a speaker and a button. The triggering of alarms is via good old fashioned cron, that is controlled using the very handy python-crontab library. A combination of python-rtmbot and NLTK allows for the quick construction of Slackbots, and so we have a private Slack “team” for our house now, providing our chat environment in a way that is easy to access via iOS, Android or web. To genuinely scale this up to handle hundreds of separate chatbots, I suspect some rewriting of the libraries would be needed, as the working assumption is that people want to run one Slackbot on one server.


Originally published at whizzyideas.wordpress.com on April 1, 2016.

Marko Balabanovic

Written by

CTO at Digital Catapult, non-exec director at NHS Digital

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade