Arduino UNO and L298N Motor Driver Controlled Battery-Powered Robotic System with Ultrasonic Sensor
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control two DC motors and a servo motor using an Arduino UNO. It also includes an ultrasonic sensor for distance measurement. The L298N Motor Driver is used to drive the DC motors, and a rocker switch is used to control the power supply from a 3xAA battery pack. The Adafruit Perma Proto board is used for prototyping and making connections easier.
Component List
L298N Motor Driver Controller Board Module Stepper Motor
- Pins: Output A, +12v Power, +5v Power, Ground, Output B, Input 4, Input 3, Input 2, Input 1
- Description: Motor driver module used to control the DC motors.
Arduino UNO
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
- Description: Microcontroller used to control the motors and read sensor data.
DC Motor
- Pins: pin 1, pin 2
- Description: Motor used for driving the system.
DC Motor
- Pins: pin 1, pin 2
- Description: Motor used for driving the system.
Adafruit Perma Proto for Pi Full Size
- Pins: 3.3V, 5.0V, SDA, 5.0V_2, SCL, GND1, GPIO4, TXD, GND, RXD, GPIO17, GPIO18, GPIO27, GND5, GPIO22, GPIO23, 3.3V_2, GPIO24, MOSI, GND4, MISO, GPIO25, SCLK, CE0, GND3, CE1, GNDSTRIP1, GNDSTRIP2, N$15, N$16, N$17, N$18, N$19, N$20, N$21, N$22, N$23, N$24, N$25, N$26, N$27, N$28, N$29, N$30, N$33, N$34, N$35, N$36, N$37, N$38, N$39, N$40, N$41, N$42, N$43, N$44, N$45, N$46, N$47, N$48, N$103, N$104, N$105, N$106, N$107, N$108, N$109, N$110, N$111, N$112, N$113, N$114, N$115, N$116, N$117, N$118, N$119, N$120, N$121, N$122, N$123, N$124, N$125, N$126, N$127, N$128, N$129, N$130, N$131, N$132, N$133, N$134, N$135, N$136, N$137, N$138, N$139, N$140, N$141, N$142, N$143, N$144, N$145, N$146, N$147, N$148, N$149, N$150, N$151, N$152, N$153, N$154, N$155, N$156, N$157, N$158, N$159, N$160, N$161, N$162, PWRSTRIP1, PWRSTRIP2
- Description: Prototyping board used for making connections.
Tower Pro SG90 servo
- Pins: Signal, +5V, GND
- Description: Servo motor used for precise control of angular position.
Rocker Switch
- Pins: output, input
- Description: Switch used to control the power supply.
3xAA Battery
- Pins: VCC, GND
- Description: Power supply for the circuit.
Ultrasonic Sensor
- Pins: +VCC, Trigger, Echo, GND
- Description: Sensor used for measuring distance.
Wiring Details
L298N Motor Driver Controller Board Module Stepper Motor
- Output A is connected to pin 2 of the first DC Motor.
- Output A is connected to pin 1 of the first DC Motor.
- +12v Power is connected to the output of the rocker switch.
- +5v Power is connected to:
- +5V of the Tower Pro SG90 servo.
- Vin of the Arduino UNO.
- 5.0V of the Adafruit Perma Proto for Pi Full Size.
- +VCC of the Ultrasonic Sensor.
- Ground is connected to:
- GND of the 3xAA Battery.
- GND of the Arduino UNO.
- Output B is connected to pin 2 of the second DC Motor.
- Output B is connected to pin 1 of the second DC Motor.
- Input 4 is connected to D5 of the Arduino UNO.
- Input 3 is connected to D4 of the Arduino UNO.
- Input 2 is connected to D3 of the Arduino UNO.
- Input 1 is connected to D2 of the Arduino UNO.
Arduino UNO
- Vin is connected to +5v Power of the L298N Motor Driver.
- GND is connected to Ground of the L298N Motor Driver.
- D5 is connected to Input 4 of the L298N Motor Driver.
- D4 is connected to Input 3 of the L298N Motor Driver.
- D3 is connected to Input 2 of the L298N Motor Driver.
- D2 is connected to Input 1 of the L298N Motor Driver.
- A1 is connected to Trigger of the Ultrasonic Sensor.
- A2 is connected to Echo of the Ultrasonic Sensor.
- D8 is connected to Signal of the Tower Pro SG90 servo.
DC Motor (First)
- pin 2 is connected to Output A of the L298N Motor Driver.
- pin 1 is connected to Output A of the L298N Motor Driver.
DC Motor (Second)
- pin 2 is connected to Output B of the L298N Motor Driver.
- pin 1 is connected to Output B of the L298N Motor Driver.
Adafruit Perma Proto for Pi Full Size
- 5.0V is connected to +5v Power of the L298N Motor Driver.
- GNDSTRIP1 is connected to:
- GND of the Tower Pro SG90 servo.
- GND of the Ultrasonic Sensor.
Tower Pro SG90 servo
- Signal is connected to D8 of the Arduino UNO.
- +5V is connected to +5v Power of the L298N Motor Driver.
- GND is connected to GNDSTRIP1 of the Adafruit Perma Proto for Pi Full Size.
Rocker Switch
- output is connected to +12v Power of the L298N Motor Driver.
- input is connected to VCC of the 3xAA Battery.
3xAA Battery
- VCC is connected to input of the rocker switch.
- GND is connected to Ground of the L298N Motor Driver.
Ultrasonic Sensor
- +VCC is connected to +5v Power of the L298N Motor Driver.
- Trigger is connected to A1 of the Arduino UNO.
- Echo is connected to A2 of the Arduino UNO.
- GND is connected to GNDSTRIP1 of the Adafruit Perma Proto for Pi Full Size.
Code Documentation
Arduino UNO Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template