BREAD Vision

“BREAD Vision” utilizes vision software in conjunction with a BREAD system to judge physical characteristics and analyze the material characteristics of an object, and then return a pass or fail. The device is designed to be an open-source, affordable option for quality control applications.

Figure 1: BREAD Vision System

To accomplish this goal, seven functional requirements were created to be completed in four months. The goals are as follows: The entire device will have design files originated entirely from free and open source software. When Slice 1 and 2 are in functional pair mode, then Slice 1 (the computed vision slice) must be able to retrieve data from Slice 2. The vision sensor must be able to communicate with the BREAD Loaf. The device can detect inconsistencies in an object, i.e. dents, bruises, discoloration. The OpenCV slice will be completely autonomous, will not connect to the internet, and must not cause delays for other slices. At the end of the semester, these goals were all completed barring a design change to one slice instead of two. The functionality remains the same. Due to an unforeseen update to the Raspberry PI, the current full system has not been tested with shared memory. Individually, all parts of this device work.

Additionally, three value added goals were created and are as follows: The device will be able to have some level of object permanence, i.e. utilizing visual sensors to validate the presence or absence of an object, there will be seamless operation of the entire system and expandability for the platform will be ensured. Of these goals, one of three was completed. The system is the most expandable it has ever been; with multiple cameras, code can be created for many applications.

To replicate this process, first a BREAD system, a Raspberry PI 4, and a micro SD card and reader are required. No specific UNIX system image is required to install the required libraries for the BREAD Vision system. Before installing OpenCV it is required that Python 3.8+ is installed to support multiprocessing which provides shared memory support. A guide to updating or installing Python 3-9-9 can be found here. NOTE: If Python must be reinstalled all libraries must be reinstalled, this includes OpenCV. Once Python is installed a setup guide for building OpenCV from a source can be found here. Three more packages are required after installing OpenCV and Python. Run the three following commands to install them:

pip install numpy
sudo pip install picamera
pip install smbus

Utilizing custom cascades will require an internet connected Python capable device to search for desired samples, a Windows based system is required to build the cascades from collected samples, the tool required to do so can be found here. A device with the ability run the Arudino IDE and communicate using the serial monitor is required for interfacing with the vision system. Any Arduino Nano or equivalent microcontroller is to be used to communicate with the UNIX system. An 6-pin MicroSD reader is to be used with the microcontroller.

Figure 2: Pinout of Arduino Uno and SD card reader

A PI camera can further expand these capabilities. Color detection can be accomplished through the use of the libraries OpenCV, numpy, time, and the PICamera library. With a given color that the object is supposed to be, the current integration compares a point central on the camera window to the tolerance computed from the given nominal value and determines if the image from the camera falls within specifications. This can easily be expanded to incorporate multiple different points with different tolerance values for each point. The following video details the color comparison aspect of the system with two static images.

https://docs.python.org/3/library/multiprocessing.shared_memory.html
https://qengineering.eu/install-opencv-4.5-on-raspberry-pi-4.html
https://linuxhint.com/update-python-raspberry-pi/
https://docs.opencv.org/3.4/db/d28/tutorial_cascade_classifier.html
https://amin-ahmadi.com/cascade-trainer-gui/
https://pyimagesearch.com/2021/01/20/opencv-getting-and-setting-pixels/
Table 1: Links to relevant Open Source references

All code for this project can be accessed at https://osf.io/3xwtm/?view_only=74d76f44826b47d6b12f1d309913e1bf.

ComponentPrice
Micro SD Card7$
SD Card Reader4$
Raspberry PI 4 55$-105$
Arduino Uno19$-55$
PI Camera30$
USB Camera10$
Table 2: Bill Of Materials