In my second IoT project, I tackle feeding my cats by voice commands.
My family owns three cats; for the most part, they are well behaved – unless they are hungry. When it’s time for them to eat, they get a little crazy – constantly meowing and running under/between our legs, or waking us up at night.
We used to keep extra food in their dishes, but they would just overeat – resulting in cat throw-up (which, without fail, I seemed to step in every morning on my way to the kitchen).
We’ve been living in this “claw-ful” situation for a few years, and never really considered resolving the problem. My oldest daughter suggested that we (and by we, she really meant me) build an automated cat feeder. I told her that I didn’t have the time to build one… but then, I figured, why not give it a try.
Full instructions are on the write up at Hackster – https://www.hackster.io/darian-johnson/alexa-powered-automated-cat-feeder-9416d4
In a span of a few hours, I successfully migrated my Wordpress blog from an EC2 instance to Amazon Lightsail.
Of all the new releases announced at AWS re:Invent, I was most excited about Amazon Lightsail. I love AWS, but sometimes it’s too complicated. If someone wants to run a blog, then they shouldn’t have to learn about VPCs, subnets, etc…. they should, in a few clicks, be up and running.
So, I spent a few hour this weekend migrating this blog from the t2.small EC2 instance I’ve been running (with RDS and Memcache) to a new, smaller Lightsail instance.
The migration was straight forward (instructions here: https://docs.bitnami.com/aws/how-to/migrate-wordpress)- the biggest challenge was re-installing my WordPress plugins (they did not migrate over).
Will this be better than running my own VPC and EC2 instance? I’m not sure. I still have my old instances available if I need to switch back. I’m hoping that it does; I was spending about $20 a month running my t2.small (I know, I know.. I should have been running on an RI to reduce cost). The small instance of Lightsail is on $5/month.
Some people spend their vacations traveling, or relaxing, or visiting family. I spent my two weeks off building an Alexa enabled, Raspberry Pi device for Hackster’s Internet of Voice challenge.
But, to paraphrase Madonna: “Don’t Cry for Me, Internet.” I really enjoyed those two plus weeks of coding. I learned a ton about AWS IoT and MQTT (and re-enforced some “non-sexy” skills – like security and IAM).
And the device that I decided to build…. a magic mirror. Why a magic mirror? Well, I am the guy that:
- Never checks for delays in his work commute until he is stuck in a four-lane accident
- Forgets his umbrella when the forecast calls for afternoon showers
- Doesn’t find out about a major news event unless the story breaks on ESPN
- Always forgets to pull my trash bins to the curb on garbage pick-up day
In short, my morning routine is a mess (#firstworldproblems). An Amazon Echo (or a phone, for that matter) would resolve most of those problems. Unfortunately, I never seem to have my phone with me as I’m getting ready in the morning (it’s usually charging). And I’m usually not asking Alexa for these details (I don’t have an Alexa device in my bathroom).
60% of my morning routine is centered in and around the bathroom or bedroom, so I decided to build an Alexa skill and Alexa Voice Service-enabled magic mirror – which I’ve titled the Mystic Mirror.
Continue reading “Building a Magic Mirror using Alexa, AWS, and a Raspberry Pi”
Integration with Alexa allows a user to obtain a workout recommendation (and create a machine learning model) all by voice command.
[su_note note_color=”#d3d3d3″]Note: This is the third post about using Amazon Machine Learning to predict workout intensity. Check out Part 1 (Overview) and Part 2 (Building the Machine Learning Model) for background. A working model is available via web and Alexa. Code can be found/downloaded from my Hackster site.[/su_note]
After I was able to build a working model, I needed to come up a way to automate the model. I originally planned to allow access through my website, but decided to use Alexa in addition to the website link.
Note: The process of creating an Alexa skill isn’t too complicated (if you have experience building lambda functions). That being said, I suggest you start by building a sample skill – such as the Fact Skill example. Also, be sure to read and follow the certification requirements.
Alexa, AWS, and the exposed Fitbit APIs provided a mechanism to build a model and return results for a specific user – all initiated by voice.
Step 1 – Linking the user’s Fitbit account to the skill
A user has to link his/her Fitbit account to the skill before s/he can (a) build a specific machine learning model based on their history and (b) get a workout recommendation. Step 1 covers the logic for this functionality.
Click image to enlarge
Continue reading “Using Amazon Machine Learning to Predict the Best Time of Day for Exercise – Pt 3: Automating the Model with Alexa”
Amazon Machine Learning, leveraging activity data from a your Fitbit, can be used to predict workout intensity.
[su_note note_color=”#d3d3d3″]Note: This is the second post about using Amazon Machine Learning to predict workout intensity. Check out Part 1 (Overview) for background. A third post will cover the Lambda and Alexa code used to automate the model. A working model is available via web and Alexa. Code can be found/downloaded from my Hackster site.[/su_note]
When creating my prediction model, I first had to define workout effectiveness. Was it measured by the total number of minutes that I worked out, or my average heart rate? Should I consider my peak heart rate, or number of calories burned.
After doing some research, I decided that workout intensity would be best captured my the number of “active minutes” for each workout. From the Fitbit website:
All Fitbit trackers calculate active minutes using metabolic equivalents (METs). METs help measure the energy expenditure of various activities. Because they do so in a comparable way among persons of different weights, METs are widely used as indicators for exercise intensity. For example, a MET of 1 indicates a body at rest. Fitbit trackers estimate your MET value in any given minute by calculating the intensity of your activity.
From there, I needed to determine what inputs impacted workout intensity. After more reading, I landed on the following as inputs to a successful workout.
- Sleep (or lack of sleep)
- Previous Day’s activities
- Time of Day
- Food Intake
My Fitbit tracks sleep and the amount of total activity of a given day (measured with the count of total active calories burned in a day). I can also get the start time of each workout and the resultant active minutes in that workout.
Stress, being subjective, is harder to measure. I originally used the number of meetings in my outlook calendar to determine my level of stress, but found that metric to be inaccurate (at least, without additional research/tuning).
Continue reading “Using Amazon Machine Learning to Predict the Best Time of Day for Exercise – Pt 2: The Learning Model”