This circuit is designed to control multiple DC motors and a servomotor, with the capability to read data from a QMC5883L magnetometer. The control logic is managed by an Arduino UNO microcontroller, which interfaces with the motors through L298N DC motor drivers. The servomotor is directly controlled by the Arduino UNO. The magnetometer is connected to the Arduino's I2C bus for communication. A 12V battery provides power to the motor drivers and indirectly to the servomotor.
5V
connected to QMC5883L Magnetometer VCC
GND
connected to Servomotor MG90S GND
and QMC5883L Magnetometer GND
SCL
connected to QMC5883L Magnetometer SCL
SDA
connected to QMC5883L Magnetometer SDA
D13
, D12
, D11
, D10
, D9
, D8
, D6
, D5
, D4
, D3
connected to corresponding IN
and EN
pins on L298N DC motor driversD8
connected to Servomotor MG90S SIG
12V
connected to the positive terminal of the 12V batteryGND
connected to the negative terminal of the 12V battery5V
(from one driver) connected to Servomotor MG90S VCC
IN1
, IN2
, IN3
, IN4
, ENA
, ENB
) connected to corresponding Arduino UNO digital pinsOUT1
, OUT2
, OUT3
, OUT4
) connected to DC Motor pinspin 1
, pin 2
) connected to the corresponding outputs on the L298N DC motor drivers+
connected to 12V
on both L298N DC motor drivers-
connected to GND
on both L298N DC motor driversVCC
connected to 5V
on one of the L298N DC motor driversGND
connected to Arduino UNO GND
SIG
connected to Arduino UNO D8
VCC
connected to Arduino UNO 5V
GND
connected to Arduino UNO GND
SCL
connected to Arduino UNO SCL
SDA
connected to Arduino UNO SDA
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 logic. It needs to be populated with the specific control code for the motors and the magnetometer.