Have you ever craved to eat something but need to postponed cooking it just because you run out of oil? Now, this won't happen again with the DRS Oil Container, an oil container that can automatically order new bottle of oil when you're running low of it.
The DRS Oil Container is equipped with ultrasonic sensor acting as level sensor and connected to the Genuino MKR1000. The Genuino will initiate a purchase with the help Amazon DRS API when the sensor reading is below the threshold value.Hardware setup
This project only involves the use of Genuino MKR1000 and HC-SR04 sensor. The HC-SR04 is connected to the Genuino MKR1000 as shown in the schematics. The Trigger and Echo pin of the HC-SR04 can be connected to any digital pins of your choice. The sensor is then placed under the container's cap.
Sensor placed under the container's cap
This project utilize AmazonDRS Library. The library is available on GitHub together with tutorial to setup DRS with push button. Before you start coding, there few setups need to be done in order to enable the Genuino MKR1000 to initiate a purchase via the DRS API.
1. Create Amazon Developer account
2. Create SNS Topic
3. Create a login with amazon (LWA) security profile
Create security profile for LWA
- Please take note of your Client ID and Client Secret as these need to be used in AmazonTokens.h file
4. Create a Dash Replenishment Device
Create the Device Name, Model ID, and upload a transparent png img (<1MB)
- ASINs are Amazon's version of unique product identification
- Please take note of the devices Model ID and the respective Slot ID
5. Authorize the device created earlier to make purchases and get authorization code grant
- After you finish editing the AmazonTokens.h file and add your refresh_token, your Genuino is now ready to initiate a purchase
In this demo, water is used instead of olive oil. The Genuino initiate a purchase when the level is below 5 cm.
Email confirmation of olive oil purchased
The project is not limited to replenishment of oil only but can be extended to any type of liquid container.