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.

May 24, 2011 / ygramulqc

Very simple and basic use of an Arduino on a remote plane.

To start developing something with an arduino you may as yourself “what can I build, which is easy at start and a lot of fun, too”.
If you like (remote) planes, maybe the follwing is something for you. I changed the electronic controlling unit from a plane
which has no rudder to controll it but two diffenrent prop speeds on each side. Famous product groups of these kind of planes
are X-Twin or AirAce. The nice thing is, you only need a small arduino, a small receiver and 8 other electronic parts. Two mos-fet, two dioden, some capacitor and a power regulation like the 7805. That’s all, simple to build and also cheap stuff.

arduino for a remote plane

On the arduino site you need two of the PWM output channels to control the speed of the motors via the mos-fet.

analogWrite(motorPin, motorValue);

Two digital input pins on the arduino are needet to read the two controlling channels of the receiver. To read a channel you basically measure the time between a low/high change on the pin and get the value of your rc. You can try something like pulseIn() or
for better results use an existing code like the one who is used in the MultiWiiCopter.

The only thing left is to mix the rc values to your motors, but this is easy. Something like

motor_left = power + (direction - direction_center)
motor_right = power - (direction - direction_center)

will do the work, but keep in mind that your PWM output only can handle values between 0 to 255.

Now you can control the direction and the altitude of your plane. So you can also extend this vehicle with some other sensors to
stabilize it, or give your “robot” more autonomously behaviour. 🙂

Or you can just enjoy your plane with a light fpv cam+video tx combination, like me on this video.

February 8, 2011 / ygramulqc

Arduino based RC

For a better controlling of the plane I reused a old rc from my silverlit x-ufo. Changed the electronic of the rc to an arduino based and used a wi232 module for the transmission of the control commands. The old “mousepad approach” I used is not very handy if the environment and especially the plane is not in best condition.
So it’s more comfortable to control the plane this way.
The construction is not a big deal. I only used a 7805 to get 5 volt from the batteries and connect everything to this. You only have to remember to cross rx and tx between rc and plane. Also double check with one is the “middle” pin of the poti to connect to the analog input pin on the arduino.
I also used the soft serial library to get a second serial interface. This is used for logging on the pc at the moment.

.Selfmade RC rear sideSelfmade RC front side

Advantages of this are

  • Small device to control the plane
  • No limit on “channels” compared to a traditional rc
  • Back-channel for telematic or other information
  • Resolution up to 1000 steps on a poti
  • Free programmable
  • Optional logging capabilities

You can also use the normal rc that you get with such a plane like mine. I use the “bigger” x-ufo rc because of the two way control of every stick. In this way I have the option to test this also on other vehicles like a copter.

First testflights on a gusty day:

On the last flight the plane “landed” in the water channel.

January 15, 2011 / ygramulqc

OSP Quadrocopter ACC/stable mode

Today I did my first outdoor testflight with the newly implemented ACC/stable-mode. ACC means it uses a accelerator sensor to level the quadrocopter if nick/roll stick is in middle position. Another mode is Heading Hold (HH) which means the copter hold its attitude if nick/roll stick is in middle position. For the HH mode only gyros are nessesary and the copter do not need to know where the bottom is. On the OSP you can switch between both modes while flying.

This is an easy and basic implementation of the ACC mode. Fusion of the gyro and acc sensor values are done with the following code.

int angle_diff_nick=IMU_CalcData.acc_angle_nick-CTRL_FlightParams.reserved[ACC_TRIM_NICK]-IMU_CalcData.angle_nick;

A pd controller is responsible to get the correct attitude.

perror_nick = (-real_nick * CTRL_FlightParams.K_stick_nick) + IMU_CalcData.angle_nick;
derror_nick = perror_nick - old_error_nick;
CTRL_InternalOut.nick= (CTRL_FlightParams.Kp_nick*perror_nick)+(CTRL_FlightParams.Kd_nick*derror_nick);
old_error_nick = perror_nick;

And here is the video of the first outdoor testflight.

January 7, 2011 / ygramulqc

SimUAV – New Ground Tool

On my little uav plane project I started with a new tool for the laptop. It should be possible to create a waypoint map and to track the current position of the plane. I tried to keep things simple as possible but also that it is useable. As alsways it should be usable on the most popular operation systems. In the end it’s a java swing application created with netbeans.

Most things are configurable, like maps, size of waypoint, default map position on earth and other things.

Tracking the current position is also tested with my gps simulator on the plane. The plane send this position wireless to the ground application which displays the position in the map.

The next two tasks are to extend the plane/arduino firmware with waypoint flight function and to create a simple plane simulation on the laptop. This way it’s much better and saver to test, especially at winter time. 🙂

The code is available as usual on the project page.

December 8, 2010 / ygramulqc

New electronic build-up for SimUAV

After the nice testflight of my simple uav plane I decide to rebuild the electronic part for some improvements:

  • Size – should fit into the plane cargo bay
  • Easy reflash the arduino – not reconnect wires every time
  • Remove unnecessary parts – AnyVolt Micro is not needed
  • GPS connection – just plug in the GPS module

On the picture you see three electronic build-ups. The original AirAce electronic on the left. In the middle it’s the electronic of the successful maiden flight and on the right side the new one which fit into the plane and should be also more robust.

Next steps are to test all functions of the electronic and play a little bit with the new Firmware 0.2. Especially if the GPS data is received and interpreted correctly. This can be done with the GPS module itself or by my “GPS Simulator”. If these things work well a new testflight will show if the flight behaviour is stable enough or if I need an additional sensor to stabilize the plane.

November 30, 2010 / ygramulqc

“Simple UAV” maiden flight

On the last sunday I’d the maiden flight of my “Simple UAV” plane. The weather was not really perfect because it’s cold these days and also just a little bit wind, but after some tries I get more comfortable with the touchpad-controlling. Two flights are short, but not too bad and showed me what’s working and what’s to improve.

The value for both motor sides for straight and level flight are between 60 and 110 (maximum is 255). Control input to the left and right are not more than +/-50. Without checksum it’s possible on a distance of ca. 100m that single controlling signals went wrong and the plane do something “strange”. This happens only just for a part of a second but it’s enough .. to much I would say.

Battery minimum was about 6 Volt for a very short time with full loading.