This project used Amazon Simple Notification Service (SNS), is a simple, fully-managed "push" messaging service that allows users to push texts, alerts or notifications, like an auto-reply message, notification of fire alarm. Thanks Amazon!
In this project I will use email and sms notification. The system will notify to subscribers when temperature or humidity crossed predefined threshold limit. You can use it for many purpose like fire notifier, rain notifier, you can use it as notifier if someone tries to enter your home, some movement occurred and so on. I used Intel Edison for the project.
Let's setup AWS environment first.Set-up AWS IoT
i. Create an AWS account from the link: http://aws.amazon.com/
ii. Sign in to AWS Management console and from the Services select AWS IoT (Fig-1)
iii. Click on Get Started (Fig-2)
iv. Click on Create a thing (Fig-3)
v. Type a thing name (e.g. raspberry) & click to Create
A thing named raspberry will be created (Fig-5)
vi. Now, click to Create a certificate & then click 1-Click certificate create (Fig-6)
vii. Download all the keys & certificates, it will be required for connection with AWS IoT (Fig-7)
viii. To activate already created certificate, select particular certificate and then Activate it from the Actions menu (Fig-8)
ix. Now, you need to attach the thing to the certificate. To do it select the certificate and then Attach a thing from the Actions menu (Fig-9).
Type the thing name and click attach (Fig-10)
You can see details of thing on the right side as in screenshot by clicking on the thing name.
Set-up AWS SNS
i. From the service click on SNS
ii. From the SNS Home click on Create Topic
iii. Type a Topic name & Display name(name show in sms and email) & then click on Create topic.
It should look like this
iv. Now click on Create Subscription
v. Set a protocol (Email) from the drop down menu
vi. Type the Email address to which you want to get the alert to Endpoint textbox & then click on Create Subscription
You will see PendingConfirmation message like this
vii. Don't panic, go to your Email, you will notice an email from AWS Notification.
viii. Open the email and click to Confirm subscription
You will get the confirmation message like this
Your pending subscription is now approved.
ix. You can test everything is working correctly or not. Click on Publish to topic
x. Type something to message box
xi. Click to Publish message
x. If you get following message then Congratulation!
Now, you need to create a rule from AWS IoT page.Create a rule
i. Again go to AWS IoT page and click to Create a rule
ii. Fill up according to the following figure
iii. Choose SNS from Choose an action drop down box.
iv. Select TemperatureAlarm (created earlier) from SNS target box
v. Click on Create a new role
vi. Follow the role summary
vii. Click on Allow
viii. Click on Add action
ix. Click on Create
x. You can see the detail of created notification SNS Action
i. From AWS Services click on IAM
ii. From the Dashboard select users and than click on Create New Users
iii. Enter an user name
iv. Click on Create
v. Save the Credentials
vi. Select the created user, go to Permissions tab & click on Attach Policy
vii. Select AmazonSNSFullAccess & AmazonIoTFullAccess
vii. Click on Attach Policy
viii. Policy is now attached
If you followed all the steps, AWS environment is completely ready to sent notification to your email. Now you need to setup your hardware which will sense the environment and publish message to SNS endpoint.
Setup your Intel Edison
The Edison is the powerful new computing module from Intel®. It’s versatile enough to manage internet-of-things applications, and powerful enough to control robotics platforms.
The Edison packs a host of features, including WiFi (802.11a/b/g/n), Bluetooth (4.0 and 2.1 EDR), UARTs, I2C, SPI, USB, and 40 GPIO. It’s driven by a 32-bit Intel® Atom™ Processor clocked at 500MHz, supported by 1GB of LPDDR3 RAM and 4GB eMMC flash memory. To top it off, it’s housed in a tiny, 35.5 x 25.0 x 3.9 mm module.
I am not going to cover the initial setup of Intel Edison board. Many tutorials are available in the Internet about the setup. You can follow An Absolute Beginners Guide To The Intel Edison which well cover how to get started with Edison and meet most of the requirement for starting Edison project. You can also follow the video link:
Before proceeding further be sure you have:
- Connected The Edison to the Breakout Board
- Installed The Required Drivers (FTDI Drivers, Edison Drivers)
- Downloaded The Intel Arduino IDE and tested with Blink example
- Flashed Your Edison with Yocto Linux Image
- Setup WiFi
- Upgraded the Edison Image
- Ready to connect Edison with SSH
Download the source from the Github repository, upload it to your Edison board and test the result. If temperature exceed from 35 degree Celsius it will trigger AWS SNS and SNS will sent you notification email.