The design of my device revolves around making it easy to replenish products you need without even knowing it is happening. My approach is centered on one fact -all replenishable products have weight. Therefore, this device can work with any product. The ability to manufacture one device that can work with any product is extremely important. The Amazon Dash button is a good example of this concept. The Dash button works with any product no matter what it is. The only problem is that you have to remember to press it in order to replenish it. In order to get around this problem you place the Dash button in the same location as the product that needs to be replenished so you do not forget to order more. My concept takes it to the next step. Leave the product on the sensor and the sensor will take care of monitoring, updating Amazon with your product's state, and initiating the replenishment process without you having to think about it. By the time you run out of a product you already have a new one at your doorstep.
This is my first time connecting sensors and wires to prototyping boards. This is also my first time soldering anything. Finally, this is also my first time using a CAD tool and 3D printing my design. With that in mind, my methods are probably archaic or outright wrong. The amount of time it takes you to do this project maybe much lower.
- Raspberry Pi 3 Model B: This the component responsible for communicating with Amazon DRS. It updates Amazon with the device status and lets Amazon know how much product remains. The Raspberry Pi's main task is to call the replenish API when it it time to reorder more product.
- Arduino MKR1000: The Arduino is responsible reading pressure data from the FSR and sending it to the Raspberry Pi through USB. It also lights up the Neopixel ring when it notices that there is nothing on it. It does this to alert the user to put the product back on the scale so it can keep on monitoring it.
- FSR: This measures the pressure placed on the top plate on the device.
- Adafruit Neopixel ring: This LED ring is used to light up the top plate in order to alert the user to put the product back on the scale to continue monitoring it.
- Other materials: Wires and 10K ohm resistor to complete circuit design. Putty in order to place pressure on the FSR. Generic tape to help hold components in place.
The reason I decided to use both an Arduino MKR1000 and a Raspberry Pi 3 is because I am much more familiar with developing code in .NET than in C. If I had more time I would have been able to write all the code in C on the Arduino making the overall design much more compact.
The case consists of three main 3D printed parts:
- Top plate is where the product sits and puts pressure on the FSR.
- Middle plate holds the FSR, Neopixel ring, wiring, and Arduino MKR1000.
- Bottom case holds the Raspberry Pi 3.
The case is made of transparent PLA in order for the LED's to shine through.
- Windows IoT and Visual Studio 2015: Windows IoT is the operating system installed on the Raspberry Pi 3. This allows you to use .NET and C# to write modern apps. Visual Studio 2015 was used to write the Windows Universal app that runs on the Raspberry Pi.
- Arduino IDE and Neopixel library: I used the Arduino IDE and Adafruit's Neopixel library to write the Arduino sketch.
- Microsoft 3D Builder: I used this free tool to design the printed case.
There are a few steps to getting the device up and running.
- First you need to setup Login with Amazon (LWA). Click this link to learn how to implement LWA. I created a website that allowed me to authenticate with Amazon and obtain access and refresh tokens. The tokens allow you to make authenticated Amazon Web API calls like the replenish API call.
- The next step is to upload the Arduino sketch to the MKR1000 and upload the UWP app to the Raspberry Pi 3. Click here to go to the Github repository.
- Below are the places where you need to put your own values in the Windows IoT project.
// line 22 of MainPage.xaml.cs enter your product slot id
private const string SLOT_ID = "";
// line 45 of DrsClient.cs enter your refresh token
private const string START_REFRESH_TOKEN = "";
How It Works
The entire approach revolves around pressure. When pressure is placed on the top plate this pressure is transferred to the FSR. The MKR1000 reads this pressure and converts the raw value in a value between 0-5000mV. If the MKR1000 detects that there is very little pressure indicating that there is nothing on the plate, then the LED ring is triggered and lights up. When it detects that something is placed on the device it turns the LED ring back off. The MKR1000 is constantly sending FSR values to the Raspberry Pi through USB. The Raspberry Pi converts the voltage values into weight and then uses that to track the changes in the product. Once a day it sends device and product status to Amazon. If the device detects that the weight has dropped below a certain threshold for a certain amount of time it makes an API call to Amazon to reorder the product.
This device hardware can be improved in several ways. The Arduino and Raspberry Pi can be connected through pins instead of USB to make it more compact. The case can be made flatter and wider to support larger products more easily. The biggest improvement would be to condense everything to the Arduino MKR1000 size allowing it to be more compact and run on less power.
From the software side the biggest improvement I would make would be to connect it to an MQTT service in order control, monitor, and turn it on/off. The goal was to complete this MQTT feature, but I ran out of time.
I submitted this device to be certified with Amazon so there will probably be other changes to this device and software to get it fully certified.
This device has a lot of promise. It is simple, easy to use, uses very little power, not intrusive and self monitoring. It does not require any additional steps in order to reorder products making it a perfect extension to the Dash family.