Tekko BDSimSimulatorProjects

ব্লুটুথ গাড়ি (HC-05 + L298N)Bluetooth Controlled Car using Arduino (HC-05 + L298N)

ফোন HC-05 এর সাথে pair হয়ে serial এ একটা করে অক্ষর পাঠায়। Arduino F, B, L, R, S বুঝে L298N এর pin দিয়ে দুই চাকা ঘোরায়। ফোনের serial Bluetooth terminal app ই রিমোট — আলাদা কিছু লাগে না।

The phone pairs with the HC-05 and sends single letters over its serial link. The Arduino maps F, B, L, R and S to the L298N inputs that drive the two wheels. A serial Bluetooth terminal app is the controller — no special app needed.

▶ ফ্রি চালিয়ে দেখো / Run it free Parts অর্ডার করো (WhatsApp)

সার্কিট ডায়াগ্রাম · Circuit diagram

Bluetooth Controlled Car using Arduino (HC-05 + L298N) circuit diagram — Arduino Uno, Bluetooth module (HC-05), Motor driver L298N, Gear motor (yellow TT), 9 V battery, Jumper wires

যা যা লাগবে · Parts you need

সব part একসাথে · All parts in one box: 4wd robot car chassis kit

তার লাগানো · Wiring

Bluetooth module (HC-05) VCC→Arduino Uno 5V
Bluetooth module (HC-05) GND→Arduino Uno GND
Bluetooth module (HC-05) TXD→Arduino Uno D10
Bluetooth module (HC-05) RXD→Arduino Uno D11
Motor driver L298N IN1→Arduino Uno D5
Motor driver L298N IN2→Arduino Uno D6
Motor driver L298N IN3→Arduino Uno D7
Motor driver L298N IN4→Arduino Uno D8
9 V battery +→Motor driver L298N 12V
Motor driver L298N GND→9 V battery -
Motor driver L298N GND→Arduino Uno GND.3
Motor driver L298N OUT1→Gear motor (yellow TT) +
Motor driver L298N OUT2→Gear motor (yellow TT) -
Motor driver L298N OUT3→Gear motor (yellow TT) +
Motor driver L298N OUT4→Gear motor (yellow TT) -

Code (Arduino C++)

#include <SoftwareSerial.h>
// Bluetooth-controlled car: pair your phone with the HC-05 (pin 1234), open a
// serial Bluetooth terminal app and send F / B / L / R / S.
SoftwareSerial bt(10, 11);   // RX, TX
const int IN1 = 5, IN2 = 6, IN3 = 7, IN4 = 8;

void drive(int a1, int a2, int b1, int b2) {
  digitalWrite(IN1, a1); digitalWrite(IN2, a2);
  digitalWrite(IN3, b1); digitalWrite(IN4, b2);
}

void setup() {
  pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT);
  bt.begin(9600);
  bt.println("Send F B L R S");
  Serial.begin(9600);
}

void loop() {
  if (!bt.available()) return;
  char c = bt.read();
  switch (c) {
    case 'F': drive(HIGH, LOW, HIGH, LOW); bt.println("Forward"); Serial.println("Forward"); break;
    case 'B': drive(LOW, HIGH, LOW, HIGH); bt.println("Back");    Serial.println("Back");    break;
    case 'L': drive(LOW, HIGH, HIGH, LOW); bt.println("Left");    Serial.println("Left");    break;
    case 'R': drive(HIGH, LOW, LOW, HIGH); bt.println("Right");   Serial.println("Right");   break;
    case 'S': drive(LOW, LOW, LOW, LOW);   bt.println("Stop");    Serial.println("Stop");    break;
  }
}

আরো project · More projects