Do you want to know if a device went haywire or is working just fine? This project is a simple AI system to prove that with current metering you can. You will be informed when something goes wrong. The following system can do it:
Create the circuit, connect shield to Arduino, and upload sketch to Arduino. Connect external power supply to Arduino (at least 9 Volts for stability).
It should look like this:
After this install Debian to the Dragonboard like they explain here: https://github.com/96boards/documentation/wiki/Dragonboard-410c-Installation-Guide-for-Linux-and-Android.
After this you should install limdo, aws, linebyline, with npm to install folder of aipart.js.
npm install limdu
npm install linebyline
npm install aws-sdk
You must check for IP settings otherwise it will not work.
Next open AWS IoT console. In the resources click "Create a resource." Click create a thing. Give it a name and click create.
Click the name of the thing. It will open another panel. In that panel select "connect a device." In the connect a device window select NodeJS and click "Generate certificate and policy." When you click there will be three files. Download them they will be used for connecting our device to AWS. Then click "Confirm & start connecting" It will show us how to connect to AWS IoT to Node. Click "Return to thing detail".
We are connecting to our device now. But we need to make a rule. so that AWS will know what to do with our messages.
RulesClick "Create a rule." Give it a name and description. Write * for attribute and # for topic. Condition is when this rule will fire. We send a message in JSON with this variable name and it will fire. In choose action we can store this message. Or fire it SNS etc.
To store it we have to use a dynamo table the user guide is in this link: http://aws.amazon.com/dynamodb/getting-started/.
For sending mail we have SNS, but if it's urgent or we would like to send SMS. Outside the US we need a EC2 instance so that SNS can fire a HTTP event. That will use a third party service (in our case twilo), to send a SMS message. First create an Ubuntu EC2 instance (I like Ubuntu; Sorry to all the yum lovers). Follow http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html guides and do an update. After that install lamp stack. Do not forget to open port 80 for http traffic. Test it with a classic phpinfo() and after that install composer. The file composer.json has the packages you need so install them. The process AWS used for request check is a little bit hard for a programmer to write so the best way is to use Amazon SDK. fill the twilo information and you are ready to go.
Now after a brief pause (!) lets continue to create our rule. In choose an action select SNS and click "Create a new resource". Topics window will open In this window select Create new topic and enter a topic name and a display name. Copy the ARN of Topic so that we will need it later. Click "Subscriptions" and "Create Subscriptions." If you select "email" a verification email will be send to that address. If you select http or HTTPS a verification request will be made to that address. If you follow the steps above it will automatically accept the request. Now enter the topic ARN. and click "Create Subscription" after it validates it will begin to make our requests automatically to all clients that subscribed to topic. To test subscription you can use Publish to topic to test.
Now that we are ready to send our messages through SNS we can click "Choose a resource" select our SNS target. then we should create a role. click Create a new role In the new window select Create a new IAM Role enter a role name then click "Allow".
In the AWS IoT window select role and finally click "Add action". and click Create from now on whenever our IoT device send a message which returns true with our condition than a message will be send or stored.
Well If you have problems please leave a comment.
Comments