I have been following this site for a while now, I guess it is time to post something myself.
Above is a picture of my latest scratch-built quadcopter running an STM32 ARM processor board with home-brew software. This is my second quad, on the first one (you can sort of see it in my profile picture) I used a home-mode, dual Atmega 328 board.
So far, the quad features the following setup:

  • Aluminium frame "Home-Depot" style
  • Alpha 370 size motors (HobbyPartz)
  • Salvaged 6dof sensor board from a Walkera XUFO 5 (4?)
  • 2-axis magnetometer (I know, 3 axes would make my life a little easier)
  • Maxbotix sonar range finder for low-altitude hold
  • Mediatek LS20031 GPS
  • Modified ADNS2610 optical mouse sensor for low-altitude position-hold
  • Custom software, using ChibiOS RT OS (http://chibios.sourceforge.net)
  • 72Mhz RC gear (Futaba TX, generic RX)
  • XBee telemetry downlink
  • Onboard data logging to SD/MMC card
  • Oh, yes: taped on keychain-camera for onboard video ;-)

Here is picture of the (rather untidy) electronics setup (the Xbee is normally mounted on the inside of the canopy, the mouse sensor and ultrasound sensor are underneath the copter for obvious reasons):

The software features working so far are:
  • Quaternion based attitude representation - tried Kalman filters at first, switched to a more DCM-like approach later
  • Attitude-hold and aerobatic flight modes (can be switched in flight)
  • GPS position hold (activated by channel 6 switch on TX)
  • OR alternatively at the moment: Optical flow position hold via a downward-facing, modified optical mouse sensor with custom optics (NOTE: both GPS position hold and mouse sensor position hold work, but only on a good day - definitely requires more tweaking/PID tuning)
  • Data logging to SD card (not very reliable atm - I do not really use this much since I have telemetry via Xbee)
  • "Ground station software" for data logging and displaying the state of the quad in various graphical ways

The software is written pretty much in straight C, making use of ChibiOS' multithreading. The ground software is a collection of Perl/Tk scripts - all my development happens on Linux.
Below is a video of the quad in "mouse sensor" position hold mode in my driveway - apologies for the terrible video, I will try and shoot a better one soon...

If somebody finds any of this useful or interesting, I am glad to share some more details...

E-mail me when people leave their comments –

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

Join diydrones


  • So, I see the code for ADNS-3080 is now in the AC2x code.  Is it functional. and safe to turn on?  I'm planning to use and old webcam lens, which should be ok, I think.

  • André, Patrick,
    There is another blog post of mine here: http://diydrones.com/profiles/blogs/quad-position-hold-with-mouse
    That one gives a little more detail on the optics.
    The lens itself is is from a $10 keychain digital camera that I bought at Walmart - I don't have the actual camera case anymore, so I do not know the exact name of it anymore. I had a few of those, and it seemed that any of the lenses you find in them would work just fine for this purpose. For my first prototype, I hot-glued the entire lens-assembly to the PCB and used the screw mechanism of the lens to adjust the focus.
    I did not really bother to determine the focal length of the lens precisely to figure out the exact numbers, instead I wrote a small ATtiny13 program and a little program on my PC to display the raw image and adjusted the focus by trial and error until I could recognize something in the image (I used a shelve about 3 feet away)... Not terribly precise, but good enough for something that has a 18x18 resolution.
    The PC program is written in Perl/Tk, and meant to be run under Linux, but I am happy to provide if people find any use for it...
  • It would be interesting which distance you need between the lense and the imager to get a certain sharp area
  • Hi Marco, could you post the detail to change the lens of the optical sensor ?
    what kind if lense do we need ?
  • Hey, it's great to see you working on the same idea I had already a few years ago about using mouse controllers to stabilize a 'standard' main+tail rotor heli. I never got around doing it because I had too much fun flying it.

    (And to add to the coincidence: I just started evaluating CodeSourcery today for a work related project...)
  • To clarify: the tilt-compensation is done in software, the sensor itself is rigidly attached to the frame.
  • Yes, I do compensate for tilt.
    I have thought about using more than one sensor to augment the attitude estimation, but haven't really done anything in that direction.
    I did not use an actual mouse to build the setup, but instead ordered the 'naked' sensors on digikey for something like $1.87 a piece - with additional components needed to make it work (ceramic resonators and 2 or 3 caps) the setup comes to about $3, I think...
  • Did you tilt compensate your 'optical flow', so as the frame tilts it understands that the mouse optics will report a move?

    Mouse sensors are rediculously cheap, using more than one would (as Robin suggested) allow yaw measurements but also assist with height estimation - ie. both sensors indicating movement toward the outside of the frame as the ground approaches.

  • @Faisal: I tried using CodeSourcery toolchain but had some trouble with it. I ended up building my own Linux toolchain from sources. My entire "IDE" consists of emacs and make basically. I used a Makefile and linkscripts that were part of ChibiOS.
    @Danilo: You are correct, I use altitude from the sonar together with the mouse sensor to get positioning data.
    @Hassan: I never really weighed it without batteries, as pictured it weighs 900g with a 3S 2200mAh Lipo - I believe the Lipo weighs about 160-180g....

    I will try and take a few pictures and write something about the mouse sensor setup later - it is actually surprisingly simple...
  • Very nice.
    Could you post some pictures of you mouse sensor and the optics you used.
This reply was deleted.