With 41% of poisonings happening to children under 4, more needs to be done. We use Amazon Alexa and Intel IoT to lock and unlock cabinets.
Personal care, cleaning, and pain reliever products are the top three poisons children are exposed to in the USA. We have built a way that those products can be easily secured through the use of Intel IoT installed in each cabinet working in concert with Amazon Alexa to provide voice controlled unlocking.
Data:Poisoning is a problem around the world. From US poison data we can see that poisoning of children is still a big problem.
UL data shows that the US isn't even low, so there is a lot of improvement that can be made: http://ulsafetyindex.org
The Amazon Alexa system accounts were created and the supplied tutorial was followed to show that we could actually get something working. The Tap device experienced WiFi connectivity issues for the first day so the web based speech and text input systems were used extensively. The functionality was then adapted to work with the cabinet safety speech phrases.
The Arduino 101 with the Grove IoT kit was initially explored with the Arduino IDE to validate basic functionality. We then followed the tutorial provided by the Intel development team to upload the Firmata project and connect the Arduino to the Intel NUC. Edits were made in the Firmata to drive the uni-polar stepper motor.
Once the Arduino was set up, the next step was setting up the Intel NUC according to the tutorial. We initially tried using the “RED” graphical programming interface, but transitioned to using the python scripts so that it could easily communicate with AWS and Alexa.
Architecture:To teach Amazon Alexa a new skill, we defined the interaction with the users voice commands. There are two major Intents, the UnlockIntent, and the LockIntent. A custom slot was used for each of the potential areas of the house we would want to manage a cabinet in.
These resulting utterances are the building blocks to how the user interacts with the skill:
UnlockIntent unlock {DeviceState}
UnlockIntent unlock the {DeviceState}
UnlockIntent please unlock the {DeviceState}
LockIntent lock {DeviceState}
LockIntent lock the {DeviceState}
LockIntent please lock the {DeviceState}
To make use of the Amazon Touch in their kitchen, a parent could use the phrase: "Alexa, ask kitchen safety to unlock the kitchen cabinet". Similarly, the a phrase would be used to lock when done: "Alexa, ask kitchen safety to lock the kitchen cabinet". Once Amazon Alexa has push notifications released, this will be updated to remind the parent that they need to lock their cabinet again.
AWS Lambda
Once Alexa has recognized the phrase, a message is passed to a microservice running on AWS Lambda. The following is a short snippet of what a single intent looks like:
'UnlockIntent': function () {
var speechOutput;
var itemSlot = this.event.request.intent.slots.DeviceState;
console.log("itemSlot: "+itemSlot);
var Device_States="none";
if (itemSlot && itemSlot.value) {
Device_States = itemSlot.value.toLowerCase();
}
console.log("Device_States: "+Device_States);
var deviceState=null;
switch (Device_States) {
case "kitchen cabinet":
blue_state = 1;
deviceState = [
{'state':{ 'desired':{'device':'NUC-Gateway','red_led':red_state,'blue_led':blue_state}}}
];
speechOutput="kitchen cabinet now unlocked";
break;
case "laundry room cabinet":
red_state = 1;
deviceState = [
{'state':{ 'desired':{'device':'NUC-Gateway','red_led':red_state,'blue_led':blue_state}}}
];
speechOutput="laundry cabinet now unlocked";
break;
case "none":
default:
speechOutput="ok, goodbye";
break;
}
if (deviceState==null) {
this.emit(':tell',speechOutput);
} else {
AWSIoT.sendMessage(this, deviceState, speechOutput);
}
},
The AWSIoT.sendMessage
is updating state of a shadow device state in AWS IoT. The Intel NUC then subscribes to that IoT channel using the MQTT protocol to quickly receive the updates.
The Intel NUC is running the IoT Gateway, interfacing to Arduino Firmata which was updated to also control the stepper motor.
Demo Video:Demo Box:
Comments