First, I designed a Hall Effect Sensor. A Hall Effect Sensor is a device that detects the presence of a magnetic field and converts it into an electrical signal. I envisioned using this sensor as a prototype for my MVP. My idea was that for my pill box, the opening and closing actions could serve as indirect indicators to determine if the pills have been taken out. I began by crafting a small box with a hinged lid (3D model link here) and affixed small circular weights to both the top and bottom. My initial concept was to position the Hall Effect Sensor inside the box adjacent to one magnet. I thought that I would be able to discern the difference in readings when the box was open (next to one magnet) versus when it was closed (with two magnets in proximity).
After many unsuccessful attempts to get the sensor to function as desired, Nathan and I delved deep into online resources. We discovered that the Hall Effect Sensor we were using was digital, not analog. This meant it couldn't differentiate between the presence of one magnet versus two; it would only output binary readings (either 0 or 1). Consequently, I removed the internal magnets and substituted them with non-magnetic conductive metal washers. It's crucial for the face of the Hall Effect Sensor to be perpendicular to the magnet. I positioned it against the box so that its face was just beneath the location where the top magnet would fall.
This is what my final Hall Effect Sensor circuit looked like:
And here is the code that I used:
Following Nathan's advice, I measured the lid at various angles to determine the exact degree at which the sensor would detect the magnet. I found this angle to be 7.5 degrees.
Here is a video of the final working sensor!
For my next iteration, I plan to experiment with an analog sensor to see if it's a better fit for my project!
Subsequently, I developed a capacitive weight sensor using two copper sheets separated by a foam block. I placed an empty cup on this DIY sensor and recorded the Arduino serial value each time I added water in 20mL increments, up to a total of 230mL.
Here is what my set up looked like:
Here is what my code and circuit looked like:
And here are the results that I got: