My UAV helicopter (which can't fly)

What can it do:the atmega 128 can control all the servos and the engine speed. It can communicate with my Windows PC via the xbee so I can send it commands (like inc/dec engine speed, tail rotor servo, etc). It know's it's pitch, roll and heading using the sparkfun 6DOF + the compass (combined using kalman filters).What can't it do?well, first off it can't fly (yet). it can't even control it's horizontal direction using the tail rotor at least not since I attached the main rotors (before it was controlling it's direction pretty well but the main rotor has changed the dynamics of everything a lot it seems). It doesn't have a GPS nor anyway to know it's elevation.Basically I think the hardware (although a bit messy) and basic software is probably far enough along to allow it to hover but I'm currently stuck on getting the control algorithms correct (i.e. when you're 20 degrees from target and your speed is 50 deg/sec and tail servo is at position mid + 80, what should it do?). I've been looking at a few people's projects (especially vicacopter) for ideas and I've tried a few things including a PID controller and even played around squeezing a neural net into the Atmega 128 (it can fit!) but so far pretty limited success.I'm interested in working with others to get a UAV helicopter working. I love the challenge of programming on these tiny CPUs so that's probably the area I can contribute the most in (especially if it's in C, C++, Java) and although I'm pretty happy with the AVR cpus I'm willing to change platforms if necessary. Learning about the hardware since I started this project about 9m ago has been a lot of fun as well as it's something I hadn't been exposed to before.All comments, suggestions for improvements, ideas more than welcome!Here's the parts that have gone into the helicopter:eco8 helicopter (click under link for IKARUS Electric Helicopter) brushless motor and esc purchased from my local hobby shop: CPU is an Atmega 128 with 32k external ram on a pretty basic breakout board: program the above in C using Eclipse + winavr: (3 gyros, 3d acclerometer) purchased from sparkfun: also purchased from sparkfun: Xbee module (also purchased from sparkfun) for communicating with my windows PC meter built from some more parts from Sparkfun:
E-mail me when people leave their comments –

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

Join diydrones


  • Thank you sir! Its actually nice to know there are a lot of people who have great interest in UAVs. I sent you message through this site regarding our project. I hope you can give us your feedback. Thank you again!
  • Developer
    Hey Mark,

    It's a rare treat to have someone comment on my post so long after I wrote it. Thanks for that. Things have certainly moved on since I posted the above.

    I'm now contributing to the arduCopter project which uses the Sparkfun ArduPilotMega and DIYDrones "OilPan". The first deliverable is the QuadCopter but after that it's traditional Helis. It's a team effort which helps a lot and also the OilPan is built with gyro resistant accelerometers and gyros. The programming is in Arduino (=C++) and the actual helicopter we're using is also much better - a TRex450 instead of the Eco8 (the Trex is much sturdier which keeps the vibration down).

    The mounting of the IMU is also much improved. We're going to mount the ArduPilotMega + Oilpan between the main body and the landing jack the body of the helicopter up about 2 inches and put all the electronics in there (except the magnometer + gps).

    I hope to put up some updates on the arduCopter wiki in the next few weeks.

    Please tell me about your project when you have a moment. Making a helicopter fly is too tough a problem to solve on your own.
  • hello randy! we're actually doing something very similar to your project and I'm wondering how far you've gone with yours.
  • Dear Randy,
    thanks for the reply, I see there is plenty of information on the links you have supplied but also on many other topics discussed in this forum. The project I am working on is a general UAV platform both for vertical take-off, landing vehicles and also for aeroplane. I am an electronic engineer and have worked with microprocessors from Texas Instruments and Microchip mainly for motion control. It is not a problem for me to design multilayer high density electronic boards and to include many sensors and interfaces. I have almost decided on many parts like GPS, altimeter, airspeed, aircraft diagnostics, engine control and monitor, video and data RF communications. I would also have no problem building the ground station with an interface to visualise all telemetry data. For the moment the immediate problem I am facing is an economic solution for a reliable AHRS system. Another advantage, other than saving money, on a custom build AHRS system is that I can use the sensors of my choice. During my search on AHRS systems I came across many devises. One that caught my attention is the VN-100 by Vectornav.

    This unit costs about 500$ and includes a 32bit mcu that processes the raw on extended kalman filters, it also outputs Quaternion/DCM. If anyone used this module and evaluated its performance please comment !

    Thanks again for the info, I will update on the progress of my project.

  • Developer

    No Kalman filter's aren't implemented in the 6dof from Sparkfun, I had to do that myself using various resources .. but this page from Tom Pycke was pretty useful. Also to be clear, the 6DOF from sparkfun is really an IMU..although you can change the code and implement kalman filters etc you still need another micro controller to take that info and control the UAV's servos.

    I also heard on a couple of the diydrones podcasts that Tim Trueman was putting together some kalman filters for an IMU/AHRS along with some documentation.

    ..but instead of reinventing the wheel, I would recommend using DCM. I haven't used it but many others have and I suspect it'll be much better than what you can put together yourself.

    Also instead of that 6DOF from sparkfun, if you're not working on a helicopter, you might consider the ArduIMU
    (I say "if you're not working on a helicopter" because you need very vibration resistant gyros and accelerometers like the ones from Analog Devices and that's not what's on this board)

    Or you might want to wait a couple of months until the Mega is available from the DIYDrones store.

    Good luck. Hope you post something about your project some time.

  • Hi everyone, I am looking at this sparkfun 6dof IMU but I don't see anywhere Kalman filters implemented on the firmware given. Do you people implement this your self ? I am planing to use this unit but I am having second thoughts, I think I might go along with a true 6dof device with 3axis on all sensors (acc, gyro and mag).

    Also can anyone help me with implementing the Kalman filter I need.

  • IR beacons, or are there any other ways to navigate with out using compass and GPS?
  • Developer
    There's a lot of good advice above and I plan to put a good bit of it into use!

    The comments on the PD routines & Kalman filters are especially appreciated.

    I'm going to strethen up the hardware, probably by moving the IMU (the green thing on the front) to the back, and shift the xbee down near the micro controller (thanks for the advice master crossfire).

    A Lipo battery will come as I get a little closer to actual launch.

    I'm definitely also going to follow the AludrA55's adice of getting one axis working at a time, controlling the others myself.

    If someone actually knows how to take a 3 axis magnometer outputs (like I have in the Sparkfun IMU 6DOF), and do something useful with them I'd love to hear about it. When I've looked at the outputs, they barely change as I rotate the heli. That's why I gave up and just went for the standard non-tilt-adjusted compass. At some point I'll have to sort that out though.
  • hi... i'm a newbie... but i got some ideas... =)

    first, I think that you should at least make sure that your platform is flyable...
    you could turn that into a full blown rc helicopter with receiver, transmitter, heading hold
    gyro, and a LiPo battery (it looks like you're using NiCad)... LiPo batteries are very capable
    of discharging enough current to operate the motor at a decent speed to lift the platform...

    then once you're able to fine tune your platform to hover and learned how to hover using your
    transmitter, you could start plugging in your microcontroller in between your receiver and your
    servos... use the microcontroller to capture the pwm signals from the receiver...

    it appears that your heli has a pseudo 120 CCPM... you need to capture 3 pwm for each head
    servos, 1 pwm for rudder, and another pwm for throttle... your throttle has 2 purpose, it could
    change the pitch of your rotor blade's angle of attack or it could also control the speed of your
    rotor blade depending on what you want.. then another channel for your on and off switch to
    enable transmitter control...

    then you could use one axis of your IMU to get roll/pitch (left/right tilt) angles and feed it through the
    microcontroller to calculate PID to stabilize the platform... at this time you'll still have elevator
    (nose up/nose down) control to prevent your platform from crashing...

    then once the microcontroller is able to stabilize the platform's roll/pitch axis, you could start
    reversing control by using a second axis of the IMU for the microcontroller to control the elevator
    part of the axis... then once you have 2 axis stability, you could tackle the altitude stabilization
    (probably use barometer, ping, IR, or integrating Z axis from IMU)... etc...

    but anyway, just an idea.. =)
  • If you have Kalman Filters on the pitch and roll axis fusing the accelerometer and gyro data, then a PD control routine on the pitch and roll axis is all that's needed to balance the platform. For example, on the pitch axis the angle from the Kalman Filter is the difference between the desired angle (set point) and the current (measured) angle of the platform, and the rate from the Kalman Filter is the unbaised rate. The angle difference (error) is the Proportional input to the PD controller and the unbaised rate is the Differential input. With the right gains set (Kp & Kd), the PD controller will drive the angle error to zero so the platform maintains the angle set point. If you want to hover, set the angle set points in pitch and roll to zero. If you want to set the platform in motion, then set the pitch and roll angle set points to something other than zero.

    See this link for video demonstrating this on a 4-rotor platform.

    Although I have not implemented it yet, I am planning on using a 2 axis compass and gyro with a Kalman Filter and PD routine to control yaw. I figure the tilt information is known from the pitch and roll data.

    I have been doing my work on a 4-rotor platform but eventually plan to move to a helicopter, in fact I also have an ECO8. I thought the 4-rotor platform would be an easier configuration on which to develop the control routines, balancing on four columns of air as opposed to a single column of air in the case of a helicopter.
This reply was deleted.