Software apps and online services
Hand tools and fabrication machines
Baby diaper, baby soap and baby wipes are something whose frequency of use can not be predicted, hence Amazon DRS is very useful option for automatic replenishment stock of above items. And that requires internet connected vending box kind of thing to hold stock of these items.
My Idea is about design Amazon DRS enabled vending box for sanitizing need of baby (i.e. baby diapers, baby soap and baby wipes). So when vending box is about to run out of the stock of any of above three, it automatically place order on Amazon via DRS Service.
My vending box will have three slots each for baby soap, baby diapers and baby wipes.
list with ASINs of baby diapers will be mapped with slot1, list with ASINs of baby wipes will be mapped with slot2 and list with ASINs of baby soap will be mapped with slot3.
I will also make one webpage that is linked with Amazon DRS service, so user of the vending box can register and select product for each slot based on their preference using Product ID and serial number of vending box.
Main objective of this project is to design low cost vending box for baby sanitizing needs by utilizing ESP8266 like low cost WiFi modules and demonstrate end to end use case of Amazon DRS Service with easy and interactive end user interaction. I will also like to develop ESP8266's library for Amazon DRS integration and publish the same in open source domain, So any developer can utilize this library for integrating Amazon DRS service in their existing product with very low cost.
here is final demo video of DRS4BABY...
1. Low cost Hardware design of Amazon DRS powered vending box for Baby Diaper/Wipe/Soap (Low cost ESP8266 SoC, Low cost sensors)
2. All current information (i.e. Tokens, AP Credential, Slot Status) stored in eeprom of ESP8266 every time it changes. So on every power cycle DRS4BABY retains latest information.
3. All Amazon DRS APIs implemented for ESP8266 SoC, Just Authorization Code generation done at Product Registration Webpage. So it will be easy for makers to implement similer project without much knowledge of scripting...
4. Hardware Schematic, ESP8266 Firmware and Product Registration web page source code all released in open source domain under CC-BY-SA licence.. So any one can use this work or contribute.
5. The similar project can be used for Sanitary pads and used at washroom of public places.
6. Main philosophy used in this project is "Keep it As Simple As Possible" and "Put First Thing First" at a same time also considered end user aesthetics and ergonomics..
If some one finds it fascinating and want to replicate the same or modify and use this project for different purpose... simply follow the steps..
1. ESP8266 12E based NodeMCU V1.0 --> 1 nos
2. General Purpose PCB (6'x4') --> 1 nos
3. Neodymium Magnet (1cm x 1cm x 0.3 cm) --> 3 nos
4. Reed Switch --> 3 nos
5. USB Micro cable --> 1 nos
6. 16x2 I2C Grove LCD --> 1 nos
7. Male and female Header Strip --> 1 nos
8. Old cardboard boxes --> 3 nos
9. Push buttons --> 3 nos
10. LED --> 1 nos
11. Discrete 1/4 watt resistors --> Various
12. Solder wire, solder flux, jumper wires, Glue, Craft paper
1. Soldering Iron
3. Double side foam tape
5. Marker pen
6. Sketch pen
Following slideshow shows steps for creating Security profile, new device (in my case it is DRS4Baby ) and finally SNS topic for device..
1. Creating New security profile on Amazon Developer Console :
Before creating security profile be ready with meaning full logo for your Amazon App service, also decide web page for origin and return URL (only https://xxxx kind of secure page works) Return URL is very important, and we will be going to use it for customer facing product registration web page..
now follow steps suggested in following slides to create new security profile...
After completing above steps you should at least note down,
a. Client ID,
b. Security Profile ID,
c. Client Secret,
d. Return URL/URLs.
This information will be used to make customer facing webpage and in ESP8266 firmware programming...
2. Create new device on Amazon Dash Replenishment Service :
Before creating new device be ready with meaning full logo for your device and list of ASINs of products on amazon suitable to your device slots..
here is my device and Amazon app service logo..
Now next slides shows steps for creating your device on Amazon DRS..
After completing above steps you should at least note down,
a. Device ID,
b. Slot ID/IDs
Again this information will be used to make customer facing webpage and in ESP8266 firmware programming...
3. Creating SNS topic for Device on Amazon AWS :
The Dash Replenishment Service (DRS) uses SNS Topics to notify you (the device maker) of changes to device status, order state, subscription status, and more.
Following slides shows steps for creating SNS topic for your device...
This video explains step followed by end customer to register product with Amazon DRS and generate 20 character Authorization code..
here is web page I have hosted on my blog for register product from customer end to Amazon DRS. I suggest you to visit following link.. And try to register by providing random serial no..
You will not charged any thing as the lwa is done on this page with test purchase ....not real purchase...Your suggestions are welcome for this..
Once 20 Character Authorization code is generated using above registration process, This code will be used to configure DRS4Baby vending box to make automatic reordering of diapers, wipes and Soap possible without any human efforts.
HTML source code for product registration webpage is included in gthub repo as well as attachment with this blog post.. to use this html code with your device.. edit following line with your client id and encoded return uri..
Here are few pics of Hardware build and Schematic designed using NodeMCU V1.0 (ESP-12E)
Once you done with hardware, Download my sketchbook for ESP8266 firmware from https://github.com/butaniravi/DRS4Baby. open sketch and modifiy following line with Amazon DRS parameters relevant to your device..
//AMAZON DRS parameters const char* device_model = "041557cb-efe4-4233-1143-93ghb6077b01"; //Product model ID of your device const char* device_identifier = "ABCDE12345"; // Serial No of device any thing you wish at production end const char* client_id = "amzn1.application-oa2-client.ec9o65392ace4941a345b06e68e28e33"; // your Amazon developer account client ID const char* client_secret = "6430ef4a824b4ee04ce69c54266dd93bb51200b08da0b03126be2f9d7857a027"; // Your Amazon developer account secret code const char* slot_id1_diaper = "ab754ae9-f794-4060-8aad-a8694bb87432"; //Sloat ID for Diapers const char* slot_id2_wipes = "f22b00be-a76d-4448-99f2-304283ce1c77"; //Sloat ID for Wipes const char* slot_id3_soap = "09403b3c-f79b-42d5-aa80-ba06f984de53"; //Sloat ID for Soap const char* redirect_uri = "https%3A%2F%2Fdrs4baby.blogspot.in%2F2016%2F11%2Fregistration.html"; //Encoded Return URL //should be encoded and same as used at time of device creation const char* con_length = "286"; // its Packet size for post request please count your encoded redirect_uri charecters and replace this string with these number as per (286 -66 +length of your redirect URI)---yes its ugly,, but I havent updated it so far
If every thing works well you will get your hardware working as per following video..
Before I place all electronic stuff in to DRS4Baby vending box, I have created hardware demonstration video to show how entire project works and how automatic replenishment is done using Hardware. Here is a video of the same..
Code for ESP8266, Schematic of Electronic Hardware are released in open source domain. github repository link is added at bottom of documentation.
Once config button pressed on esp8266 it work as access point (AP) and broadcast its SSID (DRS4Baby). End user can connect to this AP using their mobile phone or personal computer and in browser it pass the information of Preferred network SSID, Password and Authorization code generated in above step.. selecting save option in browser ESP8266 automatically connects to preferred network...
Note: Authorization code can be used only once.. And its valid for about 15 minutes.. this time is not given in Amazon DRS Documentation but my personal experience its valid not more than 15 minutes.. so within 15 minutes it need to be pass to ESP8266 to generate valid refresh token which is than stored in eeprom for future use to generate access token.
Authorization code not necessary need to pass every time, and if ESP8266 get reply from Amazon that authorization code is invalid than ESP8266 uses old refresh token stored in eeprom.
Here is pics showing config hosted by ESP8266..
And here is pic of esp8266 terminal showing successful replenishment process... on trigger of single button...
I have registered device with test mode.. so email related to order do not have any order code as shown in pic below..
Note: if you are not using Test Purchase than you need to cancel order during development stage for next replenishment.. I have used real purchase for demo video.
And finally here are few pics of completed hardware..
Thanks for reading... Hope you liked my project....Suggestion, questions, critics are welcome in comment window below..