
JONICA
mhechavarria/color-caps-classifier
A project made mostly in python to classifie color caps using OpenCV

A project made mostly in python to classifie color caps using OpenCV
JONICA is an open-source printed circuit board by mhechavarria, from the mhechavarria/color-caps-classifier repository on GitHub. It is a 2-layer board with 59 parts on 105 nets, routed with 90 tracks and 0 vias.
It is built around the ARDUINO UNO R3, LM324 and LM358, with the CNY70, L7805 and ULN2003A among its other parts. Its parts include 31 resistors, 9 connectors, 8 ICs, 4 transistors and 2 capacitors. It belongs with the AVR (ATmega, ATtiny) boards of this library.
A mechatronic machine that classifies soda-bottle caps by color from a camera feed and physically sorts them into per-color outputs in real time. It combines computer vision (OpenCV on a Raspberry Pi), finite-state-machine firmware on an Arduino / ATmega328P, custom PCBs, and 3D-printed mechanical parts.
University engineering-competition project — Escuela de Ingeniería Electrónica, Facultad de Ciencias Exactas, Ingeniería y Agrimensura (FCEIA), Universidad Nacional de Rosario. The brief (set by the course): build a device that uses webcam images to classify caps by color and separate the red ones — minimum red/green/blue, with extra credit for yellow/orange/grey — designed to be scalable to an industrial setting in speed and throughput.
📹 Demo video: https://drive.google.com/open?id=1r29vyWqCW7NpwiLaEyCusYoAQh5E9Sr1
Hopper ─► paddle presents a cap under the camera + LEDs
─► Raspberry Pi (OpenCV, HSV) classifies the color
─► color code sent over serial / RS485
─► ATmega328P queues it (circular buffer) and drives stepper-actuated levers
─► cap is routed in free-fall to the matching output
(CNY70 reflective sensors track each cap's passage along the way)The caps are sorted in free-fall — a deliberate choice for speed. Levers driven by stepper motors deflect each falling cap into the right path.
Three subsystems integrated into one machine:
cv2.inRange masks (blue, green, yellow,
orange, red). Red is matched across two hue ranges to handle the hue wrap-around at 0/180°.calibracion.py) with live HSV trackbars to tune each color band.Circuito/, Sensor IR/, Shield pololu/).Modelos v4/, Caño para seleccionar tapas/). Wooden
frame, hopper, and output tube.| Part | Role |
|---|---|
| Raspberry Pi 3 Model B + PiCamera | Image capture, OpenCV classification, master controller |
| Arduino UNO / Nano (ATmega328P) | Real-time motor control + sensor handling |
| 3× NEMA 17 stepper motors | Paddle rotation + cap-selection levers |
| 4× A4988 stepper drivers | Micro-stepping motor drive |
| CNY70 reflective optical sensors | Cap-passage detection |
| MAX485 transceiver | RS485 serial link (Pi ↔ Arduino) |
| LED illumination + PC DC power supply | Lighting + system power |
| Path | Contents |
|---|---|
SRC/ | Cleaned-up source: vision (calibracion.py, script-picam-foto.py) + FSM motor firmware (nuevo_motores/) |
JONICA Rasp/ | Raspberry Pi scripts (PiCamera capture, color selection, demos) |
Script/ | Earlier vision-script iterations + test assets |
programa motores/ | Arduino firmware iterations (v1–v14), RS485 transmitter, sensor/comm modules |
Motor_paso_a_paso.ino/, Prueba_motor_unipolar/ | Stepper-motor test sketches |
Circuito/ | KiCad PCB projects (v1, v2, shield) + Gerbers / G-code |
Sensor IR/, Shield pololu/ | Eagle PCB designs |
Modelos v4/, Caño para seleccionar tapas/ | SolidWorks CAD, STL, and slicer G-code for the printed/mechanical parts |
INFORME/ | Project reports (Spanish) + state-machine and schematic diagrams |
On a Raspberry Pi (or any machine with a camera) with Python 3 and OpenCV:
pip install opencv-python numpy pyserial
# On a Raspberry Pi, also: picamera + RPi.GPIO
python3 SRC/calibracion.py # tune the HSV ranges for your caps/lighting
python3 Script/script.py # send color commands to the Arduino over /dev/ttyAMA0 @ 9600The code reflects its competition-time state (Spanish comments, some hardcoded paths, multiple preserved iterations). It's published as a hardware/software portfolio reference, not a packaged product.
Jonatan Arroyo · Tomás Ayi · Paula Diaz · Mariano Echavarría — Ingeniería Electrónica, UNR.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 7 | 10k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R1, R16, R18, R20, R21, R22, R23 |
| 4 | 1k5 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R11, R13, R24, R26 |
| 4 | 3.9 | Resistor_THT:R_Axial_DIN0614_L14.3mm_D5.7mm_P5.08mm_Vertical | R28, R29, R30, R31 |
| 4 | 4k7 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R12, R14, R25, R27 |
| 4 | IRLZ44N | Package_TO_SOT_THT:TO-220-3_Vertical | Q1, Q2, Q3, Q4 |
| 3 | 1k6 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R8, R9, R10 |
| 3 | 220 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R2, R3, R4 |
| 3 | 39k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R5, R6, R7 |
| 3 | 47k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R15, R17, R19 |
| 3 | CNY70 | Circuito:CNY70 | U6, U7, U8 |
| 2 | Pololu_Breakout_A4988 | Modules:Pololu_Breakout-16_15.2x20.3mm | A1, A2 |
| 2 | Pololu_Breakout_A4988 | Module:Pololu_Breakout-16_15.2x20.3mm | A4, A5 |
| 1 | 100nF | Capacitor_THT:C_Disc_D3.0mm_W1.6mm_P2.50mm | C2 |
| 1 | 330nF | Capacitor_THT:C_Disc_D3.0mm_W1.6mm_P2.50mm | C1 |
| 1 | 74LS08 | Package_DIP:DIP-14_W7.62mm_LongPads | U4 |
| 1 | Arduino_UNO_R3 | Module:Arduino_UNO_R3 | A3 |
| 1 | L7805 | Package_TO_SOT_THT:TO-220-3_Vertical | U2 |
| 1 | LM324 | Package_DIP:DIP-14_W7.62mm_LongPads | U3 |
| 1 | LM358 | Package_DIP:DIP-8_W7.62mm_LongPads | U1 |
| 1 | M0-MOSFET | TerminalBlock:TerminalBlock_bornier-4_P5.08mm | J2 |
| 1 | M0-POLOLU | TerminalBlock:TerminalBlock_bornier-4_P5.08mm | J7 |
| 1 | M1 | TerminalBlock:TerminalBlock_bornier-4_P5.08mm | J4 |
| 1 | M2 | TerminalBlock:TerminalBlock_bornier-4_P5.08mm | J5 |
| 1 | M3 | TerminalBlock:TerminalBlock_bornier-4_P5.08mm | J6 |
| 1 | SENSOR1 | Connectors_Terminal_Blocks:TerminalBlock_bornier-3_P5.08mm | J9 |
| 1 | SENSOR2 | Connectors_Terminal_Blocks:TerminalBlock_bornier-3_P5.08mm | J8 |
| 1 | SENSOR3 | Connectors_Terminal_Blocks:TerminalBlock_bornier-3_P5.08mm | J1 |
| 1 | UART | Connectors_Terminal_Blocks:TerminalBlock_bornier-2_P5.08mm | J3 |
| 1 | ULN2003A | Package_DIP:DIP-16_W7.62mm_LongPads | U5 |

mhechavarria/color-caps-classifier
A project made mostly in python to classifie color caps using OpenCV

mhechavarria/color-caps-classifier
A project made mostly in python to classifie color caps using OpenCV


dinge321/motor_pcb
This is a pcb for a 6V motor project using an unspecified microcontroler with the driver L293D


dario0603/electronic_load
Un progetto open-source per la progettazione e simulazione di un Carico Elettronico Bipolare (Electronic Load), ideato per il test e la caratterizzazione di alimentatori, batterie e circuiti di potenza.


QuartzAl/Projects-showcase
Main repository where I keep all of my project showcases related to Electrical Engineering These include PCB designs, electronic circuits, code snippets, and more.

Technariumas/smalsiukas
The conversion of a forklift truck to a line following robot.

aguuzzo/GZX
Este proyecto implementa un robot seguidor de líneas basado en un Arduino Nano, 6 sensores CNY70, motores Pololu y un driver de motores.
59 parts, built around the ARDUINO UNO R3, LM324, LM358 and CNY70. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the mhechavarria/color-caps-classifier repository on GitHub, at the commit this page was made from: the board is Circuito/Circuito v1/JONICA.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask mhechavarria before reusing the design.