MR BIN is our thesis project for our senior year in ADZU. It is a smart trash bin that can detect PET bottles and measure its volume, while rejecting other materials that are not PET bottles. After the device successfully scans the PET bottle, it will then compress the PET bottle and store it inside the bin. When a user successfully transacts using our device, it will give out incentives to that user (Incentive Noting). There are three modules in this device, the Plastic Detection Module, Volume Measurement Module and the PET Bottle Storage Module.
Initially, we tried using ultrasonic distance sensors for the volume measurement. The idea was that, given a fixed dimension enclosure of a length-width-height ratio of 2:1:1 in which users will deposit the plastic bottles, four ultrasonic sensors will be placed in the midpoints of the length and width side that is in line with the position of the bottles to be placed. We then measure the distance between the ultrasonic sensors and the plastic bottle in order for us to get the diameter and height of the plastic bottle. To get the diameter, we used the equation X - (x1 + x2), where X is the total width of the enclosure and x1 and x2 are the distances between the ultrasonic sensors and the plastic bottle in the length side. To get the height, we used the equation Y - (y1 + y2), where Y is the total length of the enclosure and y1 and y2 are the distances between the ultrasonic sensors and the plastic bottle in the width side. After getting all the values, we then used the right cylinder volume equation: (pi)(d/2)^2(h) to get the volume of the plastic bottle.
We have done alot of testing using the ultrasonic sensor, we even made a wooden enclosure with the dimensions of 40cmx20cmx20cm fitted with a slightly inclined base in order for the plastic bottles to fall into the center. However, the measurement of the volume proved challenging. As you notice, the right cylinder volume equation has the radius raised to the power of two. In an effort to improve accuracy, we integrated a temperature sensor inside the enclosure as the ultrasonic sensor uses speed of sound and sound is affected by temperature. Evidently enough, tiny changes in the diameter value from the ultrasonic sensors will expoentially increase/decrease the volume. This made noises/errors in reading a major factor in attaining accurate measurements. It is nearly impossible to get accurate measurements from distance sensors alone.
We then decided that we will use image processing via opencv, an open-source real time computer vision library developed by Intel. By using a camera, we will try to detect the edges of the plastic bottle and create a mask. After that, we will surround the bottle's area with four points encapsulating it into a rectangle. We can then get the measurement of the physical dimensions of the bottle by calculating the euclidean distance between the points. Given a fixed height of the camera from the base of our enclosure, we can calibrate the measurement by getting the actual dimensions of the plastic bottle and comparing it to our measured ones. The measurement will be adjusted by what we call the pixel-per-metric constant. The measured value in pixels will be divided by the pixel per metric constant for us to get the metric measurement.
Machine learning application is viable for the recognition of objects. The TensorFlow library is what we've found most suitable for our application. We trained our own datasets via transfer-learning, using ssd-mobilenet-lite as our reference model. This model is not the best model, but given the limited resources of the Raspberry Pi, the model will make do. After weeks of training, we've attained an average loss of 0.05 and we were careful not to overtrain our model. The trained model has been integrated into our program and fortunately, the raspberry pi can handle it.