SlideShare a Scribd company logo
1 of 14
MEmento - Final Presentation
Cervelli - De Luca - Di Maggio
Ever forgot to
lock your door?
MEmento is here to help you
avoid such unpleasant
situations!
Or to take the keys?
Finally a Twitter notification reminds
the user to lock the door
In order to stop the alert, the user has
to bring the FOB on his keyring near
the RFID reader next to the keyhole
If he is actually leaving,
a sound alert starts playing (emulated
via led)
A keys-reminder system
Through a magnetic switch, we are
able to detect if the user is leaving
Powered by
● STM DISCO-L475VG-IOT01A
○ One of STM’s finest pieces of hardware
○ Enabled with low-power wireless, BLE, NFC, SubGHz, Wi-Fi
○ Perfect for developing cloud-based IoT applications
● ARM Mbed OS
○ Provides API preventing IoT developers from reinventing the wheel
● AWS IoT Core
○ Easily integrated with our STM board
● Twitter
○ Used to notify the user on his mobile devices
Hardware components
We have to connect to our STM board a magnetic switch, used
to detect if the door is open or closed (it simply checks whether
the electric current passes or not), and an MFRC522 RFID
reader.
The MFRC522 also comes with a keyholder tag, which was
simply perfect for the user experience we designed.
Why not NFC?
Currently ARM Mbed hasn’t implemented any API to support its use as an
initiator in the NFC protocol. All it can do as of now is to emulate a tag, or to act
as an EEPROM, so it’s not viable for our use case.
Source: Mbed Office Hours with Donatien Garnier
AWS IoT Core MQTT connection (1/3)
pc.printf("Connecting to host %s:%d ...rn", MQTT_SERVER_HOST_NAME, MQTT_SERVER_PORT);
{
mqttNetwork = new MQTTNetwork(network);
int rc = mqttNetwork->connect(MQTT_SERVER_HOST_NAME, MQTT_SERVER_PORT, SSL_CA_PEM,
SSL_CLIENT_CERT_PEM, SSL_CLIENT_PRIVATE_KEY_PEM);
if (rc != MQTT::SUCCESS){
const int MAX_TLS_ERROR_CODE = -0x1000;
// Network error
if((MAX_TLS_ERROR_CODE < rc) && (rc < 0)) {
pc.printf("ERROR from MQTTNetwork connect is %d.", rc);
}
// TLS error - mbedTLS error codes starts from -0x1000 to -0x8000.
AWS IoT Core MQTT connection (2/3)
if(rc <= MAX_TLS_ERROR_CODE) {
const int buf_size = 256;
char *buf = new char[buf_size];
mbedtls_strerror(rc, buf, buf_size);
pc.printf("TLS ERROR (%d) : %srn", rc, buf);
}
return -1;
}
}
pc.printf("Connection established.rn");
pc.printf("rn");
AWS IoT Core MQTT connection (3/3)
pc.printf("MQTT client is trying to connect the server ...rn");
{
MQTTPacket_connectData data = MQTTPacket_connectData_initializer;
data.MQTTVersion = 3;
data.clientID.cstring = (char *)MQTT_CLIENT_ID;
data.username.cstring = (char *)MQTT_USERNAME;
data.password.cstring = (char *)MQTT_PASSWORD;
mqttClient = new MQTT::Client<MQTTNetwork, Countdown>(*mqttNetwork);
int rc = mqttClient->connect(data);
if (rc != MQTT::SUCCESS) {
pc.printf("ERROR: rc from MQTT connect is %drn", rc);
return -1;
}
}
pc.printf("Client connected.rn");
pc.printf("rn");
Door checking, starting alert and firing MQTT message
// IF DOOR IS OPEN
if (doorSensor.read() == 1) {
static unsigned short id = 0;
char payload[] = "{ "payload": TWITTER-ID-GOES-HERE }";
//START LED ALERT (A SOUND ALERT COULD BE IMPLEMENTED AS WELL)
led = 1;
MQTT::Message message;
message.retained = false;
message.dup = false;
const size_t buf_size = 100;
char *buf = new char[buf_size];
message.payload = (void*)buf;
message.qos = MQTT::QOS0;
message.id = id++;
int ret = snprintf(buf, buf_size, "%s", payload);
if(ret < 0) {
pc.printf("ERROR: snprintf() returns %d.", ret);
continue;
}
message.payloadlen = ret;
Shutting down the alert with MFRC 522
// Wait for the RFID tag to stop the alert
pc.printf("Wait alert to stoprn");
while(! (RfChip.PICC_IsNewCardPresent() || stopAlarm)) {
wait(0.5);
}
pc.printf("Alert stoppedrn");
// Reset led to off state and stopAlarm to false
led = 0;
stopAlarm = false;
// Wait until the door is closed before restarting the cycle
pc.printf("Wait for door to be closed againrn");
while(doorSensor.read() == 1) {
wait(0.5);
}
Send Twitter message with AWS Lambda
The MQTT message publishing acts as a trigger to an AWS
Lambda function.
We choose to use AWS Lambda because it allows us to run
the “lambda_handler” function when the MQTT request is
received and take is payload, without configuring any server.
For our purposes AWS services are provided for free and we
were able to write our function in Python, using a Twitter API
library.
AWS Lambda Notification Code
Thank you!
Contacts:
Gabriele Cervelli
gabriele-cervelli-88406b181
polyc
Giovanni De Luca
gdlroma
jotaro-sama
Antonino Di Maggio
antonino-di-maggio-216479143
antoninus96
Blogpost: https://www.hackster.io/memento-team/memento-07ff93
Code on GitHub: https://github.com/memento-iot-final-project-2018-2019

More Related Content

Similar to MEmento Final Presentation

Interface gsm with 8051 microcontroller (at89 c51)
Interface gsm with 8051 microcontroller (at89 c51)Interface gsm with 8051 microcontroller (at89 c51)
Interface gsm with 8051 microcontroller (at89 c51)
mdkousik
 
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdfDEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
Wlamir Molinari
 
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 FinalExploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
masoodnt10
 

Similar to MEmento Final Presentation (20)

Kamery, światło, akcja!
Kamery, światło, akcja!Kamery, światło, akcja!
Kamery, światło, akcja!
 
Interface gsm with 8051 microcontroller (at89 c51)
Interface gsm with 8051 microcontroller (at89 c51)Interface gsm with 8051 microcontroller (at89 c51)
Interface gsm with 8051 microcontroller (at89 c51)
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
 
WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11
WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11
WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11
 
Connecting NEST via MQTT to Internet of Things
Connecting NEST via MQTT to Internet of ThingsConnecting NEST via MQTT to Internet of Things
Connecting NEST via MQTT to Internet of Things
 
Didactum SNMP Manual
Didactum SNMP ManualDidactum SNMP Manual
Didactum SNMP Manual
 
Gas leakage detection system
Gas leakage detection systemGas leakage detection system
Gas leakage detection system
 
A Computer Based Artificial Neural Network Controller with Interactive Audito...
A Computer Based Artificial Neural Network Controller with Interactive Audito...A Computer Based Artificial Neural Network Controller with Interactive Audito...
A Computer Based Artificial Neural Network Controller with Interactive Audito...
 
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdfDEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
 
IoT on Raspberry Pi
IoT on Raspberry PiIoT on Raspberry Pi
IoT on Raspberry Pi
 
CHAPTERS
CHAPTERSCHAPTERS
CHAPTERS
 
Home automation using IoT and AWS Cloud technology
Home automation using IoT and AWS Cloud technologyHome automation using IoT and AWS Cloud technology
Home automation using IoT and AWS Cloud technology
 
MQTT - Austin IoT Meetup
MQTT - Austin IoT MeetupMQTT - Austin IoT Meetup
MQTT - Austin IoT Meetup
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest things
 
Physical Computing and IoT
Physical Computing and IoTPhysical Computing and IoT
Physical Computing and IoT
 
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 FinalExploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
 
Udp socket programming(Florian)
Udp socket programming(Florian)Udp socket programming(Florian)
Udp socket programming(Florian)
 
Rodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationRodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementation
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
Leveraging Android for the Internet of Things with Eclipse M2M
Leveraging Android for the Internet of Things with Eclipse M2MLeveraging Android for the Internet of Things with Eclipse M2M
Leveraging Android for the Internet of Things with Eclipse M2M
 

Recently uploaded

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 

Recently uploaded (20)

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 

MEmento Final Presentation

  • 1. MEmento - Final Presentation Cervelli - De Luca - Di Maggio
  • 2. Ever forgot to lock your door? MEmento is here to help you avoid such unpleasant situations! Or to take the keys?
  • 3. Finally a Twitter notification reminds the user to lock the door In order to stop the alert, the user has to bring the FOB on his keyring near the RFID reader next to the keyhole If he is actually leaving, a sound alert starts playing (emulated via led) A keys-reminder system Through a magnetic switch, we are able to detect if the user is leaving
  • 4. Powered by ● STM DISCO-L475VG-IOT01A ○ One of STM’s finest pieces of hardware ○ Enabled with low-power wireless, BLE, NFC, SubGHz, Wi-Fi ○ Perfect for developing cloud-based IoT applications ● ARM Mbed OS ○ Provides API preventing IoT developers from reinventing the wheel ● AWS IoT Core ○ Easily integrated with our STM board ● Twitter ○ Used to notify the user on his mobile devices
  • 5. Hardware components We have to connect to our STM board a magnetic switch, used to detect if the door is open or closed (it simply checks whether the electric current passes or not), and an MFRC522 RFID reader. The MFRC522 also comes with a keyholder tag, which was simply perfect for the user experience we designed.
  • 6. Why not NFC? Currently ARM Mbed hasn’t implemented any API to support its use as an initiator in the NFC protocol. All it can do as of now is to emulate a tag, or to act as an EEPROM, so it’s not viable for our use case. Source: Mbed Office Hours with Donatien Garnier
  • 7. AWS IoT Core MQTT connection (1/3) pc.printf("Connecting to host %s:%d ...rn", MQTT_SERVER_HOST_NAME, MQTT_SERVER_PORT); { mqttNetwork = new MQTTNetwork(network); int rc = mqttNetwork->connect(MQTT_SERVER_HOST_NAME, MQTT_SERVER_PORT, SSL_CA_PEM, SSL_CLIENT_CERT_PEM, SSL_CLIENT_PRIVATE_KEY_PEM); if (rc != MQTT::SUCCESS){ const int MAX_TLS_ERROR_CODE = -0x1000; // Network error if((MAX_TLS_ERROR_CODE < rc) && (rc < 0)) { pc.printf("ERROR from MQTTNetwork connect is %d.", rc); } // TLS error - mbedTLS error codes starts from -0x1000 to -0x8000.
  • 8. AWS IoT Core MQTT connection (2/3) if(rc <= MAX_TLS_ERROR_CODE) { const int buf_size = 256; char *buf = new char[buf_size]; mbedtls_strerror(rc, buf, buf_size); pc.printf("TLS ERROR (%d) : %srn", rc, buf); } return -1; } } pc.printf("Connection established.rn"); pc.printf("rn");
  • 9. AWS IoT Core MQTT connection (3/3) pc.printf("MQTT client is trying to connect the server ...rn"); { MQTTPacket_connectData data = MQTTPacket_connectData_initializer; data.MQTTVersion = 3; data.clientID.cstring = (char *)MQTT_CLIENT_ID; data.username.cstring = (char *)MQTT_USERNAME; data.password.cstring = (char *)MQTT_PASSWORD; mqttClient = new MQTT::Client<MQTTNetwork, Countdown>(*mqttNetwork); int rc = mqttClient->connect(data); if (rc != MQTT::SUCCESS) { pc.printf("ERROR: rc from MQTT connect is %drn", rc); return -1; } } pc.printf("Client connected.rn"); pc.printf("rn");
  • 10. Door checking, starting alert and firing MQTT message // IF DOOR IS OPEN if (doorSensor.read() == 1) { static unsigned short id = 0; char payload[] = "{ "payload": TWITTER-ID-GOES-HERE }"; //START LED ALERT (A SOUND ALERT COULD BE IMPLEMENTED AS WELL) led = 1; MQTT::Message message; message.retained = false; message.dup = false; const size_t buf_size = 100; char *buf = new char[buf_size]; message.payload = (void*)buf; message.qos = MQTT::QOS0; message.id = id++; int ret = snprintf(buf, buf_size, "%s", payload); if(ret < 0) { pc.printf("ERROR: snprintf() returns %d.", ret); continue; } message.payloadlen = ret;
  • 11. Shutting down the alert with MFRC 522 // Wait for the RFID tag to stop the alert pc.printf("Wait alert to stoprn"); while(! (RfChip.PICC_IsNewCardPresent() || stopAlarm)) { wait(0.5); } pc.printf("Alert stoppedrn"); // Reset led to off state and stopAlarm to false led = 0; stopAlarm = false; // Wait until the door is closed before restarting the cycle pc.printf("Wait for door to be closed againrn"); while(doorSensor.read() == 1) { wait(0.5); }
  • 12. Send Twitter message with AWS Lambda The MQTT message publishing acts as a trigger to an AWS Lambda function. We choose to use AWS Lambda because it allows us to run the “lambda_handler” function when the MQTT request is received and take is payload, without configuring any server. For our purposes AWS services are provided for free and we were able to write our function in Python, using a Twitter API library.
  • 14. Thank you! Contacts: Gabriele Cervelli gabriele-cervelli-88406b181 polyc Giovanni De Luca gdlroma jotaro-sama Antonino Di Maggio antonino-di-maggio-216479143 antoninus96 Blogpost: https://www.hackster.io/memento-team/memento-07ff93 Code on GitHub: https://github.com/memento-iot-final-project-2018-2019