Smart SortBot is an industrial pick-and-place robotic system powered by intelligent classification logic using the (CLB) of the PIC16F13145. It combines image-based object recognition, fuzzy motor control, real-time logic processing, and robotic actuation to solve the challenge of automated sorting in micro-industrial environments
💡 Why It Matters
- Hardware-level logic allows real-time decisions with zero CPU overhead.
- Safe and low-power: robot stops instantly on emergency triggers.
- Scalable: system can be trained for multiple object types or destinations.
- Practical in Peru: useful for small factories, recycling centers, or agro-packaging.
🔧 System Architecture
📸 Image Processing:
- Objects are analyzed for color and size.
- Processed on PC and sent via UART.
⚙️ PIC16F13145 (CLB):
- Receives classification data via UART.
- Implements FSM to determine object destination (zone A/B).
- Manages emergency logic in hardware.
- Outputs control bits to the robot controller (PIC18).
🧠 PIC18F57Q43 (Robot Controller):
- Receives action bits from the CLB.
- Executes pick-and-place routine.
- Controls DC motors via fuzzy logic.
Connection between pic18f57q43 and pic16f13145
#include "mcc_generated_files/system/system.h"
#include <xc.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define _XTAL_FREQ 32000000
#define RX_BUFFER_SIZE 5
void main(void)
{
SYSTEM_Initialize();
CLB1_Initialize();
char rxBuffer[RX_BUFFER_SIZE] = {0};
uint8_t rxIndex = 0;
uint8_t receivedNumber = 0;
printf("Sistema listo. Ingrese un número (0-7) seguido de ENTER\r\n");
while (1)
{
// Si el sensor está activo, desactiva la salida CLB
if (sensor_PORT) {
CLB1_SWIN_Write8(0x00); // Apaga salida
continue; // Salta a la siguiente iteración del bucle
}
// Si el sensor está desactivado, se puede recibir datos por UART
if (EUSART1_IsRxReady()) {
char c = EUSART1_Read();
if (c >= '0' && c <= '9') {
if (rxIndex < RX_BUFFER_SIZE - 1) {
rxBuffer[rxIndex++] = c;
}
}
else if (c == '\r' || c == '\n') {
if (rxIndex > 0) {
rxBuffer[rxIndex] = '\0'; // Termina la cadena
receivedNumber = (uint8_t)atoi(rxBuffer);
rxIndex = 0; // Reinicia índice para próxima entrada
if (receivedNumber <= 7) {
uint8_t entrada = (1 << 3) | (receivedNumber & 0x07);
CLB1_SWIN_Write8(entrada);
printf("Número recibido: %u\r\n", receivedNumber);
} else {
printf("Número fuera de rango (0-7)\r\n");
}
}
} else {
rxIndex = 0; // Caracter no válido, reinicia buffer
}
}
}
}