Drs For Sanitization Needs Of Baby

Photo of ravibutani03

Made by ravibutani03

About the project

My Idea is about designing Amazon DRS enabled vending box for sanitizing needs of baby (i.e. baby diapers, baby soap and baby wipes).

Project info

Items used in this project

Hardware components

Magnetic Pin Back Magnetic Pin Back x 1
Momentary Pushbutton Switch - 12mm Square Momentary Pushbutton Switch - 12mm Square x 1
Tiny Breadboard Tiny Breadboard x 1
Standard LCD 16x2 white on blue Standard LCD 16x2 white on blue I2C Based grove 16x2 LCD x 1
ESP8266 Serial WIFI Module ESP8266 Serial WIFI Module x 1

Software apps and online services

double sided tape double sided tape
Arduino IDE Arduino IDE with esp8266 core https://github.com/esp8266/Arduino
Amazon Web Services AWS SNS Amazon Web Services AWS SNS

Hand tools and fabrication machines

Soldering iron (generic) Soldering iron (generic) x 1
Amazon Web Services Amazon Dash Replenishment Service Amazon Web Services Amazon Dash Replenishment Service x 1

Story

Idea

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.

Have a look at Final Demo of DRS4BABY

here is final demo video of DRS4BABY...

Final Demo Video of DRS4BABY

Special Features 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..

Want to build the same than...

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..

Essential Electronic Components used in this project (BOM)

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

Tool used in this project

1. Soldering Iron

2. scissor

3. Double side foam tape

4. Scale

5. Marker pen

6. Sketch pen

Creating Security Profile, Device and SNS topic for Amazon DRS

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...

1 / 131. Security Profile Creation on https://developer.amazon.com/

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..

1 / 2Logo for device and app

Now next slides shows steps for creating your device on Amazon DRS..

1 / 102. Creating Device with 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...

1 / 12

End Customer facing webpage for Product registration

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..

Product Registration Web Page for DRS4Baby

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..

window.open("https://www.amazon.com/ap/oa?client_id=amzn1.application-oa2-client.ec9be5378ace4941d323b06e68e28e33&scope=dash%3Areplenish&scope_data=%7B%22dash%3Areplenish%22%3A%7B%22device_model%22%3A%22"+productid+"%22%2C%22serial%22%3A%22"+serialno+"%22%2C%22is_test_device%22%3Atrue%7D%7D&response_type=code&redirect_uri=https%3A%2F%2Fdrs4baby.blogspot.in%2F2016%2F11%2Fregistration.html"); 

Hardware Build

Here are few pics of Hardware build and Schematic designed using NodeMCU V1.0 (ESP-12E)

1 / 4Main Processing Unit with ESP12-E

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..

Hardware Demo

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..

1 / 3

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.

Order confirmation received by end user of DRS4Baby

And finally here are few pics of completed hardware..

1 / 5

Thanks for reading... Hope you liked my project....Suggestion, questions, critics are welcome in comment window below..

Cheers...

Ravi

Schematics, diagrams and documents

DRS4Baby Schematic Based on ESP-12E

Circuit Schematic of DRS4Baby Electronics Part designed around NodeMCU V1.0 Based on ESP-12E

Code

ESP8266 Firmware

DRS4Baby Arduino IDE for ESP8266 Entire Sketchbook.. Just Arduin0->files->preferences and select this sketchbook, You are all set to use existing code or modify it without taking pain of installation of contributed libraries used in this project..

Page source of javascript for LWA at customer facing DRS product registration webpage...

Page source of javascript for LWA at customer facing DRS product registration webpage..

Credits

Photo of ravibutani03

ravibutani03

Hacker Maker Aeromodeller Educator

   

Leave your feedback...