Making a Smart Kitty Detector

(powered by the cloud Amazon Web Services)
  • @lynnaloo on the internet
    
  • Makes art, robots, and software
  • Software Engineer @ ETA
  • Really likes cats and turtles

Me.

  • Norfolk.js
  • NodeBots Day Norfolk
  • RevolutionConf

Me.

I organize stuff:

What is Amazon Web Services?

Amazon Web Services (AWS) is a secure cloud services platform, offering compute power, database storage, content delivery and other functionality to help businesses scale and grow. 
- Amazon

About AWS

  • It's inexpensive
  • It's reliable(ish)
  • It's secure.
  • It's fast.
  • It's huge [it's Amazon].

AWS Products and Services

  • Cloud Computing
  • File Storage
  • NoSQL & Relational Databases
  • AI & Machine Learning
  • Internet of Things

For the Kitty Detector

  • AWS IoT
  • S3
  • AWS Lambda
  • Amazon Rekognition

Amazon IoT

  • Pub/sub system for hardware*
    
  • Devices are added as "things"
  • Device messages are filtered by the Rules Engine (SQL).
    
  • The Rules Engine routes messages to actions.

Amazon IoT

Device to IoT ????

  • IoT supports publish and subscribe via MQTT protocol and publish via HTTPS.
    
  • For browser-only applications, MQTT messages can be sent and received via web-sockets.
    
  • IoT has SDKs for Android/iOS, Java, Python, JavaScript (Browser and Node.js), and embedded C. 

Can I connect *any* hardware?

  • Nope.
    
    • It has to be able to support TLS 1.2 for MQTT or SSL certificates for the REST API.
  • Sorta.
    • You can tether the hardware to a computer or Raspberry Pi. Or the device can just be a computer running the SDK.
    • There are some proxy hacks for outlying hardware.    

Amazon AI Services

  • Amazon Lex - Chatbots
  • Amazon Polly - Text to Speech
  • Amazon Rekognition - Images 

For developers who want access to AI technologies without having to train or develop their own ML models.

Amazon Rekognition

[ 
    { Name: 'Animal', Confidence: 98.29473114013672 },
    { Name: 'Cat', Confidence: 97.9908218383789 },
    { Name: 'Adorable', Confidence: 97.9908218383789 },
    { Name: 'Plant', Confidence: 78.9802474975586 },
    { Name: 'Potted Plant', Confidence: 64.9802474975586 },
    { Name: 'Mammal', Confidence: 64.9908218383789 },
    { Name: 'Manx', Confidence: 64.9908218383789 },
    { Name: 'Pet', Confidence: 64.9908218383789 } 
]

AWS Lambda

  • Part of the "serverless" architecture
  • Users run code without provisioning or managing servers 
  • You're only charged when your code is executed
  • Supports several languages
  • Functions are executed by events

AWS Lambda

AWS Lambda

'use strict';

const fetch = require('node-fetch');
const AWS = require('aws-sdk');

const s3 = new AWS.S3();

module.exports.save = (event, context, callback) => {
  fetch(event.image_url)
    .then(response => response.buffer())
    .then(buffer => (
      s3.putObject({
        Bucket: process.env.BUCKET,
        Key: event.key,
        Body: buffer,
      }).promise()
    ))
    .then(() => {
      callback(null, 'Saved');
    })
    .catch((error) => {
      callback(error, null);
    });
};

Back to the Project:

A motion detector that texts a user when a cat (and only a cat) is detected.

Kitty Detector Parts List

  • Raspberry Pi 3
  • PIR Sensor
  • External Power Source
  • Lead Wires
  • Detector case (optional)
  • 1 moving kitty (optional)

The Code

  • Raspberry Pi Hardware/Amazon IoT Code:
    https://github.com/lynnaloo/kitty-detector
  • Serverless Framework/Lambdas:
    https://github.com/lynnaloo/go-away-kitty

Demo Time!

Making a Smart Kitty Detector Powered by Amazon Web Services

By Linda Nichols

Making a Smart Kitty Detector Powered by Amazon Web Services

This talk includes a quick overview of Amazon Web Services and how they can be used to power a "Smart" kitty detector.

  • 1,628