Johnson JosephNekhilNick Morgan
Published © MIT

Alexa Smart Mailbox

Come forward to meet the speaking mailbox.

BeginnerFull instructions provided5 hours3,488

Things used in this project

Story

Read more

Schematics

Arduino - Proximity

Raspberry Pi - Arduino

Code

Arduino Code

C/C++
Code to read data from proximity sensor and write value in serial port.
#Code to read data from proximity sensor
#Developed by Shebin Jose Jacob


int sensor = 5;  
int mail   = 0; 
void setup() { 
 pinMode(sensor, INPUT);  
 Serial.begin(9600);  
}
void loop() {
 mail = digitalRead(sensor); 
 if(mail == 1) {  
   Serial.write(1);              # returns 1 if mail is present 
   } 
 else{   
 Serial.write(0);                # returns 0 if mail is not present
   }
}

Raspberry Pi code

Python
#Code to read data from serial port and send it to alexa via flask 
#Developed by Shebin Jose Jacob

from flask import Flask  
from flask_ask import Ask, statement  
import requests  import json  
import serial 
ser = serial.Serial("/dev/ttyACM0", 9600)  #change here for your serial port
app = Flask(__name__)  ask = Ask(app, '/') 
@ask.launch 
@ask.intent("Check")   
if (ser.read()==1)   
def yes():   
 return statement("New mail has arrived , Check it soon")   
else    
def no():      
 return statement("No mails yet")   
if __name__ == "__main__":   
app.run(debug=True) 

Credits

Johnson Joseph

Johnson Joseph

9 projects • 34 followers
We build future
Nekhil

Nekhil

10 projects • 35 followers
HARD CORE TINKERER
Nick Morgan

Nick Morgan

0 projects • 0 followers
Hard core techie

Comments