Arduino Nano Controlled Obstacle Avoidance Robot with IR and Ultrasonic Sensors
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to interface an Arduino Nano with multiple sensors and actuators. It includes two IR sensors for detecting objects or movements, an HC-SR04 Ultrasonic Sensor for measuring distances, and four DC Motors for actuation. The motors are controlled by an L298N DC motor driver, which allows for direction and speed control. A DC Power Source provides the necessary power for the motors and the motor driver. The Arduino Nano serves as the central processing unit, reading sensor inputs and controlling the motors accordingly.
Component List
IR Sensors
- Component Name: IR Sensor
- Description: Infrared sensors used for object detection.
- Pins: out, gnd, vcc
Arduino Nano
- Component Name: Arduino Nano
- Description: A compact microcontroller board based on the ATmega328P.
- Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
HC-SR04 Ultrasonic Sensor
- Component Name: HC-SR04 Ultrasonic Sensor
- Description: Sensor for measuring distances using ultrasonic waves.
- Pins: VCC, TRIG, ECHO, GND
DC Motors
- Component Name: DC Motor
- Description: Electric motors converting electrical energy into mechanical motion.
- Pins: pin 1, pin 2
L298N DC Motor Driver
- Component Name: L298N DC Motor Driver
- Description: A module for controlling the direction and speed of DC motors.
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
DC Power Source
- Component Name: DC Power Source
- Description: Provides the electrical power for the circuit.
- Pins: Ground, Positive
Wiring Details
IR Sensors
IR Sensor 1:
- out -> Arduino Nano D2
- gnd -> Common Ground
- vcc -> L298N DC Motor Driver 5V
IR Sensor 2:
- out -> Arduino Nano D3
- gnd -> Common Ground
- vcc -> L298N DC Motor Driver 5V
Arduino Nano
Digital Pins:
- D2 -> IR Sensor 1 out
- D3 -> IR Sensor 2 out
- D5 -> L298N DC Motor Driver ENA
- D6 -> L298N DC Motor Driver ENB
- D7 -> L298N DC Motor Driver IN1
- D8 -> L298N DC Motor Driver IN2
- D9 -> L298N DC Motor Driver IN3
- D10 -> L298N DC Motor Driver IN4
- D11/MOSI -> HC-SR04 Ultrasonic Sensor TRIG
- D12/MISO -> HC-SR04 Ultrasonic Sensor ECHO
Power Pins:
- GND -> Common Ground
- 5V -> HC-SR04 Ultrasonic Sensor VCC
HC-SR04 Ultrasonic Sensor
- Pins:
- VCC -> Arduino Nano 5V
- TRIG -> Arduino Nano D11/MOSI
- ECHO -> Arduino Nano D12/MISO
- GND -> Common Ground
DC Motors
Motor Pair 1:
- pin 1 -> L298N DC Motor Driver OUT2
- pin 2 -> L298N DC Motor Driver OUT1
Motor Pair 2:
- pin 1 -> L298N DC Motor Driver OUT4
- pin 2 -> L298N DC Motor Driver OUT3
L298N DC Motor Driver
Control Pins:
- ENA -> Arduino Nano D5
- ENB -> Arduino Nano D6
- IN1 -> Arduino Nano D7
- IN2 -> Arduino Nano D8
- IN3 -> Arduino Nano D9
- IN4 -> Arduino Nano D10
Motor Output Pins:
- OUT1 -> Motor Pair 1 pin 2
- OUT2 -> Motor Pair 1 pin 1
- OUT3 -> Motor Pair 2 pin 2
- OUT4 -> Motor Pair 2 pin 1
Power Pins:
- 12V -> DC Power Source Positive
- GND -> Common Ground
- 5V -> IR Sensors vcc
DC Power Source
- Pins:
- Ground -> Common Ground
- Positive -> L298N DC Motor Driver 12V
Documented Code
Arduino Nano Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The provided code is a template and does not contain any functional code. It needs to be populated with the logic for reading sensor inputs and controlling the motor driver outputs.