

This circuit is designed to control a car using an Arduino UNO microcontroller and a dual-axis joystick module (KY-023) for user input. The Arduino UNO reads the joystick's position and sends commands to an L298N DC motor driver, which in turn controls two yellow hobby gear motors. The motors enable the car to move forward, backward, turn left, and turn right. The circuit is powered by the Arduino UNO, which also provides power to the joystick and motor driver.
5V pin connected to the +5V pin of the KY-023 Joystick ModuleGND pin connected to the GND pin of the KY-023 Joystick Module and GND pin of the L298N Motor DriverVin pin connected to the 12V pin of the L298N Motor DriverA0 pin connected to the VRy pin of the KY-023 Joystick ModuleA1 pin connected to the VRx pin of the KY-023 Joystick ModuleD10 pin connected to the IN2 pin of the L298N Motor DriverD9 pin connected to the IN1 pin of the L298N Motor DriverD8 pin connected to the ENA pin of the L298N Motor DriverD5 pin connected to the IN3 pin of the L298N Motor DriverD4 pin connected to the IN4 pin of the L298N Motor DriverD3 pin connected to the ENB pin of the L298N Motor Drivervcc pin connected to OUT2 and GND pin connected to OUT1 of the L298N Motor Drivervcc pin connected to OUT3 and GND pin connected to OUT4 of the L298N Motor DriverGND pin connected to the GND pin of the Arduino UNO12V pin connected to the Vin pin of the Arduino UNOIN1, IN2, IN3, IN4, ENA, and ENB pins connected to the corresponding digital pins on the Arduino UNOOUT1, OUT2, OUT3, and OUT4 pins connected to the respective motor pins+5V pin connected to the 5V pin of the Arduino UNOGND pin connected to the GND pin of the Arduino UNOVRx pin connected to the A1 pin of the Arduino UNOVRy pin connected to the A0 pin of the Arduino UNO/*
* Arduino Sketch for controlling a car using Bluetooth technology.
* This code reads commands from the Serial input (Bluetooth module) and
* controls the car's movement accordingly. The car can move forward,
* backward, turn left, turn right, and stop based on the received commands.
*/
int Input_Pin_4 = 4; // Connected to IN4 on L298N
int Input_Pin_3 = 5; // Connected to IN3 on L298N
int Input_Pin_2 = 6; // Connected to IN2 on L298N
int Input_Pin_1 = 7; // Connected to IN1 on L298N
char Value;
void setup() {
pinMode(Input_Pin_4, OUTPUT); // Digital pin 4
pinMode(Input_Pin_3, OUTPUT); // Digital pin 5
pinMode(Input_Pin_2, OUTPUT); // Digital pin 6
pinMode(Input_Pin_1, OUTPUT); // Digital pin 7
Serial.begin(9600);
}
void loop() {
while (Serial.available() > 0) {
Value = Serial.read();
Serial.println(Value);
}
if (Value == 'F') {
// Move Forward
digitalWrite(Input_Pin_1, HIGH);
digitalWrite(Input_Pin_2, LOW);
digitalWrite(Input_Pin_3, HIGH);
digitalWrite(Input_Pin_4, LOW);
} else if (Value == 'B') {
// Move Backward
digitalWrite(Input_Pin_1, LOW);
digitalWrite(Input_Pin_2, HIGH);
digitalWrite(Input_Pin_3, LOW);
digitalWrite(Input_Pin_4, HIGH);
} else if (Value == 'L') {
// Turn Left
digitalWrite(Input_Pin_1, LOW);
digitalWrite(Input_Pin_2, LOW);
digitalWrite(Input_Pin_3, HIGH);
digitalWrite(Input_Pin_4, LOW);
} else if (Value == 'R') {
// Turn Right
digitalWrite(Input_Pin_1, HIGH);
digitalWrite(Input_Pin_2, LOW);
digitalWrite(Input_Pin_3, LOW);
digitalWrite(Input_Pin_4, LOW);
} else if (Value == 'S') {
// Stop
digitalWrite(Input_Pin_1, LOW);
digitalWrite(Input_Pin_2, LOW);
digitalWrite(Input_Pin_3, LOW);
digitalWrite(Input_Pin_4, LOW);
}
}
This code is designed to be uploaded to the Arduino UNO microcontroller. It sets up the digital pins connected to the L298N motor driver as outputs and initializes serial communication. The loop function reads a character from the serial input and controls the motors' direction and speed accordingly.