“Build a simple l298n enabled car with an arduino uno and 4 dc motor drivers and code the android app!
Welcome to the Easy Arduino Bluetooth Car
This project is designed to teach someone to build a simple Arduino enabled car, with commonly accessible parts. I wanted to bring together the learnings from my experience build a car without a readymade kit. It works with easy to find parts and requires no paid android applications to run.
It works by connecting the android app to the hc-05 and voila! The car will go left, right, forward and backwards !
1. Connect the VCC of the HC05 to 5v of the Arduino
2. Connect the GND of HCO5 to the GND of the Arduino
3. Connect TXD to RX on the Arduino
4. Connect RXD to TX on the Arduino
1. Powering the L298N. Use a 7.4v LiPo battery. Connect the black wire to the 12v pin on the L298. Connect the red write to the GND pin.
2. Connecting the left motor pins to Arduino:
ENA -> Pin3
IN1 -> Pin4
IN2 -> Pin5
3. Connecting the right motor pins to Arduino:
IN3 -> Pin13
IN4 -> Pin12
ENB -> Pin11
4. Wiring the Motors into output: Put both red and black motors in different pins. Make sure the motors on the left are connected to the left outputs and the same for the right side.
Powering the ArduinoandMotors
Use a snap on connector with a battery to power the Arduino. The Arduino and L298N are powered separately.
If you have a better way to power both with 1 supply, please message me as I’d like to improve that feature.
To understand the concepts, there are 3 pieces that talk to each other.
Each side of the car has 2 dc motors. Both motors connect to the same 3 pins that regulate turning the motor on and off and direction.
EN pins turn motors on and off.
IN pins determine direction of motors (forward and backwards).
Output pins power the motors. They draw current from the L298N and need a 7.4v battery to work.
The Arduino code is below.
The arduino code can be understood as the receiver for the android applications commands.
The android app sends a letter to the HC05 which then talks to the arduino.
The Arduino code reads that letter then activates the pins to run the motor. If you push forward, the app sends an F to the HC05. The F is then translated by the arduino code to run the motorpins for both sides of the car.
Look at the motor pins in the Arduino code, then check the MotorPin variables to understand which letters trigger which MotorPins
You can download this via the MIT AI Companion. Check the Blocks tab to understand the logic of the application and how it talks to the arduino, which then triggers the motors.
Very broadly, the flow is
> Forward button in Android App
> Sends an F to HC05
> Arduino Pins connected to both the and right motors run”