Globally, nearly half of all fruits and vegetables are wasted each year. Oftentimes, this waste is caused by people either trying to eat fruit before it is ripe or waiting too long to consume it. Destructive methods of checking ripeness, like cutting into the fruit, are clear indicators, but waste the produce in the process if they are under-ripe or overripe. Additionally, a fruit or vegetable may look like it has spoiled through imperfections, but it is actually perfectly consumable. Instead, if people had access to a convenient, portable, non-destructive method of checking the ripeness of their produce, much less food would be thrown out each year. Additionally, a ripeness checker reduces one of the largest barriers consumers have for obtaining fresh produce: its quick spoil time in relation to its price.

What it does

RipeRight is a portable fruit ripeness checker that uses near-infrared spectroscopy and machine learning to check the ripeness of a given fruit. Using an infrared sensor, it collects a 6 channel reading which uniquely reflects and absorbs the six wavelengths of emitted light for a given fruit. RipeRight connects through BLE with a user’s mobile phone and the data from the reading is then passed through our pre-trained linear regression model that determines its ripeness using a database we collected. The model then returns one of three values, under-ripe, ripe, or overripe to the user through a mobile app.

How we built it

We built RipeRight using an Arduino Nano BLE, a SparkFun AS7263 Near-Infrared Sensor, a Google Cloud Machine Learning instance, and Android Studio. We 3D-printed our prototype RipeRight to be a portable casing for the battery pack, Arduino Nano BLE, and AS7263 sensor. We connected a button to the Nano so when the user presses the button, the Nano takes a reading from the NIR sensor and sends it over using BLE to the RipeRight mobile app. Once the data is sent to the phone, the app makes an API call to a pre-trained linear regression model that determines whether the fruit is under-ripe, ripe, or over-ripe. We collected the data for the sensor manually using fifteen oranges that we collected NIR values for and then cut open and ate to see if the oranges were ripe or not (we have had lots of clementines this weekend). The API returns a numerical value corresponding to ripeness which is displayed for the user on the app.

Challenges we ran into

We intended to use React Native to develop the app, however, much of the BLE support was not compatible with the BLE chip on the Nano. Instead, we switched over to AndroidStudio as it was more compatible with both the Nano and Google Cloud. Additionally, since the dataset we used for training our machine learning model was limited due to time, our accuracy was not as high as we would like it to be in the future. Also, I slightly burned my finger soldering wires directly to header pins since we miscalculated how much space jumper wires would take up.

Accomplishments that we're proud of

The BLE on the Arduino Nano worked well and the NIR sensor values were reliable. We are excited about how our hardware turned out and that the print for the prototype was successful. Additionally, despite our limited dataset, we are happy with how our linear regression model turned out and found working with Google Cloud to be a fun way to add ML to our app.

What we learned

We learned a lot about hosting machine learning on Google Cloud and creating our own endpoint to send our own data to. Some of us have used BLE before but we feel that this project enabled us to get a broader view of how BLE works and how to read values from multiple characteristics. We also had a lot of fun working on this and learning how near-infrared sensors work, the signals behind that was really cool and we would love to learn more about the processing behind that.

What's next for RipeRight

In the future, we plan to allow users to save the fruits and produce they scan and create an “Estimated Ripe Time” feature that will tell users how many days their produce will stay ripe for. This way, users can be notified if their produce is about to go bad and reduce more food waste. We also want to expand our database to other fruits and vegetables as well as gather more entries.

Thanks for giving us the opportunity to participate in HackSC 2022!

Share this project: