Bluetooth-controlled Car – Part 2

Now that the hardware was functional, I had to make it respond to input from the user. This had two parts: the Arduino software and the controller app on the phone.

Arduino Software

It took a bit of experimentation but I was finally able to run the motors at the correct speed. My aim was to create methods that moved the car front, back, left and right. And, of course, the all important stop command. To test it, I wrote a small program that invoked these methods and made the car go in all directions.

I then modified the loop to accept commands from the Bluetooth controller. Since all I read was bytes, I used the ASCII characters (‘f’, ‘b’, ‘l’, ‘r’, ‘s’) to denote the various commands that the car understood.

iOS App

For the app, I decided to use Swift. This was my first time writing an app and I ended up using the Internet as my guide! I learnt that iOS apps use the CoreBluetooth library. I ended up creating a BluetoothManager object that was responsible for detecting when peripherals were in range as well as connecting to them. Since I wanted the application to be seamless, I was going to have the app automatically detect when the car was in range and connect to it. The user could then send commands via the interface. I chose to use a Single View App as my base project. The app looked as follows:

Once the car was in range, the app would connect to it. The user could then use the buttons to send the car forward, back, left, right and stop the car if necessary. If for any reason, the connection to the car was lost, the user could force the connection by tapping on the Bluetooth icon. The app would only accept commands if the car was connected. You can see a video of the car working below:


View this post on Instagram


A post shared by 3D Printing/Making (@anmolmaker) on

This is part 2 of my bluetooth-controlled car. You can read Part 1 as well.

Bluetooth-controlled Car – Part 1

For a few weeks now, I have wanted to find an interesting project where I could pair up my 3D printing skills with the Arduino. I also wanted to try something new and decided to combine it by writing an iOS companion app. This led me to deciding to build a electric car that could be controlled via the phone’s bluetooth.

The 3D Model

I wanted my car to look realistic so I did some research and came up with a design that was both practical and interesting. The 3D model would have two main parts: a base and the body. The base had to be large enough to house the motors, Arduino and the sensors. It would also need to have four grooves that would be used by the wheels. The design of the body was pretty straightforward as you can see below. I used some of the design elements from the real car I drive, a Honda Civic.



Both the base of the car and the body were designed using Fusion 360. Fusion 360 is a great program because it’s free and works well for creating basic shapes. I used photos of a car and using the line tools, created a sketch on top of the image. This sketch was the basic shape of the car and was then extruded out to create a basic car shape. Two holes were cut out (using premade cylinders) for the wheels and then details were added (with the premade shapes and shapes created in sketch mode) and altered in the sculpt mode. I had to cut my model in half because my print bed (a Lulzbot Mini) was too small for the size that I wanted to print at. Honestly, I wish I had a better way of dividing my model because the seam in the base became a issue when connecting the two halves. I had designed the model so the base would be able to fit snuggly underneath the body, but the tension was too great and caused a crack on one side of the model. With hindsight, I should have made the body a bit bigger to better accommodate the internals. Overall, it took about 14 hours to print the base and body of the car at a 0.25 layer height.

Putting It Together

While the internals of the car are not exposed, I wanted it to look clean. I’ve always been fascinated by the clean internals of Apple devices. I placed the Arduino microcontroller in the center of the base and surrounded it with the four DC motors. The motors had motor shafts on them which were then connected to the wheels. Lastly, the bluetooth module was mounted to the Arduino. The black tape below was needed for me to keep my two halves connected since I printed my design in two halves due to my printer bed size. As Adam Savage has taught me over the years, nothing duct tape can’t fix!

One of the tricky parts was making sure that the motors were connected properly to the motor shield. I had to orient the four wires as below:

Next was the bluetooth module to pair the robot with a phone. I chose the HC-08 for this project. The module had 6 pins, but I only needed to use the RXD, TXT, GND, and VOC pins. These pins connect into the Arduino in the respective pins (RXD → RX (0), TXT → TX (1), GNG → GND, VOC → 5V).

Next I attached the wheels and spent some time painting it using the colors of my favorite Marvel character, Iron Man. Finally, my car was ready!

In the second part of this post, I’ll detail the software components of the car. In particular, the iOS app that sends commands to the car and the Arduino software that interprets these commands and moves the car. Stay tuned!

Parts List