Software apps and online services
According to the Top 10 Causes of Death Report by CDC, Road Injuries hit in several country including my country, Thailand that 4 percent of death is a result of the vehicle accident. Frequently, the serious accidents occur at nighttime; in that case, it might be not caught sight of other people then the victim who is unable to call some emergency services by himself don’t get help at the right time. With Automatic Vehicle Accident Alert System, an alerting message which contains accident’s time and location sent automatically by the particular device embedded in a vehicle to emergency and relief agencies. So, they can rush to the accident and help the victim in time.
I use the amazing AWS IoT along with SNS, DynamoDB and Lambda for this project. AWS IoT enables communication between Internet-connected vehicle-embedded devices and the AWS cloud over MQTT. About alert services, AWS SNS is used for alerting an involved person via E-mail and Real-time Framework handle a real-time messaging task. DynomoDB is used for store accident information such as car number, time, latitude and longitude. Indispensably, AWS Lambda take a role of a manager who invokes the other services.
Additionally, I would rather make a comparison about system developing using AWS IoT and vice versa. 3 years ago when I was a college student, I developed a simply home automation system using Arduino. It took a long time because I had to set up the Apache web server for communicating with devices via HTTP. Contrariwise, this project is more thoroughly and took a little time for developing. Thus, AWS IoT provide a great environment for “Internet of Things”.
Part 1: Setup Raspberry Pi 2
Step 1: Follow all steps in the following link to setup, connect and flash the image for Raspberry Pi 2.
Step 2: Download and install WiringPi
Step 3: Set up AWS IoT C SDK
2: Create AWS Environment
Step 1: Setup the AWS IoT
Step 1.1: Login to the Amazon AWS Console. Then, select AWS IoT service.
Step 1.2: Create a thing. Type a thing name and its attributes.
Step 1.3: Create a certificate. Then, download all the key & certificate files.
Step 1.4: Create a policy. Type a policy name and add a policy statement.
Step 1.5: Activate a certificate. Then, attach a policy and a thing to the certificate.
Step 1.6: Create a rule. (After Complete Step 5)
Step 2: Setup the AWS DynamoDB
Step 2.1: Login to the Amazon AWS Console. Then, select AWS DynamoDB service.
Step 2.2: Select Create table. Type Table name and Primary key.
Step 2.3: Select Manage Stream. Choose New and old images Type.
Step 3: Setup the AWS SNS
Step 3.1: Login to the Amazon AWS Console. Then, select AWS SNS service.
Step 3.2: Select Create Topic. Type Topic name and Display name.
Step 3.3: Create a topic’s subscription. Then, confirm it by follow the link in your E-mail.
Step 4: Setup IAM Roles
Step 4.1: Login to the Amazon AWS Console. Then, select AWS IAM service.
Step 4.2: Create New Users. Enter a user name. Download Credentials.
Step 4.3: Select Permission. Attach Policy.
Step 5: Create the Lambda Function
Step 5.1: Login to the Amazon AWS Console. Then, select AWS Lambda service.
Step 5.2: Select create a Lambda function. Then, configure function. (Source file’s in the code section)
Step 5.3: Add Event source.
Step 5.4: Configure following Input test event. Test Lambda function.
Step 5.5: It is work fine. How wonderful it is!
Now, AWS environment is completely ready for the system. Next, we will set up Real-time Framework.
Part 3: Setup Real-time Framework
Step 1: Register the Real-time Framework account from URL: https://realtime.co/ by using Facebook or Google Plus account.
Step 2: Add Subscription. Select Realtime Cloud Messaging. Type Subscription name.
Step 3: Note Application Key and Private Key (Replace it instead of my keys in Lambda Code)
Step 4: Open Real-time console. Connect and Subscribe to “aws-iot” channel. Then test again from Lambda function.
Part 4: Build and run the Thing’s Agent
Step 1: Download source file and make it on Raspberry Pi 2 (Source file’s in the code section)
Step 2: View the output on the Monitor
Step 3: Verify that car number change from aa000 to wc4444
Overall back-end system is now completely created. Then, we will go into assembling the prototype car.
Part 5: Assemble the prototype car
Step 1: Collecting the right components
Step 2: Connect all of the components
Part 6: Test System
After I rush the prototype car with the wall, I have received following Alerting E-mail.
Part 7: The Improvement for real vehicle
In order to assembly with real vehicle, this system need connecting with some crash sensors like front impact sensors and receiving a crashing signal from the sensors before invoke overall system function.