Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sentinel - The First Home Security Robot Powered by Android Things (DroidCon NYC 2017)

Sentinel - The First Home Security Robot Powered by Android Things (DroidCon NYC 2017)

Oscar Salguero

September 26, 2017
Tweet

More Decks by Oscar Salguero

Other Decks in Technology

Transcript

  1. Sentinel The First Home Security Robot Powered by Android Things™

    https://www.hackster.io/oscarsalguero/sentinel-8234b3 Oscar Salguero @OscarSalguero
  2. • Home security cameras are expensive • Most surveillance services

    have crazy high monthly fees • Gotta have a camera on each room • IP cameras are hackable • Setup is complicated • Can’t see anything from a WAN without DDNS • OEM and 3rd party remote viewing apps are unreliable Motivation
  3. • Don’t talk to other smart home/IoT hardware • Still

    use email to send you alerts • Alert! A leaf moved! (notifications are irrelevant) • No face detection nor facial recognition • No image classification • Can’t find your pet if it walked out of frame Motivation
  4. • Pets move from room to room or go outside

    • Entertainment…? Throw a tennis ball to Fido from anywhere! • Check if your pets have food or water • Keep an eye on the kids • See if a delivery arrived Motivation
  5. Raspberry Pi 3, 32GB SD Card with Android Things ™

    https://www.adafruit.com/product/3292
  6. • Stereo speakers • USB Mic • 30,000 mah Power

    bank • Couple of plastic expansion plates • USB and barrel jack cables, wires • Standoffs, nuts, screws, etc. Other Stuff...
  7. Android... Android Everywhere! • Android Studio 3.0 Beta • Android

    Things ™ Developer Preview • Antonio Zugaldia’s Android Robocar Project (Adafruit PWM and Motor Hat Java Library) http://androidrobocar.com
  8. DC and Stepper Motor Hat Driver // I2C Bus Name

    public static final String I2C_DEVICE_NAME = "I2C1"; // Motor Hat Address private static final int MOTOR_HAT_I2C_ADDRESS = 0x60; // Motor Hat private AdafruitMotorHat mMotorHat; // Motors private AdafruitDcMotor motorFrontLeft, motorFrontRight, motorBackLeft, motorBackRight; https://github.com/zugaldia/android-robocar
  9. DC and Stepper Motor Hat Driver mMotorHat = new AdafruitMotorHat(I2C_DEVICE_NAME,

    MOTOR_HAT_I2C_ADDRESS); motorFrontLeft = mMotorHat.getMotor(1); motorBackLeft = mMotorHat.getMotor(2); motorFrontRight = mMotorHat.getMotor(3); motorBackRight = mMotorHat.getMotor(4);
  10. private void moveForward() { Log.d(LOG_TAG, "Moving forward."); motorFrontLeft.run(AdafruitMotorHat.FORWARD); motorFrontRight.run(AdafruitMotorHat.BACKWARD); motorBackLeft.run(AdafruitMotorHat.BACKWARD);

    motorBackRight.run(AdafruitMotorHat.FORWARD); } private void turnRight() { Log.d(LOG_TAG, "Turning right."); motorFrontLeft.run(AdafruitMotorHat.FORWARD); motorFrontRight.run(AdafruitMotorHat.FORWARD); motorBackLeft.run(AdafruitMotorHat.BACKWARD); motorBackRight.run(AdafruitMotorHat.BACKWARD); } DC and Stepper Motor Hat Driver
  11. 16 Channel Servo HAT Driver // Servo Hat Address private

    static final int SERVO_HAT_I2C_ADDRESS = 0x41; // Servo Hat private AdafruitServoHat mServoHat; // Servos private AdafruitServo mTiltServo; private AdafruitServo mPanServo; https://github.com/RacZo/adafruit-16-channel-servo-hat-driver
  12. 16 Channel Servo HAT Driver // Servo Hat initialization mServoHat

    = new AdafruitServoHat(I2C_DEVICE_NAME, SERVO_HAT_I2C_ADDRESS); // Variables to configure the servos according to their manufacturer specs double minAngle = 20.0; double maxAngle = 150.0; double minPulseDurationRange = 0.7; // ms double maxPulseDurationRange = 1.50; // ms int frequency = 40;
  13. // Add the servos to the hat in the order

    they are connected from index 0 to 15 mPanServo = new AdafruitServo(0, frequency); mPanServo.setPulseDurationRange(minPulseDurationRange, maxPulseDurationRange); mPanServo.setAngleRange(minAngle, maxAngle); mPanServo.setAngle(SERVO_INITIAL_PAN_ANGLE); mServoHat.addServo(mPanServo); mTiltServo = new AdafruitServo(1, frequency); ... mServoHat.addServo(mTiltServo); … // Add the servos to the hat in the order they are connected from index 0 to 15 mServoHat.rotateToAngle(mPanServo, 90); mServoHat.rotateToAngle(mTiltServo, 90); 16 Channel Servo HAT Driver
  14. Companion Android App • See your pet from anywhere! •

    Remote Control • Live feed (kind off) • Motion and loud sound alerts • Image history & management
  15. Tips • Draw, sketch or diagram your idea first •

    Write down a list of materials and a list of desirable features • Research about the technologies such as APIs, protocols, etc. you’ll need to achieve the desired features, research about the parts and materials before purchasing them; pros/cons matter! • Use Etcher to push Android Things image to an SD Card • Learn to love adb and make a command cheat sheet
  16. Tips • Add speech-to-text help you debug stuff • Run

    and analyze sample code (GitHub), ask questions (forums, Stack Overflow), watch how it is done (YouTube) • Redundancy (if you can, buy more than 1 board) • Learn about circuits, voltages and currents beforehand and be mindful about power requirements • Use rechargeable batteries • Always have a wired USB keyboard, mouse and an HDMI cable at hand • Try not to burn your fingers when soldering headers (It hurts!)
  17. The Road Ahead Software Improvements • Real time video &

    2-way audio (Web RTC) • Face detection and feature tracking (OpenCV) • Facial recognition (TF) • Real time image classification (TF) • Voice control (Google Voice Actions) tinyLiDAR (HW + SW) • Indoor mapping and navigation using • Follow moving targets • Autonomous patrolling