INTRODUCTION
Problem
The bearing cover plays a crucial role in engineering machinery by providing essential shielding and protection against debris Its sealed design effectively prevents airborne dust from infiltrating the components, while also safeguarding washable lubricants from contaminating the machine's ball slots.
The bearing manufacturing process often encounters defects such as scratches, bubbles, and excess material To address these issues, a thorough detection and classification process is essential Currently, this task relies heavily on human labor, with workers inspecting each bearing individually by sight Consequently, this method can lead to inefficiencies in time consumption, accuracy, and overall productivity in the production process.
Objectives
In the realm of technology and automotive industries, operations have evolved to function seamlessly and autonomously, requiring minimal human intervention A single inspector oversees the entire system, while all tasks can be efficiently managed through applications designed for mobile devices or computers.
The goal we mentioned above is also what this project is aiming for A half- automotive system that classifies and pack bearing seals in a most increased productivity and precise products.
Solution
To address the identified goals and challenges, our team will tackle the problem through clearly defined tasks We will design and implement a classification and packing mechanism, utilizing the Raspberry Pi Pico as the main control unit for PCB design and programming of the stepper motor and conveyor system Additionally, developing a model for image processing training will be a crucial component of our project However, we acknowledge that limitations related to product size, time constraints, and our current capabilities will necessitate further development in the future.
METHODOLOGY
Theoretical foundations of bearing seal
A bearing seal is a crucial component of bearing gear, utilized in a wide range of machinery Its primary function is to protect the bearing from dirt and other contaminants, a concept that has been established for many years.
Bearing seals are crafted from high-quality materials that offer excellent wear resistance and can withstand high temperatures These seals come in a variety of sizes, making them suitable for a wide range of applications, including automotive, aerospace, and heavy machinery.
Commonly, bearing seal consist of nitrile rubber and bonded with one to two metal sheets or plates There are different types of bearing seals, including:
- Contact seal: This type of seal is designed to come into contact with the shaft, creating a barrier to prevent contamination and leakage
- Non-contact seal: This type of seal does not come into contact with the shaft, instead creating a barrier through a small gap
- Lip seal: This type of seal uses a flexible lip to create a barrier and prevent contamination and leakage
- Labyrinth seal: This type of seal uses a complex pattern of grooves and channels to create a barrier and prevent contamination and leakage
- Mechanical seal: This type of seal uses a mechanical barrier, such as a spring-loaded seal, to prevent contamination and leakage
[1] Technical Dimension of the type of bearing we used for the project:
Theoretical foundations of mechanics
The mechanical design of the system consists of two main components The first part involves a classification mechanism that utilizes a mini stepper motor to rotate a shaft, which in turn adjusts the angle of a plate attached to the shaft.
A direct-drive mechanism transmits torque directly from an electric motor to the output device, such as a car's driven wheels, without the use of gears or belts This design enhances efficiency, accuracy, and reduces maintenance compared to traditional drive systems The torque and speed remain consistent, unaffected by rotation direction, as they are controlled by the motor and the shaft's rotation Direct drive systems are widely utilized in robotics, CNC machines, and precision machinery.
Gears are essential mechanical components that transmit rotary motion between shafts, featuring meshing teeth designed for precise interaction Key factors like the radius and number of teeth influence a gear's function and performance Often connected via shafts or bases, gears are utilized in gear trains to achieve high velocity ratios in compact spaces, known for their durability and capacity to handle heavy loads While they excel in speed reduction and torque transmission, providing a consistent velocity ratio, they are less suitable for high-speed or long-distance applications It's important to note that under excessive loads, the engagement of toothed gear wheels can lead to permanent damage Various types of gears offer distinct advantages and disadvantages, making it crucial to select the appropriate type, such as bevel gears, based on specific project requirements.
Bevel gears are specialized gears designed to transmit power between two intersecting shafts, featuring conical teeth that enable power transmission at a 90-degree angle They come in three main types: straight bevel gears, which have straight teeth parallel to the gear axis; spiral bevel gears, characterized by curved teeth that converge; and hypoid bevel gears, which differ from spiral gears by having pinion and gear centers at varying distances, resulting in quieter operation Typically made from steel or other robust materials, bevel gears are widely utilized in various applications, including automobiles, machinery, and power tools.
Theoretical foundations of electrical and electronics
It is very common to use microcontrollers or microprocessors to control actuators or process data in various applications These devices come in a range of bit sizes, from 4-bit
Microcontrollers, available in 15 to 64-bit options, are essential components in embedded systems and control applications, including robotics, industrial control, and home automation The choice of microcontroller or microprocessor depends on the specific application and workload requirements The PIC microcontroller stands out for its affordability, user-friendliness, and effectiveness in basic control projects, making it a popular option Additionally, pre-developed modules enhance their usability and programming simplicity, allowing for efficient integration into various projects.
The Raspberry Pi Pico is an affordable, high-performance microcontroller board featuring the RP2040 chip from the Raspberry Pi Foundation It boasts a dual-core Arm Cortex-M0+ processor with a speed of up to 133 MHz, 26 versatile GPIO pins, and 2MB of QSPI flash memory Additionally, the Pico supports various interfaces, including I2C, UART, and SPI, and comes equipped with a temperature sensor and a clock crystal, making it suitable for diverse projects and applications.
The Pico's standout feature is its capability to run MicroPython, a lightweight version of Python, enabling users to program and control the board with ease Furthermore, it supports programming in C/C++, Arduino, and CircuitPython, offering versatility for developers The Pico also boasts a variety of compatible shields and add-ons, facilitating seamless expansion for various projects.
The Raspberry Pi Pico is perfect for beginners, hobbyists, and students interested in microcontroller programming and electronics, while also catering to advanced users looking to develop complex projects This versatile microcontroller can be used to create a variety of applications, including home automation, robotics, and Internet of Things (IoT) devices.
A proximity sensor is designed to detect the presence or absence of objects within a specified range, effectively identifying various materials such as metal, plastic, wood, and liquids These sensors are widely utilized in automation, security systems, and robotics applications.
Inductive proximity sensors are a specific type of proximity sensor that utilize magnetic fields to detect metal objects These sensors are widely employed in various applications, including position detection and proximity switches, due to their unique characteristics and reliable performance.
Stepper motors are an excellent option for projects requiring easy regulation and design consistency They are widely utilized in industries that demand precise control, including CNC machines, laser cutting machines, robotics, and 3D printers.
A stepper motor is a synchronous electric motor that transforms discrete electrical pulses into precise angular movements, allowing for accurate positioning of the rotor at various locations.
Stepper motor has outstanding advantages but there are still disadvantages as follows:
Electric motors offer numerous advantages, including high torque at medium and low speeds, allowing for precise rotation angle adjustments Their long service life is attributed to the absence of brushes and physical connections, making installation and replacement straightforward Additionally, these motors are cost-effective, capable of maintaining a firm position, and feature quick start and stop capabilities.
Long-term use of certain motors can lead to several disadvantages, including slippage, noise, and heat generation during operation These motors may also cause vibrations and are not ideal for high-speed applications Additionally, the lack of a feedback system can result in a loss of position control, while power loss occurs since the motor requires continuous power supply to maintain its position even when stopped.
Communication systems can be categorized into wired and wireless based on signal transmission methods Wired communication is typically implemented through interfaces such as Serial port, USB, UART, I2C, SPI, and PROFIBUS.
Wireless communication offers unparalleled flexibility and convenience, contributing to its growing popularity Technologies like mobile phones enable communication anytime and anywhere, boasting high throughput performance Additionally, the infrastructure required for wireless communication is relatively simple and cost-effective to set up.
Figure 9 Devices using wireless connection
The CP2102, a USB-to-serial bridge controller from Silicon Labs, effectively converts USB signals to RS232 or UART signals, facilitating communication between devices Compatible with multiple operating systems, including Windows, MacOS, and Linux, the CP2102 is versatile for various applications such as programming microcontrollers, debugging embedded systems, and connecting to serial devices like printers and scanners.
Data is exchanged between digital devices in the form of bits, utilizing two main techniques: serial transmission and parallel transmission Serial transmission sends data bits sequentially over a single channel, while parallel transmission allows multiple data bits to be transmitted simultaneously across multiple channels.
Serial transmission involves the bidirectional movement of data bits between computers, where one bit is transmitted with each clock pulse This method transfers data in groups of 8 bits, utilizing start and stop bits for synchronization Serial transmission is categorized into two types: synchronous and asynchronous Common protocols used in serial communication include I2C, SPI, UART, and Ethernet.
Theoretical foundations of programming
C is a high-level, general-purpose programming language developed in the early 1970s by Dennis Ritchie at Bell Labs Renowned for its efficiency, C allows direct interaction with system hardware, making it a preferred choice for operating systems, embedded systems, and performance-critical applications.
"mid-level" language, as it provides a balance of high-level programming constructs and low-level access to system resources
It has a number of notable features, including:
- Low-level access to memory: C allows for direct manipulation of memory, making it suitable for systems programming and other applications that require high performance
- Portability: Programs written in C can run on a wide variety of hardware and operating systems with minimal modification
- Structured programming: C uses a structured programming paradigm, which makes it easy to write clear, organized and maintainable code
- Rich Standard Library: C provides a rich standard library that includes functions for input/output, string manipulation, and mathematical operations
- Pointers: C provides a powerful pointer feature that allows direct memory access, which is useful in situations where high performance is required
Python is a high-level, interpreted programming language that was first released in
1991 by Guido van Rossum It is known for its simplicity, readability, and expressiveness, making it a popular choice for beginners and experienced programmers alike
Python is a versatile programming language widely used in web development, scientific computing, data analysis, and artificial intelligence It boasts a large, active community and a rich ecosystem of libraries and frameworks that cater to diverse tasks With its intuitive and easy-to-read syntax, Python is an excellent choice for programming newcomers Additionally, its built-in garbage collector simplifies memory management, enhancing its appeal for beginners.
Python is also highly portable, which means that programs written in Python can run on a wide variety of hardware and operating systems with minimal modification
An embedded system integrates hardware and software to execute a specific function within a larger system Designed for dedicated tasks, these systems operate with limited resources, including processing power, memory, and energy consumption.
To effectively control mechanical structures for product classification using the Raspberry Pi Pico, we selected the C programming language along with the C/C++ SDK for its performance and reliability The C/C++ SDK offers essential tools and libraries that simplify programming the Raspberry Pi Pico in C, including a C-compatible compiler, peripheral interfacing libraries, and comprehensive documentation for beginners This SDK provides a low-level programming interface that enables direct hardware access on the Raspberry Pi Pico.
The Raspberry Pi Pico offers a variety of libraries for interfacing with its peripherals, including GPIO pins, I2C, SPI, and UART, enabling the development of diverse applications that demand real-time performance and low-level hardware access For programming the Raspberry Pi Pico, Visual Studio Code is the preferred choice due to its free, powerful, and customizable features, allowing users to install extensions for the C/C++ SDK and build code efficiently with minimal configuration.
Figure 13 Raspberry Pi Pico C/C++ SDK (left) and Visual Studio Code (right)
Theorical foundations of deep learning
Deep learning is a subfield of machine learning that focuses on developing models
20 that can learn representations of data through multiple layers of artificial neural networks
The concept revolves around the ability of multiple processing layers to learn progressively intricate features from input data, resulting in enhanced abstraction and improved performance across various tasks.
Figure 14 Deep learning is a subfield of machine learning
Deep learning models leverage artificial neural networks (ANNs) that mimic the biological neural networks of the brain These networks comprise multiple layers of interconnected artificial neurons, enabling them to process and transmit information effectively In deep neural networks, the presence of numerous hidden layers allows for the learning of complex representations of input data, enhancing the model's ability to understand and interpret intricate patterns.
Deep learning relies on the automatic extraction of valuable features from input data, eliminating the need for manually designed features This process, known as training, involves adjusting the neural network's parameters to reduce a loss function, which quantifies the discrepancy between the network's predicted output and the actual output The primary objective of training is to minimize this difference, enhancing the model's accuracy.
There are several types of deep neural networks, each of which is suited to different types of data and tasks Some of the most common types include:
Convolutional Neural Networks (CNNs) are specialized neural networks widely utilized in computer vision applications, including image classification and object detection By employing convolutional layers, CNNs effectively extract features from input data, enabling accurate predictions and pattern recognition Their ability to achieve state-of-the-art performance across various image recognition tasks highlights their significance in the field.
Recurrent neural networks (RNNs) are widely utilized in natural language processing applications, including language translation and speech recognition By employing recurrent layers, RNNs effectively process sequential data, enabling them to capture temporal dependencies within the information.
• Generative adversarial networks (GANs): GANs are a type of neural network that are used for generative modeling They consist of two networks: a generator network that
Generative Adversarial Networks (GANs) consist of two main components: a generator that creates new data samples and a discriminator that evaluates the authenticity of the data These networks are trained simultaneously in a competitive framework, aiming to enhance the generator's proficiency in producing realistic data.
Deep learning is utilized across various fields such as computer vision, natural language processing, speech recognition, robotics, healthcare, and finance Its remarkable capabilities have led to state-of-the-art performance in numerous applications, showcasing its potential to transform diverse industries.
Artificial neural networks (ANNs) are computational models designed to mimic the structure and function of biological neural networks found in the brain These networks comprise layers of interconnected artificial neurons that efficiently process and transmit information.
Figure 15 Structure of biological neuron
The basic building block of an artificial neural network is an artificial neuron, or perceptron, which made up of four different parts:
- Input Values or One Input Layer
A perceptron processes multiple inputs by applying weights and adding a bias before passing the result through an activation function to generate an output The learning capability of an artificial neuron hinges on the weights and the activation function The core formula of a perceptron encapsulates this process.
The weight parameter in a perceptron signifies the strength of the connection between input units and the perceptron, determining the influence of each input on the output Additionally, the bias acts as the intercept in a linear equation, further shaping the perceptron's output.
An artificial neural network is structured with multiple interconnected layers of neurons, each tasked with learning distinct features from the input data The input layer accepts raw data, while the output layer generates the network's final results Hidden layers in between progressively learn more complex representations of the input data.
Training an artificial neural network requires fine-tuning the weights of neuron connections to reduce the loss function, which quantifies the disparity between predicted and actual outputs The primary objective of this training process is to minimize this discrepancy This is commonly achieved through optimization algorithms like stochastic gradient descent (SGD), which systematically adjusts the weights to enhance accuracy and performance.
Figure 17 Structure of Artificial neural network
The activation function is a crucial component of a neural network It determines whether the neuron will fire or not
𝑦 = 𝐴𝑐𝑡𝑖𝑣𝑎𝑡𝑖𝑜𝑛((𝑤𝑒𝑖𝑔ℎ𝑡 ∗ 𝑖𝑛𝑝𝑢𝑡) + 𝑏𝑖𝑎𝑠) (2) which weight is the parameter represents the strength of the connection between units
An activation function is a crucial non-linear component in neural networks that adds non-linearity to the neuron's output By applying this function to the weighted sum of inputs and biases, each neuron generates its output, enabling the network to learn complex patterns.
The selection of an activation function is essential as it influences the neural network's capacity to learn intricate patterns from input data Among the widely utilized activation functions is the sigmoid function, characterized by its smooth, S-shaped curve that transforms any input into a value ranging from 0 to 1 This function is particularly effective in binary classification tasks, where the neural network's output must represent a probability value.
The hyperbolic tangent function (tanh) is akin to the sigmoid function, but it transforms input values to a range between -1 and 1 This characteristic makes the tanh function particularly useful in various classification and regression tasks.
Theorical foundation of image processing
Image processing is a specialized field that employs mathematical algorithms and computational methods to analyze, manipulate, and enhance digital images This discipline encompasses the conversion of images between formats, including transitioning from analog to digital, and facilitates the extraction of valuable information from images for diverse applications.
Image processing aims to enhance the visual quality of images, making them more informative and useful for both human interpretation and machine analysis This technology has diverse applications across various fields, such as medical imaging, video surveillance, remote sensing, and digital photography.
Image processing techniques are divided into two main categories: low-level and high-level processing Low-level image processing focuses on fundamental tasks like enhancing images, reducing noise, and adjusting contrast In contrast, high-level image processing encompasses advanced operations, including image segmentation, object recognition, and classification.
Recent advancements in computational power, machine learning, and artificial intelligence have significantly accelerated the growth of image processing These innovations have led to the creation of advanced algorithms and systems capable of automatically analyzing and interpreting vast amounts of image data.
A digital image represents a two-dimensional scene or object transformed into a digital format Composed of pixels—tiny units of color and brightness—these images create the visual content we see They can be stored, processed, and transmitted through electronic devices and computers.
30 systems, making them easy to share and manipulate
Digital images can be categorized into two primary types: raster images and vector images Raster images, or bitmap images, consist of a grid of pixels, each assigned a specific color and brightness, with common formats including JPEG, PNG, and BMP In contrast, vector images are made up of geometric shapes like lines and curves, defined by mathematical equations, allowing them to be scaled without loss of quality, which makes them perfect for logos and illustrations Popular vector formats include SVG and AI.
Figure 29 Vector image format (left) and Raster image format (right)
A depth map is a grayscale digital image that conveys the distance of objects from the camera or sensor These maps are essential in various applications, including 3D rendering, augmented reality, and robotics.
A color space is a framework that defines how colors are represented in digital images, outlining the spectrum of colors available for display or printing It establishes a standardized method for specifying and communicating color information effectively.
There are several types of color spaces, but the most common ones used in digital imaging are RGB, CMYK, and HSL/HSV:
RGB, an acronym for red, green, and blue, is an additive color model widely utilized in displays like computer monitors and televisions In this model, colors are created by varying the intensities of red, green, and blue light.
CMYK, an acronym for cyan, magenta, yellow, and black, is a subtractive color model essential for printing processes In this model, colors are created by blending these four ink colors, with black ink included to enhance contrast and minimize ink usage.
HSL/HSV, representing hue, saturation, and lightness/value, is a color space that defines colors based on their hue (color), saturation (purity), and lightness or value (brightness) This model is commonly utilized in image editing software for color adjustments and to produce various visual effects.
Figure 30 RGB, CMYK and HSV color space
Image processing frequently utilizes grayscale and binary images due to their simplicity and reduced information compared to color images Grayscale images feature varying shades of gray, from black to white, whereas binary images consist solely of two values, typically black and white.
Grayscale images are valuable in image processing as they effectively convey essential information like edges and texture while eliminating the complexities associated with color This simplification enhances the analysis and manipulation of images, leading to improved accuracy in processing algorithms For instance, in edge detection tasks, grayscale images facilitate the identification of object edges without the distraction of color data.
Binary images, simpler than grayscale images, consist solely of two values: 0 and 1, representing black and white They are commonly utilized in image segmentation to distinguish between distinct regions or objects within an image By applying thresholding techniques to a grayscale image, it can be transformed into a binary image, where the black and white values indicate different regions or objects.
There are some commonly image processing techniques used, such as Canny edge detection, contour detection, and the Hough transform:
Canny edge detection is a widely used technique for identifying edges in images, which represent boundaries between different regions based on properties like brightness and texture The Canny edge detector algorithm works by analyzing images for abrupt intensity changes and connecting the detected edge points into continuous lines This method is essential in various applications, including object recognition, shape detection, and feature extraction.
Figure 31 Canny edge detection example
DESIGN AND IMPLEMENTATION
Mechanical design
For overall mechanical parameters, the system will have these main components:
- Classification: including conveyor, detecting box and classification mechanism
- Packaging: a different part and mechanism to pack seals
- Detecting box: Including a box with camera up top, two side was high watt lights for a stable and guarantee lighting for further purpose of training samples
- Inductive Proximity Sensor: these sensors take a role as a initial position for the classification mechanism and packing position where the bearing seals drop
- Material selection mica acrylic is because the required block is small and light
Materials Acrylic (Mica) for packaging part, plastic ABS for packs
The blocks in the mechanical design section are briefly shown in the block diagram below
• Choosing the classifying mechanism for qualify the bearing seal product whether it is pass or fail:
In response to the need for flat objects like bearing seals, we have developed several innovative ideas and gathered valuable references through extensive online research.
Figure 36 Retracting Belt Reject Mechanism
This design enables efficient and precise product dropping and classification However, it may necessitate the use of two conveyors, which are not essential for this project due to constraints in property and time.
This model demonstrates that utilizing a single conveyor is sufficient, and it can be prototyped with a direct drive mechanism However, the classification process for flat seals is prolonged due to the rubber intersection between the bearing seals and the conveyor.
Then we finally came up with the below design:
The classification plate must rotate to the designated packaging area when a product passes inspection; however, if a product fails, it will rotate to the opposite side to discard unqualified items, particularly when the stepper motor is positioned on the left.
To ensure accurate operation after adjusting the rotation angle to the pass and fail angle, it is essential to establish the initial or home position This home position is crucial, as it serves as the point where seals are placed before the classification process begins.
The plate must be positioned adjacent to the end of the conveyor to ensure its shaft connects directly with the drive mechanism, while the stepper motor should be mounted on the left side of the conveyor's leg.
In our recent Mechatronics Project, we opted for a direct drive mechanism to streamline the design for mass production, which has demonstrated high accuracy in various tests However, this approach comes with a drawback: the necessity to establish a home position and calculate the angle for the drop flap based on friction.
Figure 38 Drop Flap Reject Mechanism
To meet the specified requirements, the pass product must achieve an angle of 32-34 degrees, while the fail product is designed to rotate in the opposite direction The stepper motors, which have 2048 steps per full revolution (360 degrees), require 182 steps to achieve a 32-degree rotation Additionally, a home position can be established at 14 degrees, where a steel or iron object is detected by the proximity sensor, allowing for accurate calculations of other positions from this reference point.
The system operates by dropping seals onto a plate, where they remain until a predetermined delay before rotating to indicate a pass or fail status Each time the system is powered on, the stepper motor completes a full rotation to locate the home position, identified by the detection of steel or iron via a proximity sensor After classifying each product as either passed or failed, the motor returns to the home position, ensuring consistent functionality.
We opted for a drop flat reject design with a direct-drive mechanism, simplifying the calculation of the angle at which gravity overcomes the friction force between the seal and the plate surface, facilitating the dropping process.
After the bearing seals have been qualified, selecting the appropriate packaging mechanism is crucial The packaging process relies on ensuring that the pack is correctly positioned when the passed seals begin to drop, mirroring the initial classification position When activated, the stepper motor completes a full rotation until it receives signals from the inductive proximity sensor, which detects the pack secured with an iron screw.
It is designed that there are six packs can be flexible in disassemble and assemble to
After loading one pack, which includes four seals, the stepper motor will reset its rotation until the next pack is placed on the rotating plate Once the plate is fully loaded, it will be removed and reattached for the next cycle.
The direct drive mechanism simplifies the calculation of the rotation angle for the block However, there is a predetermined position for rotation that lacks aesthetic appeal and poses challenges for motor installation, as illustrated in the accompanying image.
Figure 39 Drive with direct mechanism (Isometric view)
Figure 40 Drive with direct mechanism (Front view)
Drive with bevel gear transmission:
In order to optimize and maintain the same speed, we choose to use a bevel gear transmission
Figure 41 Bevel Gear Drive Mechanism(Side view)
Figure 42 Bevel Gear Drive Mechanism (Isometric view)
When designing with bevel gear drives and utilizing a NEMA 17 stepper motor, it is essential to ensure that each step corresponds to a rotation of 0.45 degrees This careful adjustment allows for flexibility in movement while preventing any rotation that exceeds the detection range of the proximity sensor.
In this design packaging mechanism, bevel gear drives are utilized instead of direct-drive transmission, with the initial two plates serving as the foundational support for mounting the motor and sensor, as well as for aligning the shaft.
Electrical design
After calculating and finished mechanical progress of our project, next step is to create an Electrical design
It will be directly controlled through an CP2102 communication using Raspberry
The Pi Pico will be utilized to control stepper motors and a conveyor motor while receiving sensor signals based on predefined criteria Consequently, the team will develop the GPIO on the microcontroller and compute various electronic data The electrical design will incorporate the circuits detailed below.
• Power supply: To supply power for the conveyor and main source to convert to other power states
• Microcontrollers: Raspberry Pi Pico to control, receiver and send signal across devices
• Stepper motor driver (DRV8825): an integrated motor driver makes interfacing with a microcontroller with two pins to control both the speed and the direction of the stepper motor
• Inductive proximity sensors: detect the position of the steel object mounted on the rotating disc and on shaft The purpose is to determine the initial position
Figure 51 Block diagram of electrical design
We will utilize two power sources for our project: a 5V supply from the PC USB port and a 19V supply from an adapter The 5V will power the CP2102, which will indirectly provide 3.3V for the system voltage pin of the Raspberry Pi Pico microcontroller Simultaneously, the 19V will be divided into two outputs: one will directly power the conveyor, while the other will be used for a 12V Buck Circuit.
The circuit features a power jack and a buck converter that provides power to the microcontroller and its peripheral devices By connecting 19V to the IN+ pin and GND to the IN- pin of the XL4015, it effectively supplies power to both the sensor and the stepper motor.
We also add a power supply expansion for 3V3 and 5V which can receive from CP2102 circuit (Will be mentioned in processing block)
The inductive proximity sensor is essential for accurately detecting the position of metal objects on a disk, establishing the initial "Home" position This sensor produces a digital output signal that synchronizes easily with other signals, facilitating straightforward coding Despite its compact size, the sensor's design allows for convenient mounting and placement Operating on the principle of magnetoresistance, it detects the presence or absence of a magnetic field, with the output voltage of a Hall sensor being directly proportional to the strength of the magnetic field.
Sensor modules for proximity detection, positioning, motion detection, and current sensing are readily available, offering high quality at affordable prices These modules are easy to implement, making them ideal for various applications Below is a table detailing some key sensor specifications.
Figure 55 LJ12A3-4-Z/BX inductive sensor schematic
When the sensor is exposed to a magnetic field, its digital output shifts to a low-logic state, and the built-in status LED activates, indicating the sensor's response.
The CP2102 USB-to-UART module serves as a bridge controller for communication with host computers via standard USB cables Widely utilized in embedded systems and microcontrollers, it features a built-in voltage level translator, allowing compatibility with various microcontroller voltage levels Additionally, the module includes an on-board voltage regulator, providing power to connected devices and offering an extended 3V3 output pin to power Raspberry Pi projects effectively.
Figure 56 CP2102 output pin in project schematic (Right) & CP2102 module (Left)
The CP2102 features a USB 2.0 compliant full-speed Universal Serial Bus function controller, which includes an integrated transceiver along with on-chip matching and pull-up resistors This USB function controller is responsible for managing all data transfers between the USB interface and the UART.
Model LJ12A3-4-Z/BX Dimensions DIA 12mm, L:64mm
Operating voltage 6V – 36V Detect of object Metal
Logic NPN - NO Output current 300mA
56 as well as command requests generated by the USB host controller and commands for controlling the function of the UART
The processor chip or microcontroller is essential in control circuits for data processing and peripheral device management The choice between a processor chip and a microcontroller depends on the intended purpose, required functionality, and the critical factor of product pricing.
Figure 58 Raspberry Pi Pico pinout [13]
[13]This Raspberry Pi Pico module or other Raspberry Pi variants have the dual-core ARM Cortex M0+ processor running at 133 MHz, with 264 KB of on-board SRAM and
The device features 2 MB of on-board flash memory and includes 26 multi-function GPIO pins It is equipped with 2 USB 1.1 ports and offers a range of interfaces, including 2 I2C, 2 SPI, 2 UART, and 3 channels for 12-bit analog-to-digital conversion (ADC).
6 × controllable pulse-width modulation (PWM) channels It also has a temperature sensor and a real-time clock
The circuit includes a reset and flash button to regenerate program to Raspberry via a USB Port
Figure 59 Raspberry Pi Pico Schematic
The Raspberry Pi Pico, equipped with multiple functions and pins, eliminates the need for additional microcontrollers It communicates with a host computer via UART through a CP2102 connection, utilizing GPIO 0 and GPIO 1 for data transmission through the Tx and Rx pins on the CP2102.
UART (Universal Asynchronous Receiver/Transmitter) is a serial communication interface that enables asynchronous data transmission between devices, sending data one bit at a time through a single channel.
A UART consists of two primary components: a transmitter and a receiver The transmitter sends data over a communication line, while the receiver receives data from that same line Data transmission and reception occur through different pins on the device's connector, commonly referred to as Tx for transmission and Rx for reception.
From the Raspberry Pi Pico specifications, we would know VSYS would be a main input source for the whole Raspberry circuit, and it uses 5V level as a source
Inductive proximity sensors are commonly utilized; however, their output voltage of 5V is incompatible with Raspberry GPIO pins To address this issue, our team has opted to implement a logic level converter to facilitate communication between the 3.3V and 5V voltage levels.
The logic converter operates using separate ground connections for high-level (HV) and low-level (LV) sources, as indicated by the HV, LV, and GND pins This converter features four channels, with each HV channel (HV1-4) and corresponding LV channel (LV1-4) connected independently, ensuring no interaction between different channel pairs A schematic illustrating the usage of the logic converter is provided below.
Figure 61 Logic Converter Schematic in project
Program design
The operation of the classification system and how the devices within the system connect and communicate with each other is:
Upon startup, users will configure the system through the control application on their device, establishing the necessary settings for image processing and deep learning operations.
The defect detection process for bearing seals consists of two key components: traditional image processing techniques and the implementation of deep learning models The outcomes of this analysis are then relayed to the user interface, while the relevant commands are transmitted to the Raspberry Pi Pico for further action.
- Whenever a classification result is produced from the software, it will transfer the output to the Raspberry Pi Pico to control the hardware to execute the task
3.3.2 Image Processing and Deep Learning
We classify bearing seals using traditional image processing techniques alongside the YOLOv7 model Initially, the image processing stage preprocesses the input image to identify any shape or size errors in the bearing seals If the seals pass this initial evaluation, they are then analyzed by the YOLOv7 model, which detects surface-related errors.
In image processing, preprocessing techniques are utilized to minimize noise and isolate bearing seals from the background through Gaussian Blur, followed by conversion to HSV color space and thresholding Contour detection is then employed to identify bearing seals, ascertain their coordinates, and crop the images accordingly By analyzing the results of contour detection, we evaluate the number of contours identified along with hierarchy information to ensure the removal of edge waste from both the inner and outer edges of the seal.
The minEnclosingCircle() function is utilized to determine the area of each edge of the bearing seals, provided that the seal meets the necessary requirements By using the perimeter of each contour in conjunction with the previously calculated area, we can assess the roundness of the seal edge using a specific formula.
4∗𝜋∗𝐴𝑟𝑒𝑎 (1) The roundness value ranges from 0 to 1, with a value of 1 indicating a perfect circle
A value of 0 signifies a non-circular shape, while values exceeding a threshold of 0.8 trigger the application of the Hough circle transform to identify the inner and outer circles of the seal This process allows for the calculation of the radius and center of each circle By analyzing the ratio of the distance from contour points to the center against the standard radius of the seal, we can effectively classify bearing seals with size defects.
Bearing seals that have successfully passed initial inspections are then processed using the YOLOv7 model to identify surface defects, specifically scratches To effectively train this model, we compiled a dataset of images showcasing the defects, which were directly captured using a camera Given the limited number of sample objects, we employed data augmentation techniques to enhance our dataset This involved generating additional training data by manipulating the existing images through rotation, flipping, and brightness adjustments.
To effectively annotate images for object detection, it's essential to use bounding boxes that specify the location of objects A bounding box is defined by four key coordinates: the top-left corner's coordinates, along with the height and width of the box For YOLOv7, the required annotation format follows a specific structure.
- class: The object class index, starting from 0 to N-1, where N is the total number of classes
- x: The x-coordinate of the center of the bounding box, normalized by the width of the image
- y: The y-coordinate of the center of the bounding box, normalized by the height of the image
- width: The width of the bounding box, normalized by the width of the image
- height: The height of the bounding box, normalized by the height of the image
The normalized coordinates and dimensions are used to ensure that the annotations are independent of the size of the input image during training and inference
To label images for YOLOv7, the LabelImg tool is utilized, enabling users to open images, draw bounding boxes around objects, and assign class labels to each box After labeling, the tool exports the annotations in a format compatible with the YOLOv7 training algorithm, facilitating effective learning from the labeled data.
Once the complete image dataset and the accompanying txt file with parameters for each image are finalized, the next step is to split the dataset into two segments: training and testing In this process, we randomly partitioned the image dataset following a specific ratio.
70% for training and 30% for testing
Training artificial intelligence models, especially those based on the YOLO architecture, demands high-end computer hardware and substantial resources, making personal computer training impractical Additionally, the lengthy training durations further discourage individuals from attempting to train these models on their own systems.
We opted to train the model using Google Colab, storing the data and results on Google Drive This approach not only reduces training time but also minimizes the risk of errors from software conflicts or hardware failures.
Figure 74 Google Colab training screen
The input parameters for training the model is showing below:
The train.py program takes input arguments, then builds the model and performs the training process
Figure 75 The training code segment
The below flowchart shows the overview of applying image processing and deep learning to detect defection on the bearing seals:
The flowchart illustrates how the Raspberry Pi Pico manages the conveyor belt system, including classification and packaging, by processing input commands from a computer along with data from proximity sensors.
Upon startup, the Raspberry Pi Pico initializes the system structures based on signals from proximity sensors Upon receiving commands from the computer, it controls the conveyor belt, rotates the classification structure according to the input, and adjusts the packaging structure to the next available position once a sufficient number of packages is collected This synchronous control of the structures minimizes operational errors.
Users can reset the working position of the Pi Pico directly from their computer Additionally, the operating parameters of the Pi Pico can be configured using software on the user's computer.
Implementation
After designing the component, we converted certain parts into a 2D sketch or DWG file format suitable for laser cutting We created one to two prototypes for review, noting any missing elements The final version was laser cut with a clearance fit of +0.1, based on our research into laser cutting specifications.
Figure 82 Example of dwgfile converter view for laser cutting
Figure 83 Parts view in laser cutting program
3D printing is essential for creating components with complex shapes, as traditional manufacturing methods may not suffice The typical clearance fit for 3D printed parts ranges from 0.25 to 0.5 mm, depending on the printer's quality and the type of plastic used After conducting tests on specific 3D printers, adjustments to the clearance fit may be necessary, often increasing it by +0.3 mm for optimal assembly Additionally, to enhance the toughness and hardness of 3D printed shafts, we increase the plastic density to 80%, while maintaining a density of 50% for other components.
The part files converted to stl file for the printing program Ultimaker Cura to understand and adjust
Figure 84 3D printing file view in Cura
There are many ways to create prototype but laser cutting and 3D printing are the two most common and flexible way for projects:
Aesthetics Flat, correct shape, and even Have unstable and not even corner, especially with shaft
No (base on design) No (base on design)
Time Less time and faster than 3D printing
Take a lot of time if the parts are huge
Given the project's specific conditions and requirements, we opted for two methods—laser cutting and 3D printing—rather than utilizing metal materials Below are examples of the outcomes achieved through these techniques.
When designing a control circuit PCB, it's essential to focus on wire routing and trace width to minimize signal loss, utilize ground planes for effective shielding, and strategically place power supply components for optimal power management Additionally, implementing thorough testing and debugging protocols is crucial to verify that the circuit operates correctly prior to final assembly.
Figure 87 PCB top view (Left) and bottom view (Right)
Figure 88 PCB with headers, components and electric box
Figure 89 Final Prototype after assembly and attach
Components, quantity, price for each component and total cost to complete our system are list below:
Table 13 List of Price of Components
The table above does not include extra fee such as delivery fees and others that cost to make this system
TOTAL PRICE (VNĐ) Mica (Laser cutting)