Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo...

28
SmartPills EE149/249 Final Project Presentation December 17th, 2014 Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1

Transcript of Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo...

Page 1: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

SmartPillsEE149/249 Final Project Presentation

December 17th, 2014

Vicenc Rubies RoyoParsa MahmoudiehJoshua Goldberg

Gil Lederman

1

Page 2: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

SmartPills

• Detect the number of pills in the bottle, based on high-precision weight measurement combined with an accelerometer.

• Send usage information from the bottle to an Android App, and Configuration commands/data from the App to the bottle

• Unlock the bottle based on fingerprint scan.

2 2

Page 3: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Component Breakdown

• Processor– mbed LPC1768

• Sensors– Accelerometer (ADXL345)

– 100g Load Cell

– Fingerprint Scanner (GT-511C3)

3 3

Page 4: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Component Breakdown

• Actuators– Servo for locking mechanism

• Communication – BLE BlueSMiRF Family

4 4

Page 5: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Module Breakdown

• Mechanical structure of the bottle and hardware integration (Josh/Parsa)

• Number of pills detection (Josh/Parsa)

• Bottle safety (locking/fingerprint scanning) (Gil)

• Software architecture (Gil/Vicenc)

5 5

Page 6: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Mechanical Structure

6 6

Page 7: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Unlocked Bottle

7 7

Page 8: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

3D Printed Prototype

8 8

Page 9: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Enclosed Circuits

Amplifier mbed

BLE

Accelerometer

9 9

Page 10: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Load Cell

10 10

Page 11: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Load Cell

11 11

Page 12: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Amplifier

• Instrumentation amplifier to measure voltage difference between outputs of load cell

12 12

Page 13: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Amplifier

13 13

Page 14: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Load Cell Summary

• Load cell is much more repeatable than FSR

• There is no creep like with the FSR

• We tuned the gain of the instrumentation amplifier to get the dynamic range necessary to measure individual pills

• Pill weighs about 770mg, 12-bit ADC can measure differences of 0.8mV

• Currently amplifying to about 48 mV/gram = 36mV/pill = 45 adc-units/pill

14 14

Page 15: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Bottle Safety

• Only authorized users allowed access to the pill bottle.

• Bottle is locked until a verified fingerprint scan is detected.

• Servo attached to the cap of the bottle, automatically opening after successful identification.

15 15

Page 16: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Bottle Safety

• GT-511C3 only responds to commands, must be periodically polled to check if finger is pressed.

• Bottle only “wakes up” the fingerprint scanner after an interrupt from the accelerometer/button wakes it up.

• Fingerprint enrollment initiated by command from Android app

16 16

Page 17: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Controller FSM

Wait for Identification

INACTIVE

Sample Load Cell

OPEN ACTIVE

CLOSED

true

/ upd

ate

And

roid

deactivate /

identified / unlock

misiden

tifica

tion/

reset

coun

ter

coun

ter =

20

/ tu

rn o

ff sc

anne

r

RE

SE

T / T

urn

on

Sca

nner

counter = 20 / lock

activate / Turn on Scanner

OPEN INACTIVE

activ

ate

/ can

cel

tmer

inac

tivat

e / s

tart

timer

17 17

Page 18: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Software Architecture

• Leverages the mbed-rtos, based on the RTX implementation of the CMSIS-RTOS API.

• 3 threads - Controller, BLE communication, GT-511C3 scanner

• Communicating via RTOS queues.• All threads are based on a common

FsmThread class, implementing an event loop that demultiplexes events in sub-classes.

18 18

Page 19: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Software Components

• ScannerFsm (fingerprint sensor), based on a GT-511C3 library by Toshihisa T.

• AdxlModule (accelerometer control), based on the ADXL345 library by Aaron Berk. This module programs the ADXL to drive ACTIVATE/INACTIVATE interrupts.

• Servo module, based on a library by Simon Ford.

19 19

Page 20: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Software Components-LoadCell

• Calibrated once on empty by measuring the last voltage bias.

• During each ADC measurement doing average of 10,000 samples.

• Saves history of measurements, sends it to the Android when it pairs.

20 20

Page 21: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Android Application

• Android code:

-Modified version of BluetoothChat sample code provided in Eclipse IDE. -Code distributed under Apache License v2.0. -Usage compliant with License.

21 21

Page 22: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Android Application

22 22

Page 23: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Communication

• Message Structure:1.) Header = 4 bytes (0xCCCCCCCC)2.) Type = 4 bytes3.) Length = 4 bytes4.) Payload = (Length) bytes [mult. of 4]

23 23

Page 24: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Communication

• Message Types From Android to MBED:1.) RequestCalibrateMessage2.) RequestEnrollMessage3.) SetWeightMessage4.) RequestUnlock5.) RequestHistory

24 24

Page 25: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Communication

• Message Types From MBED to Android:1.) NewSampleMessage2.) AcknowledgeEnrollMessage3.) RequestRemoveFingerMessage4.) RequestPressFingerMessage

25 25

Page 26: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Things that could be improved...

• Noisy load cell measurements• Fingerprint sensor is not very reliable• With a PCB, we could drastically reduce

the size of the mechanical design• Android App could have enhanced user

interface• Add pill usage metrics

26 26

Page 27: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Demo

27

Watch our demo on youtube!

Page 28: Vicenc Rubies Royo SmartPills Parsa Mahmoudieh December … · 2014-12-20 · Vicenc Rubies Royo Parsa Mahmoudieh Joshua Goldberg Gil Lederman 1. SmartPills •Detect the number of

Thank you!Any questions?

28