Web Hosting

This post may contain affiliate links. See the affiliate disclosure for more information.

In the previous tutorial, I showed you how to use a BLE module to control an LED. For this tutorial, we will expand upon that knowledge to create an Arduino Bluetooth Car that can be controlled using a Smartphone.

You can pick up an Arduino Robot kit or source all the materials separately to build a custom robot car. At a minimum, you’ll need an Arduino Uno, a motor controller (such as the L293D or L298N), a BLE module (AT-09 or HM-10), Geared DC Motors, 1KΩ and 2KΩ resistors, and batteries to power everything. I recommend using 18650 rechargeable batteries. You can choose to make the chassis from scratch using foam board, acrylic, 3D printing, or you can buy one online.

Related Article: How to power your mobile robot

This tutorial assumes you already have some basic Arduino programming skills and have downloaded and installed the Arduino IDE. You’ll also need to download and install the BLE Joystick App for Android or for iPhone. Once you have all the materials and software for this project, it’s time to assemble the robot chassis.

Make a Chassis for Arduino Bluetooth Car

Here I made chassis using a 5mm thick foam board. You can use any other material of your choice. Just make sure it is light and strong. First, mount two motors on the base board as shown in the image below.

Build Arduino Robot car

Next, attach the Arduino on another board and connect the motor shield. I’m using the L293D shield, below.

Arduino Bluetooth Robot

After that, place the second board on top of the base.

Build an Arduino Bluetooth Car

Once the robot is built, it’s time to wire up the electronics. Remove the motor shield to expose the Arduino pins.

Arduino Bluetooth Car Wiring

Before you connect the components, make sure you carefully read the pin labels on the BLE module because not all modules have same pin configuration. Refer to the wiring diagram, below.

Wiring Diagram for Arduino Bluetooth Car

TX goes to RX on the Arduino (Digital Pin 0)
RX goes to TX on the Arduino (Digital Pin 1)
GND goes to GND
VCC goes to +5V

You will need to create a voltage divider using two resistors. Solder them together and connect the 2KΩ end to the Arduino GND pin and the 1KΩ end to the TX pin on the Arduino.

The point where the two resistors are connected goes to the Rx pin of Bluetooth module. Here’s what it looks like on the Arduino Bluetooth Car.

Arduino Bluetooth Car Wiring Complete

After that, reconnect the motor shield to the top of the Arduino. If you want, you can solder the wires directly to the shield for a more permanent solution. Lastly, connect the motors to M1 and M2 of the motor shield. Now, you’re ready to write some code for the Arduino Bluetooth Car.

Writing Code for Arduino Bluetooth Car

Before writing the code, check out the values used by the BLE joystick app. Here is an image you can refer to:

BLE Joystick App to control Arduino Bluetooth Car

We will use the AFMotor library, which will make the coding easy. You can download the library from here (click to download), or you can Goto >> Tools >> Manage Libraries >> Enter AFMotor.h in the search bar and install the library. Now, let’s talk about the code. Unlock the code walk-through by signing in below.

Test Arduino Bluetooth Car

Now that we have the robot build, wired, and programmed, it’s time to power it up. I used two separate batteries: one for powering the Arduino, and another to power the motor shield. Make sure to remove the jumper from the shield before you connect the batteries, because if you don’t, it may damage the Arduino board.

Once the robot is powered up, you will see the light on Bluetooth module blinking. Now open the BLE Joystick app. Click on the top right corner (Bluetooth Symbol), and you will see a list of bluetooth addresses. (For some reason it shows the same address multiple times.) Select the first one on the list.

When you select the bluetooth address, you will notice that the LED on module stops blinking and becomes solid. That indicates connection is established. Now you can start using your smartphone to control the robot.

Did you enjoy this tutorial? If so, be sure to share it with a friend who enjoys robotics.

We also have a brand-new online robotics course designed to get you building, wiring, and programming mobile robots in 30-days! Check it out here.

Join our Newsletter, and Gain Robotics Skills FAST!

 

Become a better programmer. Build Electronics. Create Robots. FREE Tips for LR Subscribers!

Success! You're in! Check your inbox for an awesome subscriber-only message! ;)

global robotics competition online

Get Notified of the Next Competition

 

Be the first to know when we launch our next online robotics competition. Plus gain FREE robotics tips to your inbox.

You have Successfully Subscribed!

liz miller learn robotics


GIVE ME 1 WEEK IN YOUR INBOX

Gain Access to FREE robotics projects.

You have Successfully Subscribed!

Pin It on Pinterest

Is this content Share-Worthy?

Tell a Friend about it!