Some Bluetooth and Android sillyness...

3689430345?profile=originalAbove you can see a screenshot of my latest hack: a remote control app for an Android phone controlling my mini quadcopter via bluetooth. What is it controlling? This:

3689430397?profile=originalThis is my rendition of a small indoor quadcopter, strongly inspired by Jose Julio's work

My frame design pretty much follows Jose's approach, except that I only have one square base plate in the center (it looks rather unfinished on the bottom because of this ;-)), and I did not get the correct size stand-offs to use as motor mounts, so I machined my own out of Delrin plastic.

The electronics are completely home-built, with no direct relation to the Arducopter project (probably not hard to tell from the rats-nest of wires in the picture). The main board is basically a 2x2 inch proto board with a socket for an Atmega328 and a few supporting components (voltage regulator, 20Mhz crystal and a number of pin headers to plug in ESCs and other sensors and power distribution). The IMU sensor is the red stick seen on top of the Atmega328, a 9DOF (Acc, Gyro and Mag) Sparkfun I2C sensor stick. Other sensors present are an MTK GPS receiver from DIYDrones, a BMP085 barometric pressure sensor and (underneath, not visible in the picture) a Mabotix sonar.There is also voltage monitoring of the main battery.

The custom software is an Atmega fork of my other quad project, it currently squeezes the (quaternion-based) IMU code, RC decoder (for regular RC receivers, currently not used, see below), telemetry downlink, on-the-fly adjustable parameters, navigation (currently only position-hold, really) and general control code into ~30K of flash. The inner loop runs at ~350Hz (keep in mind that the Atmega is clocked at 20Mhz, though) and the ESCs are updated at 400Hz.

The most interesting part (to me at this point, anyways) is the small silver component to the bottom left of the GPS receiver: this is a Sparkfun RN-41 class 1 bluetooth module used to communicate with and control the quadcopter. The actual control/remote control software is also home-built and runs as an app on my Android phone:

3689430435?profile=originalIn the picture above you can see the main flight controls: the two red circles react to touch and basically mimic the functionality of the two sticks of a mode-2 remote control. There is an alternative 'accelerometer' or tilt-mode in which the user only controls the left, throttle and yaw stick while the right stick (pitch and roll) is controlled by tilting the phone (I suppose this is similar to the way a Parrot drone is controlled). In the very first picture, you can also see that the app displays a (admittedly very crude) 3D wire-frame model of the copter that moves like the actual copter (via downlink telemetry data). GPS coordinates, altitude and battery voltage are also displayed (probably not in the most ergonomic manner at this point). When the controls are touched, the 3D model fades into the background, which is why it harder to see on the second picture.

It is also possible to adjust various parameters stored in EEPROM on the quadcopter within the app:

3689430512?profile=original3689430462?profile=originalHow does it fly with these controls? It is actually quite flyable, but the restoring-force of the springs on a proper remote control are definitely missing, making it hard not to over-correct. I implemented a pretty shallow throttle curve in the hover-region of throttle-output which helps quite a bit. In general, it seems easier to fly in 'tilt-mode' than when controlling pitch and roll via the touch-interface.

The way I use the bluetooth connection is basically as a serial connection over which I sent a custom (almost human-readable, not MAV-link, though) protocol. It is therefore almost trivial to hook up a simulator remote (or joystick) to a  bluetooth-enabled laptop and use a few lines of Perl (or any other language of choice) to control the quad via that.

Another consideration with bluetooth is range, of course. The module on the quadcopter itself is a class 1 device, which supposedly gives it ~330feet range - but I am not sure about the module on the cell-phone side. One could use a pair of longer-range XBees (plus the laptop-remote/joystick solution) to get an increased range. I have not yet investigated whether the XBee might present latency issues (I did configure the quad-side bluetooth module to work in a low-latency mode).

Anyways, it is mostly a proof-of-concept at this stage, but I figured people might find an alternative control concept interesting...

Marko

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Well done!

    Looking forward for updates.

    thanks for share.

  • Developer

    great project!

  • Good day Marko,

    I sent an email to you about another project. Hope you can help me again.

  • @Collin: Sorry for the late reply. Sounds like an interesting project. 

    Regarding your hardware choices: I don't really have any experience with that particular control board; I built my own boards from scratch based on an Atmega328. I am sure the one you were looking at would work fine, though.

    In my project, I have used the 'RN 41' version of the bluetooth module you pointed to: http://www.sparkfun.com/products/8497. This one is a class 1 device, which should give you a larger range than the 'RN42'. Keep in mind though that the range even for a class 1 bluetooth device is only around 300 feet - this is not comparable to a proper RC transmitter.

    Bluetooth is not designed for high throughput, so streaming video over it is not really feasible. I am using a custom serial protocol to transmit control signals to and receive telemetry data back from the quadcopter. You would have to roll your own firmware for the control board that implements a similar scheme, the usual firmware for this board does not support this (to my knowledge).

    Regarding the app: the tablet itself should be capable of running an app that can control the quadcopter and display live video (obviously the Parrot AR quadcopter does this quite successfully), but again, bluetooth is not fast enough to give you live video (not to mention that you have to get the video out of the GoPro in the first place).

    Writing the app itself was not terribly complicated, but a little bit of experience in programming (apps) would not hurt. If this is your first programming projects, you might want to start with something a little less complex to get a feel for it...

    Hope this helps,
    Marko

  • Hello, i was wondering how you made the app. i want to use something similar for a quadcopter i am building. im thinking of using this control board: http://www.himodel.com/multi_rotors/Multicopter_Flight_Controller_K...

    along with this bluethooth module: https://www.sparkfun.com/products/10253

    also i want to use my GoPro Hero and a transmitter. i want to make an app for my android asus tablet. i want to have live video feed (some delay is accepted) and  be able to control my quad via bluetooth. im a very beginner and this kind of stuff and hopefully i can get some help. thanks in advance.

    Questions:

    1. App with live feed from GoPro Hero and control quadcopter?

    2. is this good parts? or would something else recommended?

    Multicopter Flight Controller KK V5.5 - (Cross mode firmware)
    Multicopter Flight Controller KK V5.5 - (Cross mode firmware) from manufacturer , in category Electronic Speed Controller (ESC).
  • @marko: I sent you my email..

  • Mavlink is used in arduplane/arducopter (both use the same groundstation). both projects share a lot of (if not all) code.

  • @Joseph: Don't know about MAVlink for arducopter, but I would assume it is implemented as I think the codebase is shared with arduplane?

    I don't mind sharing the sources, I just don't promise fitness for any purpose ;-) Just shoot me your email via PM and I can send it to you...

    Marko

  • @Simon: Thanks so much simon.

  • Thanks Marko, another question, Is there a MAVlink available for arducopter?? The documentation only points to the arduplane. Is there a chance that I can get a source code of your android app and the firmware used for your Atmega 328.?

     

    Thanks. Cheers! 

This reply was deleted.