Althold referencing the ceiling


I'm just starting up with a project where the copter has to fly under the ceiling and holding a certain distance ~20cm.

One solution could be, to do that manual or in Standard Alt-Hold mode using barometer. But the much better solution would be to hold a certain height referencing the distance to the ceiling by using a sonar.

Does anybody have experiences in doing that?

Do you think I'll need to setup a new flight mode? "reversed alt-hold" ;)

Thanks for your replies in advance.



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

Join diydrones

Email me when people reply –


  • Hey daniel , we have done this  for our patented airborne barcode scanning system with downward facing sonar/SF10 liaser. check out these videos, currently works with maxbotic sonar and/or lightware laser. 

    We could easily transfer it to the top for you.

    we used a simple method: we have our own dronescan board which goes between the RC receiver and the APM. When you flick a switch on your TX, it engages our dronescan autopilot. 

    The dronescan autopilot in turn engages alt-hold on the APM. Then dronescan checks the SF10/maxbotic and sends up/down throttle commands to the APM. It lets through your left/right stick movements straight to the APM

    • Hello Jasper,

      thanks for your reply.

      The videos look really impressive!

      I'm pretty sure, this would also work for our application.

      But first, I'd like to try just the laser-rangefinder with inverted output. This could be the easiest way if it works.

      It's better for us, to reach the goal with a minimum of different components... Or what would be the advantage in using the dronescan board for my application?

      Best regards


      • Daniel - KISS - Keep it simple.

        the direct laser is the best way if it works. if not then contact me.

        The dronescan board has telemetry back to a pc and you can set the height remotely from a windows app. not sure if you need this feature, if you do i am sure you could accomplish the same using  APM mission planner . 

  • 20cm is mighty close to the roof. Have you considered the reverse ground effect? I'm not familiar with it in aircraft (not a common problem) but it's a big issue in nautical systems where moving close to a fixed boundary lowers the pressure and induces a very strong pull. Rotor marks on the ceiling? Maybe use a 20cm rod with a switch on the end to sense the roof. That way it can also act as a safety device. :)

    • yeah it is... manually flying works but it's not that easy and you need a high mental presence... ;)

      That's why I was thinking about a solution that offers a more "guided" variant for the application.

      maybe I will try a mechanical solution with some elements on the copter to keep the distance...

      But I can't stop thinking about a copter which hold the distance automatically using a sensor. That's why I'm looking for someone to give me a hint, where to start. :)

      • It might be possible to invert the output from a sensor so that the controls come out the correct way around.

        If the sensor has an analog output (eg SF10 laser) then you can feed this through an inverting amplifier.

        If the sensor has a PWM output (eg Maxbotix ultrasonic) then you can use a digital inverting gate.

        Of course this assumes that the sensor chosen will operate down to <0.2m so you will need to confirm this first (the SF10 will operate down to zero distance).

        • Thanks for the reply and the hint.

          I think the laser will be better... is it possible to invert the output range in the firmware?

          i just found the formula V=a*2.56*c but this will not suit... changing the formula will not work? ^^ like

          v = 2,56 / ( a * c )

          If not, do you know a suitable inverting amplifier?

          Is lightware your company?

          • Yes, the firmware can be changed to give an inverted output. The reason why I'm interested in your project is because there may be other people who also want to use inverted controls and, if that's the case, we could add the inverted output as a standard option. Could you give us an idea of why you need to follow the ceiling and not just follow the floor?

            FYI, I work for LightWare but don't own the company.

            • Cool! So that's maybe a win-win situation. :)

              I've got a customer who needs to do measurements in buildings. Therefore he needs to hold a certain distance to the ceiling. Floor is not possible, because there may be furniture or production machines...

              so how shall we proceed? wmeasurable range should be 0 (ceiling) - 20m (floor)...

              You can also contact me by mail.

This reply was deleted.


DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Nov 26
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Nov 25
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord:
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch
Oct 23
DIY Robocars via Twitter
RT @DAVGtech: Another incident:
Oct 23