Skip to content
December 23, 2011 / ygramulqc

RC Car steering with a Android smartphone via Bluetooth

Smartphones are a really great thing. They have a lot of sensors, computing power, great communication capabilities and a really nice display.
Combine a smartphone with an rc vehicle is really attractive. You can do a lot of things with it. Control it, display telemetry data or other things as well. So I start with the communication and choose bluetooth for the connection.

There are cheap and simple serial bluetooth modules available with an uart interface. Perfect to put it on an arduino and communicate with it. The chosen module had a default baud rate of 9600 or 19200, I’m not quite shure about that. But this can be changed with a “AT” command to 115200 (“AT+BAUD8” in my case). The command has to be send to the module fast and complete. On my mac I’d some problems to configure the module, but on the linux within a virtual machine it works perfect. I connect the module on a USB to UART adapter and used something like:

echo "AT+BAUD8" > /dev/USB0

On the Arduino site it is really simple to connect one of the six possible PWM output pins to the servo or electronic speed controller (ESC) of the car. If connected, it can be set with the arduino analogWrite command. It should be a value between 128 and 255, because a value lower than 128 is like “no signal” for the servo or ESC. On the traxxas car the ESC had to be recalibrated, because “neutral” position was something different than 192 (128 + 128/2).

Now, everything on the “car-site” is fine. What’s about the smartphone site? I choosed android for some reasons. One of them is the open architecture and the free software developement kit without any registration. There are some tutorials and examples for the bluetooth communication. Important to get a connection is the correct UUID for a serial module. To communicate with a bondet device the code should include something like

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Set pairedDevices = mBluetoothAdapter.getBondedDevices();
BluetoothDevice mbtDevice;
for (BluetoothDevice device : pairedDevices) {
mbtDevice = device;
BluetoothSocket btSocket = mbtDevice.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
InputStream btInputStream = btSocket.getInputStream();
OutputStream btOutputStream = btSocket.getOutputStream();

How this work all together you can see in the following video

Now a basis for further experiments is established.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: