

This circuit is designed to control two DC motors using an L298N DC motor driver, which is interfaced with an Arduino UNO microcontroller. The circuit also includes a servomotor and an HC-SR04 ultrasonic sensor for distance measurement, as well as a QMC5883L magnetometer for detecting magnetic fields. The entire system is powered by a 12V battery. The Arduino UNO manages the logic and sensor data processing, while the L298N driver module controls the motor speeds and directions.
3.3V connected to QMC5883L Magnetometer VCC5V connected to Servomotor S05NF VCCGND connected to QMC5883L Magnetometer GND and Servomotor S05NF GNDSCL connected to QMC5883L Magnetometer SCLSDA connected to QMC5883L Magnetometer SDAD9 connected to Servomotor S05NF SIGD7 connected to L298N DC motor driver IN4D6 connected to L298N DC motor driver IN3D5 connected to L298N DC motor driver IN2D4 connected to L298N DC motor driver IN1D3 connected to L298N DC motor driver ENAD2 connected to L298N DC motor driver ENB12V connected to Battery 12V positive terminalGND connected to Battery 12V negative terminalOUT1 connected to DC Motor 1 pin 2OUT2 connected to DC Motor 1 pin 1OUT3 connected to DC Motor 2 pin 2OUT4 connected to DC Motor 2 pin 1+ connected to L298N DC motor driver 12V- connected to L298N DC motor driver GNDpin 1 connected to L298N DC motor driver OUT2 (Motor 1) and OUT4 (Motor 2)pin 2 connected to L298N DC motor driver OUT1 (Motor 1) and OUT3 (Motor 2)SIG connected to Arduino UNO D9VCC connected to Arduino UNO 5VGND connected to Arduino UNO GNDVCC connected to Arduino UNO 3.3VGND connected to Arduino UNO GNDSCL connected to Arduino UNO SCLSDA connected to Arduino UNO SDAvoid 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 controlling the motors, reading sensor data, and any other required functionality.