Johnson JosephNekhilShebin Jose Jacob
Published © MIT

Alexa Smart Mailbox

Come forward to meet the speaking mailbox.

BeginnerFull instructions provided5 hours5,889

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 • 35 followers
We build future
Nekhil

Nekhil

22 projects • 95 followers
CEO @ CodersCafe | Maker | Hardware Hacker | Electronics Enthusiast
Shebin Jose Jacob

Shebin Jose Jacob

34 projects • 97 followers
CEO, Co-Founder | Coders Cafe

Comments