Our initial supplies finally arrived a week ago, and I finally got to dig into the development for real. Below, you can see a photo of the supplies. They are organized by type: on the left you see the sensors, in the middle the micro-controllers, and on the right the communication platform (more on that at a later date).
I decided to start with the Hall Effect sensors since I had never used them before and because they felt very promising. Each small bag on the left contains 1 sensor, so I had 5 to work with in all. I began by simply plugging a single sensor into a breadboard and wrote code to get that working. At first, I struggled to get the readings from the sensor to make sense because they weren’t reading reliably. After a bit of research, however, I discovered that adding a 10K pull-up resistor was the trick, and then the sensor worked beautifully.
Next, I confirmed that 2 sensors would work in close proximity to each other. That went very smoothly and I discovered that the magnet has to be directly in front of the sensor to set it off, which can work well for our purposes, as long as we line up the sensors directly where the piece of metal that rest on top of the products sits.
Next, I wanted to get the sensors into the dispenser itself. This required soldering long wires to the end of each sensor pin to allow them to be farther away from the Arduino and to free them from the breadboard. I also added an LED to each connection which would turn off while the sensor was being triggered so that I could more easily see the state of each sensor.
I then mounted the sensors to a long piece of recycled cardboard, which allowed me to more easily move them around and to regulate the amount of space between each sensor. This version of the prototype has a lot of wires, as you can see below. One of my goals for the next week is to work on the wire management aspect of this design. The horizontal lines on the cardboard are roughly the size of one pad box and the sensors are placed every 5 lines, except for the bottom one which would signal an empty dispenser. If there is a case where the dispenser is ever filled but not completely loaded (thus triggering the top sensor), this could present a problem for measuring the amount of product and it will have to be studied further.
Finally, the sensor can be see in action. Notice that in the first photo, the green light on the right is on, while in the second photo it is being triggered by the sensor and is off. A video of this can be found here
Overall, things this week went very well. The biggest lesson I learned was that I need to plan more for issues around wire management, because it can quickly get out of hand. I think now that designing the casing for this project is going to be more important than getting the sensors working. In that vein, I have begun looking into some basics of 3D printing and boards that will allow me to more permanently mount the components in the hopes of designing a robust container.