©2018 by Smithbe.me.

  • fezec

Alexa and IoT

Updated: Feb 1, 2019

If you are old enough to remember the Disney Original Movie labeled "Smart House", I don't have to remind you how the 90's made us yearn for days with robot butlers, sidewalks that would act as conveyor belts, flying cars, and of course smart homes. It took some time, but we inching closer to the catalyst.

Technologies such as Alexa, Siri, Google Assistant, IFTTT and Tasker among others- are breaking down the barriers while enabling the DIY community to tap into the future now.

About the Build

In this project, I leveraged the ability of Alexa, to create a custom Skill, leveraged Amazon's MQTT and a Raspberry Pi. Amazon's MQTT provided a perfect means to broker messages between a publisher and a subscriber. Setting the Pi up as a subscriber was also mighty convenient. Amazon IoT provides the an easy setup for device authentication. This is an important aspect because without it you are responsible for ensuring only authorized broadcasters/listeners have access to your PUB/SUB. Once my Raspberry Pi was registered with Amazon Web Services (AWS), I assigned it as a subscriber to MQTT in order to receive and respond to events.

As this is not an article to address how to create an Alexa Skill, I will skirt over the details of the application. What is important to know is that within the receiver of an intent, I have a behavior to publish a message to the broadcaster. The broadcaster in turn informs the Raspberry Pi, our only subscriber. From there, I have a custom python script, that acknowledges the message, and trigger using the onboard PI.GPIO. You can see this in action in the video below.

In this video, I paired a Raspberry Pi, Alexa and IoT, and Hardware together to achieve hands free DIY voice activated behavior.

As witnessed in the video, I ask Alexa to Open the skill called "Westley Cat", which prompts me to ask "todays meds". Upon invoking the "today's meds" intent, a sequence of LEDs on the solderless breadboard begin to light up one after the other.

Instead of lighting up the LEDs using multiple PINs from the GPIO, I rely instead on a 4 bit Shift Register (SN74LS195AN). While I could have easily used 4 pins, if I wanted a more compact design, I would likely need to ditch the number of GPIO. The incorporation of a Shift Register would be able to offset this void.

While the project itself is not all that impressive, it simply reveals the potential. Especially in the Sector of Pharma. Instead of turning on a sequence of LEDs, it could have easily opened and dispensed pills for the indicated day. Taking it a step further, If the device was paired with a camera and AI, it could determine if pills were inserted into the mouth. From there, a Database could be updated to inform the system or Health Care Provider that pills were taking for the day. It could even inform the Patient that they've taken a pill if they forgot they already had. The potential is only limited by our imaginations and potential connections to the internet.