Sibi Sankar
Published © GPL3+

Virtual Post Man.

Virtual Post Man maps the physical event of receiving a post card to an email notification thus bridging the digital and physical worlds.

IntermediateFull instructions provided1,215
Virtual Post Man.

Things used in this project

Hardware components

Grove starter kit plus for Intel Edison
Seeed Grove starter kit plus for Intel Edison
×1
Intel Galileo Gen 2
Intel Galileo Gen 2
×1

Software apps and online services

AWS IoT
Amazon Web Services AWS IoT
AWS SNS
Amazon Web Services AWS SNS

Story

Read more

Custom parts and enclosures

Post Box

The necessary dimensions of the post box is identified using model of Intel Galileo Gen 2.

Schematics

Circuit Connection

The groove starter kit makes it trivial to set it up.
Circuit connection

Code

MQTT Client.

Python
After the necessary dependancies are met (ie) Placing the essential certificates in the auth folder the python works its magic.
# Library Imports
import paho.mqtt.client as mqtt
import ssl
import time
import thread
import pyupm_grove as grove
from wiringx86 import GPIOGalileoGen2 as GPIO

# Pin Definition
led = 5
light = grove.GroveLight(0)

# Stores the Previous LDR value
prev_ldr_data = 0

gpio = GPIO()
gpio.pinMode(led, gpio.OUTPUT)

#Set it to always on
gpio.digitalWrite(led, gpio.HIGH)

#defining topics
ldrTopic    = "topics/ldr"

def on_connect(client, userdata, flags, rc):
    print "Connected Successfully"

client = mqtt.Client()
client.on_connect = on_connect
client.tls_set(ca_certs='./auth/rootCA.pem', certfile='./auth/XXXXXXXXXX-certificate.pem.crt', keyfile='./auth/XXXXXXXXXX-private.pem.key', tls_version=ssl.PROTOCOL_SSLv23)
client.tls_insecure_set(True)
client.connect("XXXXXXXXXXXXXX.iot.us-west-2.amazonaws.com", 8883, 60) #Taken from REST API endpoint



#Main Loop
#Publishing Analog Values to AWS
def publishNewPost(Variable):
    while (1):
        ldr_data = str(light.raw_value() )
        if prev_ldr_data:
            if ldr_data - prev_ldr_data > 300:
                client.publish(ldr_Topic, payload="A New Mail For You")
                print "Threshold crossed "
        prev_ldr_data = ldr_data



thread.start_new_thread(publishNewPost,("publishNewPost",))
client.loop_forever()

Credits

Sibi Sankar

Sibi Sankar

2 projects • 5 followers
I live by the maxim 'made made dane' (you still have a long way to go).

Comments

Add projectSign up / Login