- Resistors 220 Ohm (8)
- Photoresistors (8)
- White LEDs (16)
- Function: Illuminate the surface to enhance the photoresistors' ability to differentiate the line color from the road.
- 10-pin Header (1)
- 10k Resistor Network (1)
- ESP32 DEV KIT V1 (1)
- 2-pin Headers (3)
- Capacitors:
- 100nF (1)
- 300nF (1)
- LM7805 (1)
- Function: Voltage regulator to ensure a stable 5V power supply for the entire circuit.
- MOSFETs (2)
- Function: Control the two wheels of the robot.
- Resistors:
- 1k
- 10k
- 150k
- Diodes
- Function: Prevent back EMF from damaging the MOSFET when the motor suddenly stops.
- 10-pin Header (1)
- Tips:
- If the copper traces fade after printing on the PCB, you can redraw them with a marker.
- Using hot water accelerates the etching process and results in cleaner traces.
- Read the values from the 8 photoresistors, ensuring they are consistent in the same environment.
- -> Determine the threshold for distinguishing between the line and the road.
Error = Target - Pos
- If
Error > 0
, the right wheel should spin faster to turn right. - If
Error < 0
, the left wheel should spin faster to turn left.
- Rotate one wheel to locate the line.
- PID -> PWM -> Loop
- Initially, set a high 𝐾p for quick error response.
- Gradually increase 𝐾i to reduce accumulated error (if the robot becomes unstable).
- Use 𝐾d to minimize overshoot and oscillations.