This project simulates a closed-loop control system for view mirror adjustment using the CAN Bus protocol, based on the STM32F103CBT6 microcontroller. The system is designed to receive control commands over CAN and provide feedback on the current position of the view mirror using encoder data.
- π View Mirror Position Control using servo/DC motor
- π Closed-loop control via encoder feedback
- π οΈ PWM control for precise movement
- π‘ CAN Bus communication between nodes (Master β Slave)
- βοΈ Real-time response to mirror adjustment commands
- π§ Based on STM32F103CBT6 using STM32CubeIDE + HAL drivers
- STM32F103CBT6 development board (e.g. Blue Pill)
- L298N Motor Driver (for DC motor) or PWM control circuit (for Servo)
- Rotary encoder (for feedback)
- Potentiometer (for adjust angle)
- CAN transceiver module (e.g. MCP2551 + SN65HVD230)
- OLED (for display)
- Power supply (5V or 12V depending on motor type)
- Jumper wires, breadboard or PCB
- Master node sends angle setpoints via CAN.
- Slave node controls mirror using motor + encoder.
- Encoder provides position feedback to close the loop.
- Receive desired angle via CAN from master node.
- Compare desired vs. actual angle (from encoder).
- Generate PWM to motor/servo to adjust position.
- Loop until error β€ threshold.
- Display on screen status via OLED.
- β Test CAN communication between two STM32 boards
- β Test motor movement with PWM signal
- β Validate encoder feedback logic
- β Implement closed-loop control with PID (optional)
- β Observe stable final mirror position
- PID control for smoother adjustment
- Support for multiple mirrors (left/right)
- GUI interface for mirror simulation
- Fault detection over CAN (e.g. broken encoder)


