• How to read PPM signal with Arduino?

    More than a year a published a post called Generate PPM signal with Arduino. Today it's time for part two: How to read PPM signal with Arduino?. Strange thing: internet does not gives very useful information on this topic. Strange, right? Some links to pages that does it either very very wrong or in not simple way.

    There is a one almost good solution. It's an example code by Hasi123. Short, efficient and actaully works almost out of the box. But it has 2 problems:

    1. It is not a library. You have to copy paste code
    2. It alters Timer1 and that means, that many other things stops to work: PMW output, Servo library or anything else that uses Timer1. Crap...

    So, I've invested some of my time and, based on that code, I've created Arduino library called PPMReader. Advantages?

    1. It is a library (!)
    2. It does not alters any timers (!)

    Example code, that reads PPM signal connected to Pin 2 of Arduino Uno or Pro Mini (and other using ATmega328) and prints decoded channels over serial port would look like this:

    #include "PPMReader.h"
    
    // PPMReader(pin, interrupt)
    PPMReader ppmReader(2, 0);
    
    void setup()
    {
      Serial.begin(115200);
    }
    
    void loop()
    {
      static int count;
      while (ppmReader.get(count) != 0) { //print out the servo values
          Serial.print(ppmReader.get(count));
          Serial.print("  ");
          count++;
      }
      count = 0;
      delay(500);
    }
    

    The only required configuration is a decission of a pin and interrupt. Not all pins have hardware interrupts, so on many boards this is limited to:

    • Arduino Uno, Pro Mini and other based on ATmega328: pin 2 / interrupt 0 or pin 3 / interrupt 1
    • Arduino Pro Micro and other based on ATmega32u4: pin 3 / interrupt 0, pin 2 / interrupt 1, pin 0 / interrupt 1, pin 1 / interrupt 3, pin 7 / interrupt 4

    PPMReader Arduino library can be downloaded from GitHub.

    Read more...
  • Large wooden BiCopter

    You just know a great project when you see one. Like, for example, large BiCopter made from wood and running INAV and flight controller software that kermets has built.
    BiCopters might look strange, but the idea is quite simple. Instead of 4 motors, we have 2 motors and 2 servos tilting the motors. Like a one step further from a tricopter.

    Similar idea (not the same, only similar) is used on large helicopters like Boeing CH-47 Chinook

    Read more...
  • INAV jumped over the bench

    Let's say I have almost a good news about sonar support in INAV: yesterday I flew terrain following mode with experimental INAV code. And did not crashed when shooting video below. I did crashed next code version, but that is only a minor detail, right?

    1. When shooting that video I did not touched throttle stick. Altitude control was 100% automatic
    2. It is US-100, not HC-SR04 ultrasonic rangefinder!
    3. US-100 was connected to Omnibus F4 Pro using experimental I2C interface with ATtiny85
    4. If you want to try it, here is the code. But be prepared to crash :)
    Read more...
  • Chasing airplanes is cool

    Chasing airplanes with drones is cool. Do not try to argue :) But airplanes are cool too. So here is a short video my friend shoot some time ago:

    Drone pilot: Krystian

    Flying wing pilot: me (I had no idea I was chased)

    Read more...
  • If not HC-SR04 then what? US-100 maybe....

    A week ago I wrote that HC-SR04 ultrasonic rangefinder is crap and it is still true. Only around 1m useful range and very jumpy behavior above are at least problematic...

    There is a better solution. US-100 ultrasonic rangefinder. Comparing to HC-SR04, it has at least twice the useful range. My preliminary tests gave solid readout over concrete up to 2 meters and something. Let's call it 2 meters. But what more important, US-100 was reporting out-of-range state instead of some random values when being out of range! Huge step forward comparing to HC-SR04.

    us-100 is much better than HC-sr04

    Unfortunately, better does not mean good. US-100 also has some problems.

    us-100 is much better than HC-sr04 ut still not good

    Readouts becomes "jumpy" at the edge of useful range and they are far far away from declared. But OK, declared always means "perfect conditions". Still, trust me on this, comparing to this, HC-SR04 is crap...

    Read more...
  • Depron Airboat Worklog #3

    In the beginning, sorry for small delay. I've finished this project 4 weeks ago, but somehow it always missed schedule. Anyhow, depron airboat with 3D printed propulsion elements is ready!

    3D Printed Depron airboat
    Read more...

  • Marabou Stork decommissioned

    Depron airplanes are easy to build, but also do not last long. Few weeks ago I decommissioned by Marabou Stork. It did not crashed, it was flying almost fine, but it had at least a few problems:

    1. Motor was overheating. Just like that
    2. Wing that I originally designed for something weighting around 450g, now had to work with twice that much weight. Take offs were, at least, problematic
    3. It was big and slow and was not giving enough fun

    Marabou Stork Depron FPV airplane

    So, to paraphrase Monty Python:

    This is a late marabou stork

    It's not a complete end of this design. Wing is still in pretty good condition and I have a plan to reuse it in experimental twin-motor design. But that later this year... In a mean time, last video footage.

    Read more...
  • DemonRC NOX5 racing quadcopter is done

    It took my time with this build, that is sure... Somehow there were always more important things to build. Anyhow, DemonRC NOX5 FPV racing quadcopter is finally up and running. DemonRC NOX5 quadcopter

    What is inside? Nothing special:

    • Frame: DemonRC NOX5
    • Flight controller: Airbot Omnibus F4 v4 running Betaflight 3.1.7
    • ESC: DYS XSD30A BLHeli_S
    • Motors: EMAX RS2205S 2300KV
    • Camera: RunCam Swift2 2.1mm lens
    • Video transmitter: TBS Unify Pro v2
    • RX: FrSky X4R-SB
    • Propellers: DAL T5045C Cyclone

    DemonRC NOX5 quadcopter

    DemonRC NOX5 quadcopter

    As a bonus, 3D printed TPU GoPro Session mount. But the bottom line is, it flies!

    Read more...
  • INAV 1.7.2 has been released

    "Let's do the news...." and INAV 1.7.2 has been released yesterday. Besides new targets (MATEKF405, Alienflight F7, SP Racing F3 NEO) there are few quite important changes:

    • ADC channel to function mapping is now configurable. Any ADC using function (battery voltage, current, RSSI) can be assigned to any ADC pin. You smoked Current pin? No problem, now you can use RSSI for that. It can be done using vbat_adc_channel, rssi_adc_channel, current_adc_channel, airspeed_adc_channel CLI commands
    • Support for analog pitot tubes, based on MPXV7002DP, known as APM Airspeed Sensor. It requires some hacking, but is pretty simple. I will publish detailed instructions in a next few days
    • Servo handling improvements:
      • servo min and max now do what they are supposed to be doing: output is scaled to reach them on max/min input, not just clip. And that means, that aileron differential is not super simple to archive
      • servo rule speed is now defined as 1 speed = 10 us/s. So, speed 100 means that full servo sweep will be done in 1 second. speed 50 means full servo sweep in 2 seconds and so on
      • smix min and max parameters were removed
    • Support for eLeReS receivers built into KFC flight controllers
    • Total flight statistics via stats, stats_total_time and stats_total_dist CLI commands
    • AnyFC F7 improvements:
      • buzzer on output #9
      • SD card detection is now configurable via sdcard_detect_inverted
      • support for external barometers using ANYFCF7_EXTERNAL_BARO target
    • Fixed wing landing after RTH that I already described here

    Full list of changes is available here.

    Read more...
  • HC-SR04 is crap and there is nothing you can do about it...

    Only few days ago I mentioned that I started to reintroduce sonar support to INAV. When DigitalEntity told me that popular HC-SR04 is crap I did not belived him. I expected that "official" 4m range on a noise-machine aka quadcopter is unrealistic, but data I recorded today clearly shows: HC-SR04 is crap and is absolutely not suited for quadcopters and probably other UAVs. Why? Because it goes nuts and starts to pick background noise instead of surface.

    Let's take a look here:

    Bottom trace shows pseudo Signal-to-Noise-Ratio (SNR) while top one shows raw HC-SR04 altitude and INAV position estimator altitude (GPS, barometer and accelerometer combined). As you can see, it's not that bad. There is a correlation between both of altitudes and SNR is pretty low.

    Same thing is happening here. Quadcopter descended to land, both altitudes went down to finally meet at zero. SNR is low too. Nice.

    But, very bad things starts to happen as soon as altitude crosses 1.5m. Not only SNR goes up, but HC-SR04 starts to report completely unreliable data! If it was reporting out-of-range state, it would be fine. But no, it keeps reporting something between 1 and 2 meters while real altitude is much higher. Total crap.

    Conclusion is simple: HC-SR04 can be used on multirotors but only on very low altitudes. Something like 0.75m over concrete. Or 0.5m above short grass. Or even less over long grass. Definitely not good enough for terrain following flight mode.

    Next week I will test US-100 ultrasonic rangefinder. It is supposed to give much better results. I hope so...

    Read more...
Paweł Spychalski

I'm Paweł Spychalski and I do things. Mainly software development, FPV drones and amateur cinematography. Here are my YouTube channels: