This circuit integrates various components controlled by an Arduino UNO microcontroller to perform a range of functions. The circuit includes a DC motor driver (L298N) to control two DC motors, a servomotor (Servomotor S05NF) for precision movement, an ultrasonic sensor (HC-SR04) for distance measurement, and a magnetometer (QMC5883L) for detecting magnetic fields. The system is powered by a 12V battery, and the Arduino UNO manages the logic and sensor integration.
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 ENBOUT1
connected to DC Motor pin 2OUT2
connected to DC Motor pin 112V
connected to 12V Battery +GND
connected to 12V Battery -OUT3
connected to DC Motor pin 2OUT4
connected to DC Motor pin 1SIG
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:
}
setup()
function is used to initialize variables, pin modes, start using libraries, etc. The code in the setup()
function will only run once, after each powerup or reset of the Arduino board.loop()
function is used for the main program logic. It runs continuously over and over again.