Never run out of liquid laundry detergent again with this Amazon DRS enabled liquid laundry detergent sensor, a.k.a. LaundryBot.
Things used in this project
Story
Introduction
The LaundryBot is a Amazon Dash Replenishment Service (DRS) enabled smart liquid level sensor that will contentiously measure the surface height of the liquid detergent in the container, and automatically re-order through Amazon DRS service when the detergent is running low. It also features a Amazon Dash button that allows the user to manually order the liquid detergent at any time.
The LaundryBot consists of a non-contact liquid level Sensor Probe utilizing STMicroelectronics VL6180X Time-of-Flight LIDAR Sensor and a Controller powered by Arduino MKR1000. The Sensor Probe is designed to be mounted on the bulk liquid detergent container use the top ventilation opening. The Controller is Wi-Fi enabled and features a large back-lit LCD screen and can be placed nearby the the washing machine for easy access.
Motivation
As in many household we use the bulk liquid detergent bought from warehouse stores and online. They come in big bottles with a dispenser and can last for several months. Often they are stored above the washing machine and the detergent is dispensed use the valve below. It is difficult to check how much detergent is still available in the container, and if it needs replenishment. I want to have a ‘fuel gauge’ to visually display how much liquid is available with minimum modification to the container itself.
Bilk liquid detergent with dispenser
LaundryBot sensor and control unit
The Hardware Design – Use VL6180X as none-contact fluid level sensor
I deiced to use a STMicroelectronics VL6180X Time-of-Flight LIDAR Sensor instead of ultrasonic or IR sensors to measure the fluid level. VL6180X is a ToF ( Time-of-Flight) sensor with a built-in LIDAR: The sensor is sending out infraed laser light pulses and measures how much time it takes for the light to come back, allowing it to give accurate results independent of the target’s color and surface. The VL6180X device is operating at 2.8V. I used the breakout module from Pololu which includes the necessary voltage generator and level shifter to use the module in 3.3V or 5V systems. The breakout board is only 12mmx18mm, small enough to fit into the ventilation opening without cutting the plastic container.
To be used as liquid level sensor, this method works best on liquid with high viscosity and colorants. My experiments show that the sensor is not stable to measure clear liquid with low viscosity such as water since it sometimes can’t differentiate the light reflection from the surface and the bottom of the container.
A transparent plastic shield is mounted in front of the VL6180 board to make it water proof
Custom Parts and Enclosures
The sensor probe and control units are 3D printed with PLA. The STL files are included in the attachment. The sensor probe will be inserted into the container from top ventilation opening, and secured onto the container by the cap ring. The sensor head is sealed and water proofed with silicone conformal coating to protect the sensor. The sensor can also be used for other liquids in addition to liquid detergent, such as fabric softeners.
Setting up the Amazon DRS for the LaundryBot
In order to start with the Amazon Dash Replenishment Service for the LaundryBot, follow the following steps:
- Sign up for an Amazon Developer account: aws.amazon.com
- Create a new Amazon LWA Security Profile: developer.amazon.com
- Create Amazon Web Services SNS Topic: aws.amazon.com
In this step, I used the same information that I obtained for another DRS project, the FilamentBot and added the return URL for the new LaundryBot.
- Create a new Device at the Dash Replenishment Console
Finally it is time to create my own DRS device, the LaundryBot. This can be done at the Amazon Dash Replenishment Console. For each device you can create multiple ‘Slot’ which like the pre-loaded shopping carts so the end user can easily select the items they would like to order by the LaundryBot.
These steps are rather straight forward and I’m going to skip the detailed descriptions here for now.
Product Registration Page
With the above AWS information obtained, I then proceeded with setting up the LaundryBot Product Registration Page at http://laundrybot.artsuzhou.com. The website is hosted on Amazon AWS Simple Storage Service (S3) using the Amazon AWS Route 53 DNS management service. The example html code for the website can be found on the project Github repository.
Product Registration page
Success!
The Arduino Sketch for the LaundryBot
For distance measurement, I used the Pololu Arduino library for VL6180X. The sensor is set in the 2X scale mode which would extend the sensor range to 40cm with reduced resolution. The distance from sensor to the surface of the liquid will be shortest when the container is full, and becomes larger as the liquid level drops. The reversed linear relationship between the distance and the total volume will be visualized on the LCD screen in the shape of a bar graph in real time. When the fluid level drops below a pre-defined threshold, the LaundryBot will place the DRS order automatically. The user can also place the DRS order by pressing the ‘DASH’ button on the LaundryBot at any time.
For DRS, again the Arduino AmazonDRS library written by Brian Carbonette. Brian is used. The example Arduino Sketch be found on the project Github repository.
The steps are identical to what I have included in the FilamentBot project. For detailed information, please visit the FilamentBot project page.
- Exchanged the auth_code for the refresh token by running the authCodeGrant example sketch.
- Updated the AmazonTokens.h header file in your AmazonDRS library ‘src’ directory with values for…client id, client secret, refresh token, and redirect uri.
- Upload the LaundryBot sketch with your WiFi credential etc. to the LaundrytBot using Arduino IDE.
Finally the LaundryBot is ready to go! There are two ways in which the LaundrytBot can help you initiate a purchase of the detergent:
- By pressing the Amazon Dash button on the LaundryBot.
- Let the LaundryBot automatically initiate the DRS request on your behalf when the detergent level falls below a preset level!