Week 8

Input Devices

Testing Distance Sensor to Detect Water Level

Sensing Module Part 2: Accelerometer

Need for Accelerometer

With just the time of flight sensor, I was able to get the distance measurement. However, to fully understand the movement of the object, I needed to incorporate an accelerometer. For the hydration monitor we only want to consider the distance measurement when it is valid.

A valid measurement is

  1. Between 0 and the height of the water container

Since the VL53L0X is time of flight and the water bottle is moving most of the time, when the distance is taken the laser may not hit the water surface directly (maybe it reflects off the side of the bottle), leading to inaccurate readings. This is where the accelerometer comes in.

The accelerometer is a sensor that measures acceleration forces. It can detect changes in motion and orientation. Here I will use it to detect when the bottle is still for a threshold period of time and upright. The accelerometer will help ensure that the distance measurements are taken when the bottle is in a stable position, improving the accuracy of the readings.

Implementation

I used the ADXL343 accelerometer for this purpose. It is a 3-axis accelerometer that can detect motion and orientation changes. I configured it to trigger distance measurements only when the bottle is stable and upright.

ADXL343 Datasheet