Most of the times, when I want to cook something I find some cooking ingredient (onion, garlic, chili etc.) is running low. In some cases I buy wrong item such as garlic instead of onion. When I reach at my kitchen I observe that, I have a plenty of onion but no garlic. How will you feel in such a situation?
To get rid from such situation I built a Smart Pantry which can order automatically to replenish every ingredients of my pantry with Amazon DRS. Busy life, easy solution!!!
Here, I will show you how I made such hi-tech pantry and I hope you will able to reproduce it as your requirement.
So, let's get started. First I will explain how I prepared my pantry to sense the shortage of any ingredient. I used Force Sensitive Resistor (FSR) to detect the absence of ingredient in a specific box of the pantry. Arduino UNO is used to to read the sensor value.
Preparing the PantryI took a 3 compartment kitchen box for my demo project and it can house three different ingredients into it's three separate box. For sensing the shortage of ingredients in a box I am measuring weight of each box with force sensitive resistor. Though FSR is not very accurate for weight measurement but enough for this project for identifying a blank box.
Photos attached above shows how I placed fsr in the box. I placed one fsr below each compartment and tried to put it at the center of the compartment. Using mini drill I made two holes for every sensor to bring out the pin of the sensor out of the box. Then I soldered jumper wire to each pin of the sensors to connect it with Arduino.
Three sensors are used for three separate parts of the box and sensors are placed in the center of each box.
Force sensitive resistor change its value when a force is applied to it. Pressure from a hard surface is not good for FSR and you will not get accurate result. For better output I place a small piece of foam on the bottom of every inner box using double sided tape. Place it in such position that it exactly be on the sensor.
Our pantry is ready!!!
Setup Amazon Dash Replenishment ServiceDRS provides connected devices with direct access to Amazon’s powerful retail platform to order any item automatically. With easy-to-use APIs, device manufacturers can take advantage of Amazon's authentication and payment service.
After integrating with Amazon services like Login with Amazon (LWA) and Simple Notification Service (SNS), a simple API call allows a manufacturer to place a product order on behalf of a customer.
Let's get started with DRS.
Log in to Amazon Developer and AWS AccountIf you don't have Amazon Developer or AWS (Amazon Web Services) Account then sign up for it.
- Direct link of Amazon Developer: developer.amazon.com
- Direct link of AWS: aws.amazon.com
For creating Amazon Security Profile:
1. Log into Amazon Developer Portal
2. After Successful Login to Developer Portal go to "Login with Amazon" from Apps & Services tab.
3. Click on Create a New Security Profile.
- Write your Profile Namen in Security Profile Name field
- Write your Profile's Description in Security Profile Description field
- Privacy URL field is for writing Privacy Notice URL and click Save button.
4. Now Click on Web Settings from Manage drop-down
5. Click on Edit button and then Enter Allowed URL, Allowed Return URLs and Click Save button.
(Note: We will host a html page in a URL and the address of that page would be the return URL. You can set it later).
6. Now, click on General tab and note down the Security Profile ID and Client ID which will be required later.
Amazon Simple Notification Service (Amazon SNS) is a fast, flexible, fully managed push notification service that lets you send individual messages or to fan-out messages to large numbers of recipients. Amazon SNS makes it simple and cost effective to send push notifications to mobile device users, email recipients or even send messages to other distributed services.
For Creating new Amazon Web Services SNS:
1. Login into Amazon Web Services Console
2. After Successful login in AWS Account search SNS and click on it.
3. Click on Create topic button.
4. A popup for SNS will be displayed. Enter Topic Name and Display name respectively. After writing this click Create Topic button.
5. Click on Edit Topic Policy from Other Topic Actions
6. Chose the option of "Only these AWS users" and then write AWS Account ID
You can get your AWS Account ID from My Account option
7. Now click on Update Policy button.
8. Note down the SNS Topic ARN(Amazon Resource Number).
9. Now, click on Create subscription
10. From the Protocol field select Email and enter your email address in Endpoint field.
11. Click on request confirmation. An email will be sent to your account.
12. From the provided link confirm your subscription.
1. Login to Amazon Developer Portal and go to "Dash Replenishment Service"
2. Click on Begin button. So, it will be redirected to Register with LWA page. Enter your LWA Security Profile ID (which noted earlier) and click next button.
3. Now Enter your Amazon Web Services SNS ARN (which noted earlier) and click next and Done button.
4. Now it is the right time to add a device in DRS account. Click on CREATE A DEVICE.
5. Enter your Device name and click to GENERATE button to generate a Model ID. Then Upload a photo. After that click next button.
6. Add Slots to your Device
Create as many slots as many you want for your device. Enter Product ASNs to slots. For information of Finding ASNs click on the "How to find ASNs" Google. Add items to your slot and submit.
Now you can use the Amazon DRS API in your application. For API and other help of DRS please visit: developer.amazon.com/public/solutions/devices/dash-replenishment-service.
Product registration using Customer facing webpageOnce we are done with creating all the individual elements, we are now ready to generate the authorization code from the DRS service that will be used to place order by Pantry.
For creating your own product registration page, you may use any of the free hosting platforms available.
Here is web page I have hosted on for register product from customer end to Amazon DRS. You may visit following link:
https://smart-pantry.000webhostapp.com/
And try to register by providing random serial no.
The html code for the website has been uploaded to code section.
To register your product:
1. Click on Login with Amazon and click on Okay button.
2. Choose the product for first slot and than click to next for second slot
3. Select product for second slot and so on.
4. Click to Complete Setup to Confirm Details.
5. After successful confirmation you will get an Authorization Code
6. You will also get an email about the confirmation.
Comments