Intro: IoT Bakery Smart Bin
Unsold bread in bakeries are dumped every day even though they are still edible. Our IoT Bakery Smart Bin gives the leftover bread a new life instead of going directly to the trash bin. Sensors are equipped in our smart bin to detect the condition of unsold bread and predict its expiry date using photoacoustic effect. Information of each batch of bread is sent to the cloud system which connects different bakeries to the neighborhood. We can therefore match the demand and supply of leftover bread in the community, relieve hunger and reduce the generation of food waste at the same time.
The smart bin prototype consists of a wooden box (i.e. the smart bin) with 2 separate compartments (Plastic tray with transparent front window). In each compartment, there is a tray for keeping bread. Laser light (represent by LEDs) is sent to the bread and the emitted sound wave is detected by a microphone, which is connected to IoT sensors for determining bread condition with reference to the detected wave pattern. Bread information including expiry date, location, quantity and type of bread will be stored in a cloud system and they can be accessed by both users from the supply (bakeries) and demand (NGOs, elderly home, community centre etc.) side. Such information helps optimize logistics work for bread collection as collectors can receive information of and ensure that the donated bread are safe to eat.
Step 1: Material Preparation
1) 2 A4 Size Transparent Plastic Trays (approx. 9.6'' x 13.3'' x 2.3'')
2) 2 Small Transparent Plastic Trays (approx 8.5'' x 6.1'' x 1.7'')
3) 1 USB Sound Adapter (Virtual 7.1 Double Microphone and Headset (PD560) USB Sound Adapter)
4) 2 Microphones (Polar PM-03 Metal Microphone) - detect emitted sound waves from bread
5) 2 USB Stereo Speakers (ApaxQ 2.0 Mini Speaker SP-833) - simulate sound emitted from bread
7) Computer (Rasberry Pi 3 Model B)
8) 9 10-mm LEDs (red, green and yellow, each 4) - simulate the laser source for photoacoustic effect
9) 2 Printed Circuit Boards (PCBs) (approx. 153 x 93 x 1 mm)
10) 1 Type-B USB Cable
11) 1 USB Hub
12) 1 Micro USB Cable
15) 1 5V 2A USB Portable Power Supply (Power Bank)
Saw, hammer and nails - for wood working
Step 2: Making the Wooden Box
Size of Wooden Box: 26 cm x 34 cm x 40 cm
1. Cut 5 wooden boards with dimensions listed as follows:
- 2 pieces 26 cm x 34 cm (Top and Bottom)
- 2 pieces 34 cm x 40 cm (Two sides)
- 1 piece 40 cm x 26 cm (Back)
2. Use nails to hold these boards together and form a box shown in the given figure (Front side of the box is opened!)
3. Cut another two wood pieces with the length of 30 cm and width of 5 cm. Hold them at the height of 20 cm above the base using nails. They serve as the rail of the top tray.
Step 3: Components Installation
4. Drill a hole at the back of the box for wires connecting to the computer.
5. Put a microphone at the side of the top compartment. This is for collecting sound waves from our bread sample.
6. Put LEDs with PCBs at the other side of the box. They refer to the laser source with various wavelengths and should be placed just opposite to the microphone.
7. Attach 2 speakers at the two top interior corners of the box. They are used for simulating sound waves emitted from the bread sample.
8. Stick the small plastic tray on top of the A4 size tray using tape such that the longer side of the small tray joins with the shorter edge of A4 tray. The small tray shows that the front window of the compartment is transparent so users can closely monitor the bread condition during measurement and transportation. The A4 tray indicates the size of compartment for bread storage.
9. Put the trays into the compartment.
10. Repeat the above steps for the bottom compartment.
Step 4: Emulation of Photoacoustic Sensor
11. An Arduino is used as the controller for the on/off sequence of the LED array, which serves as the light source for the sensor. The Arduino is chosen for the controller as it is one of the most commonly used platform for DIY projects due to the simplicity and flexibility of the interface.
12. Due to the low power of the LEDs, stereo speakers are used to simulate the acoustic signals obtained from the sample due to photoacoustic effect. Photoacoustic sensor is chosen for the proposed solution owing to its proven compatibility with all the three states of matter, i.e. solids, liquids, gas. This will allow us to monitor the change in gaseous chemical emissions, moisture, and physical properties such as heat expansion/dissipation rate, firmness, or elasticity of the bread sample. Therefore, it has the capability to serve as both chemical and physical sensors simultaneously, providing a more accurate method for monitoring the condition of the bread.
13. A microphone then receives the audio/acoustic signals and the data is fed into the Raspberry Pi, which serves as the core processor, through a USB sound card. A signal conditioning and pre-processing circuitry is typically needed to amplify the signals obtained and reduce the effect of noise, but as a speaker is used to simulate the acoustic signal, the amplitude of waves obtained is sufficiently large that it is not necessary to amplify the signals further. Raspberry Pi is chosen as the processor due to its accessibility and affordability to the public. We deemed that its processing capability to be sufficient as well, since it is not necessary for the system to be perfectly real-time, as that the condition of the bread will not change drastically over the span of several seconds.
Step 5: Data Processing Algorithm for Acquiring Bread Information
14. Once the acoustic signals are obtained through the microphone, audio fingerprinting is then performed on the received audio sample. The audio fingerprints of bread samples with known conditions are then stored in a MySQL database to serve as reference conditions for subsequent analysis of breads with unknown conditions.
15. Unlike the current approach for photoacoustic spectroscopy which will produce a complex spectrum of peaks, and is comprehensible to trained users or researchers, this method will allow us to monitor the condition and determine the real expiry date of the bread automatically by comparing the waveforms obtained with the ones in the database. A recognition test performed by using a music sample is shown in the following figure. Music was used to simulate the multiple frequencies that will be obtained from the photoacoustic sensor. Upon recognition or detection of the audio sample, a message could be shown in the GUI informing the user of the condition or expiry date of the bread by comparing with the known samples in the database.
Step 6: Mobile Application and Server (IoT Implementation)
16. All the information on the known bread conditions will be stored in the database and accessible through a mobile application connected to the server. The bakeries will use the app to input the number of a certain type of bread in each compartment, and the processor will send the data on the condition of the bread to the server/app via HTTP protocol. All these information, which includes the quantities and condition of each type of bread, will be available to the collectors or distributors of the bread.
17. Using the data given from the bakeries, the collectors can use the app to find the location of closest bakery which has sufficient breads to meet the current demand. This provides a more efficient method for the redistribution of the breads, saving both time and money incurred in transportation. The following figures shows a prototype GUI for the bakeries and collectors: