Skip to content

This project simulates a closed-loop control system for view mirror adjustment using the CAN Bus protocol

Notifications You must be signed in to change notification settings

tongochona/mirror_controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

View Mirror Console Controlling Using CAN Bus (Closed Loop Control System)

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.


πŸ“Œ Features

  • πŸš— 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

🧰 Hardware Requirements

  • 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

πŸ”Œ System Architecture

System Architecture Diagram

  • Master node sends angle setpoints via CAN.
  • Slave node controls mirror using motor + encoder.
  • Encoder provides position feedback to close the loop.

🧠 Control Logic

  1. Receive desired angle via CAN from master node.
  2. Compare desired vs. actual angle (from encoder).
  3. Generate PWM to motor/servo to adjust position.
  4. Loop until error ≀ threshold.
  5. Display on screen status via OLED.

πŸ§ͺ Testing

  • βœ… 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

DEMO

Link video drive


πŸ“Œ Future Improvements

  • PID control for smoother adjustment
  • Support for multiple mirrors (left/right)
  • GUI interface for mirror simulation
  • Fault detection over CAN (e.g. broken encoder)

About

This project simulates a closed-loop control system for view mirror adjustment using the CAN Bus protocol

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages