This shows you the differences between two versions of the page.
|
pm:prj2026:vlad.radulescu2901:viorel_cosmin.cucu [2026/05/23 22:06] viorel_cosmin.cucu |
pm:prj2026:vlad.radulescu2901:viorel_cosmin.cucu [2026/05/24 19:15] (current) viorel_cosmin.cucu [Components and Their Role] |
||
|---|---|---|---|
| Line 49: | Line 49: | ||
| | Traction Motor | 390 DC Motor (7.4V) | Drives the rover forward and backward from Battery 2's dedicated high-current rail. | | | Traction Motor | 390 DC Motor (7.4V) | Drives the rover forward and backward from Battery 2's dedicated high-current rail. | | ||
| | Steering Motor | 3–6V DC Motor | Turns the front axle left or right under L298N control. | | | Steering Motor | 3–6V DC Motor | Turns the front axle left or right under L298N control. | | ||
| - | | Motor Driver | L298N H-Bridge | Accepts PWM (ENA) and two direction pins (IN1/IN2) to drive the steering DC motor. | | + | | Motor Driver | L298N H-Bridge | Two direction pins (IN1/IN2) to drive the steering DC motor. | |
| | LCD Display | 1602 LCD + PCF8574 I2C | "Smart dashboard": shows expressive animated eyes in normal mode, parking assist in reverse. | | | LCD Display | 1602 LCD + PCF8574 I2C | "Smart dashboard": shows expressive animated eyes in normal mode, parking assist in reverse. | | ||
| | Active Buzzer | TMB12A05 5V | Proximity alert (beep rate increases near obstacles) and horn command from phone. | | | Active Buzzer | TMB12A05 5V | Proximity alert (beep rate increases near obstacles) and horn command from phone. | | ||
| Line 67: | Line 67: | ||
| | D4 | PD4 | GPIO Output | HC-SR04 Rear - TRIG | Same reason as D2; rear sensor pins grouped on D4/D5. | | | D4 | PD4 | GPIO Output | HC-SR04 Rear - TRIG | Same reason as D2; rear sensor pins grouped on D4/D5. | | ||
| | D5 | PD5 | GPIO Input | HC-SR04 Rear - ECHO | Paired with D4. Mirrors front sensor logic for parking assist. | | | D5 | PD5 | GPIO Input | HC-SR04 Rear - ECHO | Paired with D4. Mirrors front sensor logic for parking assist. | | ||
| - | | D6 | PD6 | Timer 0, OC0A (Fast PWM) | L298N ENA | Only OC0A or OC0B can output Timer 0 PWM. D6 = OC0A - sets steering motor duty cycle (0–255). | | ||
| | D7 | PD7 | GPIO Output | Headlight LEDs + 220Ω | Simple digital ON/OFF for the LED array. D7 is free from any timer to avoid conflicts. | | | D7 | PD7 | GPIO Output | Headlight LEDs + 220Ω | Simple digital ON/OFF for the LED array. D7 is free from any timer to avoid conflicts. | | ||
| | D8 | PB0 | GPIO Output | L298N IN1 | Direction bit for steering H-bridge. No special hardware needed - plain digital output. | | | D8 | PB0 | GPIO Output | L298N IN1 | Direction bit for steering H-bridge. No special hardware needed - plain digital output. | | ||
| Line 129: | Line 128: | ||
| * **IDE:** PlatformIO (VS Code) | * **IDE:** PlatformIO (VS Code) | ||
| * **Language:** C++ (Arduino framework) | * **Language:** C++ (Arduino framework) | ||
| - | * **Libraries Motivation:** I wrote almost all the code from scratch using direct register manipulation for Timers and PWM. This ensures maximum speed and non-blocking execution. The only external library used is ''LiquidCrystal_I2C'', because writing a custom I2C software driver for the LCD would be redundant when a highly optimized standard library already exists. | + | * **AI Assistance:** I used Claude Opus AI to assist with writing the code, structuring the non-blocking logic, and debugging hardware timer issues. |
| + | * **Libraries Motivation:** | ||
| + | * ''<Arduino.h>'': The core framework library. I used it for essential built-in functions like ''millis()'' (crucial for my non-blocking state machines), ''pulseIn()'' (to safely read ultrasonic sensors with a strict timeout), and basic GPIO control (''pinMode'', ''digitalWrite'', ''analogRead''). | ||
| + | * ''<Wire.h>'': The standard I2C library. Used to abstract the low-level TWI (Two-Wire Interface) hardware registers of the ATmega328P, providing robust communication with I2C devices. | ||
| + | * ''<LiquidCrystal_I2C.h>'': An external library that relies on ''<Wire.h>''. It handles the complex data formatting required by the PCF8574 I2C expander attached to the 1602 LCD. I chose to use this library because writing a custom I2C LCD driver from scratch would be redundant and reinventing the wheel, allowing me to easily display custom animated characters. Everything else (like PWM and Timers) was implemented using direct register manipulation. | ||
| ==== Justification of Laboratory Functionalities ==== | ==== Justification of Laboratory Functionalities ==== | ||