ICOMP-UNC / Team-3

This project leverages the STM32F103C8T6 Bluepill microcontroller and the libopencm3 library to create an advanced conveyor belt system with adjustable speed and height-based object detection.
https://www.youtube.com/watch?v=Oym1SDomOgo
MIT License
1 stars 0 forks source link

System Design Documentation #7

Open NicoSeia opened 1 week ago

NicoSeia commented 1 week ago

Milestone Description:

In this issue:

NicoSeia commented 1 week ago

Our Modules:

Main Program

It controls the overall flow of the processes done by the embedded system we are using, the stm32f103T8c, and acts as the entry point of the system.


lcd.c

Controls the LCD display via I2C using a PCF8574 pin expander using these functions:

We use I2C to communicate with the PCF8574 I2C I/O Expander, which in turn controls the LCD. This module receives the data to be displayed from the main.


hc_sr04

Drives the HC-SR04 ultrasonic sensor to measure distances.

Uses GPIO and timers to control the TRIG and ECHO pins and measure the flight time. The hcsr04_get_distance function returns the calculated distance to main.


Motor Control

Control the motor using PWM. This module allows you to initialise the GPIO and timer to generate a PWM signal, adjust the motor power by varying the PWM duty cycle, and enable/disable the motor output.


PID Controller

Implement a PID controller to adjust the motor power based on a measured value (such as speed or position) and a reference value.


Speedometer

Measure the motor speed in RPM using a sensor or pulse counter.


Setpoint

Module in charge of reading the value of a potentiometer through the ADC and DMA in the microcontroller.


Button

This module manages the button inputs (START/STOP) to control the activation and deactivation of the motor, as well as object detection


Update

It controls the periodic update logic for the system, including PID control, measurement acquisition, and LCD data display.

iledesma08 commented 1 week ago

Communication between different components

Each module in the system has its own communication with the peripherals and sensors of the STM32 microcontroller, optimising the use of resources through I2C, GPIOs, timers, and ADCs. Each of these communications and how they interact with each other is detailed below:

Communication with the LCD via I2C:


Distance measurement with the HC-SR04 using GPIOs and timers


Motor control by PWM and setpoint reading with ADC:

Motor Control using PWM

Setpoint reading by the ADC


Encoder Feedback for Speed Measurement