Putting together the flight controller for my first mini quad I decided on setting up a full-featured OSD.

Long story short, the best firmware is ShikOfTheRa's fork of MWOSD: scarab-osd

How to choose an OSD

There are lots of different OSD boards available on the market, but basically all of them are based on the "MinimOSD" design. At the core they are just a Arduino 328p processor and a MAX7456 chip that handles the text overlay. The only differences are form factor and power management.

One thing to watch out for is that the MAX7456 chip is sensitive to voltage spikes. A manufacturer, who's website you can find at myairbot.com, has solved this issue by creating their own version of the MAX7456 chip called the AB7456, this chip handles voltage spikes much better, so if you can find a MinimOSD with the AB7456, it may be slightly more robust than one with a MAX7456 chip.

From smallest to largest, the sizes are:

Micro MinimOSD

You can tell that any one of these boards (or any other board) will run scarb-osd by identifying the MAX7456 chip and Atmel328p chips.

Here is what the MAX chip looks like:

Here is what a small version of the Atmel chip looks like:

And a pinout if you're using one of these:

MinimOSD

There are quite a few variants of the MinimOSD form factor, the two biggest difference being if analog to digital (ADC) pins are broken out like on this one and how the power management is done.

The best Minim OSD variants have a solder bridge that can be used to power the MAX chip over 5v instead of 12v, which is definitely the best way to go, since the MAX chip can easily burn out at anything over 5v. If the board doesn't have a solder bridge, you'll need to wire it up as I show below.

The MinimOSD shown above has a solder bridge (actually 2). Just connect the two sets of pads, one on the front and one on the back and you're good to go. Don't plug anything into the V+ on the camera side.

Here's what it looks like when the ADC pins are broken out. This is only useful if you want to send data to the OSD that does not come from the flight controller, such as an analog RSSI signal.

Stackable MinimOSD

If you've got a stacking Flight Controller / PDB setup, you can get a stackable MinimOSD to go with them.

Power Distribution Board with a MinimOSD

AIO Flight Controller

If you're building a super-tiny quadcopter, like a Beerotor160 you can get a flight controller like the OZE32 which is a Naze32 + OSD + PDB all on a normal 35x35mm flight control board.

Flight controller with an OSD

Update July, 2016: There is a new flight controller out with an integrated OSD that can be directly configured via the BetaFlight Configurator. I highly recommend you checkout the OmnibusF3 if you're looking for an awesome new flight controller with an integrated OSD.

Finally, if you want an F3 flight controller with a built-in OSD, grab a BRF3 Flight Controller and BRF3 PDB (which includes the current sensor that enables the MAH consumption view on your OSD).

Let's get started

Parts

Here are the parts that I used:

The best feature of ScarabOSD is that you can change a variety of settings with your transmitter, straight from the OSD, without needing to plug in a computer!

Navigate with your PITCH and ROLL stick then use the YAW stick to change values.

Available menus are defined here:

  #define MENU0  0 //STATISTICS
  #define MENU1  1 //PID CONFIG
  #define MENU2  2 //RC TUNING
  #define MENU3  3 //VOLTAGE
  #define MENU4  4 //RSSI
  #define MENU5  5 //CURRENT
  #define MENU6  6 //DISPLAY
  #define MENU7  7 //ADVANCED
//  #define MENU8  X //GPS TIME
  #define MENU9  8 //ALARMS
  #define MENU10 9//PROFILE+PID CONTROLLER

Wiring

First, note that if you're going to get data from the flight controller, over the serial port. Breaking out the pins (other than voltage) is not necessary.

Derrick, over at FPVLab wrote this awesome post about wiring the minimosd, and drew up this awesome diagram. Even though it's for a board with the A/D converter pins already broken out, it gets across the general idea

As it comes, the ebay minim osd uses 2 different voltages, 5v on the flight controller/atmega328p side and 12v on the video/max7456 side. Let's change that to use 5v from the flight controller on both sides. This serves two purposes, first it allows the chip to be powered by the UART-USB adapter, meaning you dont have to plug in your copter battery to upload font and second it ensures nothing burns out if we were to accidentally apply more than 12v on the video side of the chip. Hoogvliger describes how to do this on his blog for the v1 chip. I've updated the photos for v2.

Remove the diode B2. Tape or clamp the board down, grab the diode with a pair of tweezers and heat one side with your iron. Pull that side off and do the other side

  • Wire the flight controller side v5 to the linear voltage regulator. Solder the pin side first then pass the wire through the ISP header, flux the voltage regulator and tin the wire, it should stick right on, no extra solder needed.
  • Jump the flight controller side GND to the video side ground

  • Note that when powering the OSD off the flight controller, any noise from the ESCs will go straight into your video signal. Therefore using a LC filter is crucial. My setup uses a LC filter followed by a 5v linear voltage regulator to power the flight controller and OSD.

  • The OSD connects to your cc3d like so:

Breakout Pins

  • This step adds pin headers to the analog to digital converters on the atmega328p microcontroller. This is only useful if you plan to directly connect analog pins straight to the OSD, ie. plug the battery voltage divider or current sensor output into the OSD. I did this originally because my reciever didn't have PPM, and I therefore did not have enough ADCs on my flight controller, but then I switched to an RX with PPM, and so I now plug the sensors straight into my flight controller and get this data over the serial connection to the flight controller. Long story short, skip this if you're plugging your sensors into your flight controller.

  • To know what pins to breakout on the atmega328p chip, let's read the code:

#define AMPERAGEPIN   A1
#define TEMPPIN       A6           
#define RSSIPIN       A3              
#define PWMRSSIPIN    A3              
#define LEDPIN        7

#define VOLTAGEPIN    A0
#define VIDVOLTAGEPIN A2
  • So let's break out those pins on the chip, here's the Atmega328p pinout
  • Here's what it will look like when you're done. I've broken out ground and A0-A3

Flashing

 
  • Around line 22, uncomment the BETAFLIGHT (or CLEANFLIGHT) line and ensure all other lines in this section are commented out (start with //). Here I've indicated I want to use BETAFLIGHT:
// Choose ONLY ONE option from the following long list :-

// latest release...
//#define MULTIWII                  // Uncomment this if you are using latest MULTIWII version from repository (2.4 at time of this MWOSD release)
//#define BASEFLIGHT                // Uncomment this if you are using latest BASEFLIGHT version from repository (Stable 2015.08.27 at time of this MWOSD release)
//#define TAULABS                   // Uncomment this if you are using the latest Tau Labs MSP Module
//#define DRONIN                    // Uncomment this if you are using the latest DRONIN MSP Module
//#define CLEANFLIGHT               // Uncomment this if you are using latest CLEANFLIGHT version from repository (1.11.0 at time of this MWOSD release)
#define BETAFLIGHT                // Uncomment this if you are using BETAFLIGHT (same as CLEANFLIGHT t time of this MWOSD release)
//#define HARIKIRI                  // Uncomment this if you are using HARIKIRI (for BOXNAMES compatibility)
//#define NAZA                      // Uncomment this if you are using NAZA flight controller
//#define iNAV                      // Uncomment this if you are using latest iNAV version from repository (1.01 at time of this MWOSD release)
//#define GPSOSD_UBLOX              // Uncomment this if you are using a UBLOX GPS module for a GPS based OSD
//#define GPSOSD_NMEA               // Uncomment this if you are using a NMEA compatible GPS module for a GPS based OSD
//#define GPSOSD_MTK                // Uncomment this if you are using a MTK module for a GPS based OSD
//#define NOCONTROLLER              // Uncomment this if you ahave nothing connected to the serial port - no controller or GPS module
// old releases supported...
//#define MULTIWII_V23              // Uncomment this if you are using MW versions 2.2/2.3  
//#define MULTIWII_V21              // Uncomment this if you are using MW versions 2.0/2.1  (for BOXNAMES compatibility)
//#define BASEFLIGHT20150327        // Uncomment this if you are using BASEFLIGHT up to and including version Stable 2015.03.27
//#define CLEANFLIGHT172            // Uncomment this if you are using CLEANFLIGHT versions up to and including 1.7.2
//#define CLEANFLIGHT180            // Uncomment this if you are using CLEANFLIGHT versions 1.8.0 & 1.8.1 
//#define APM                       // Uncomment this if you are using APM compatible FC (Under development only)

 
  • Click the play button to upload and you should see:
 

Building the IDE

unzip controlP5-2.0.4.zip
mv controlP5 ~/Documents/Processing/libraries
  • Open MW_OSD_GUI.pde in Processing, you might see this, just click OK
 
  • Install the library by clicking Sketch -> Import library -> add library and picking the extracted controlP5 folder in the directory ~/Documents/Processing/libraries

  • Click the play button and you should see the app running

 

Cleanflight Configuration

  • In CleanFlight configurator there is an option to send "MultiWii Compatible current output," do not enable this checkbox.

  • The effect is twofold:

    1. CleanFlight will allow negative values when this option is un-checked, which makes it possible to use a directional current sensor wired in either direction

    2. Scarab OSD (when set to #define CLEANFLIGHT in config.h) will automatically adjust to the proper units, thereby reading the correct values

Scarab OSD Configuration

  • Note that when using "Use FC..." options, ie. using the data from the flight controller as opposed to the onboard analog to digital converters, the "adjust" fields have no effect.

  • Here's the user guide

  • Here's how to configure the sensors Calibration Guide

  • My configuration looks like:

  • Note I'm using all data from "FC", meaning all the sensor info comes from the flight controller.

Troubleshooting

If you're not getting video here are some things to try to switch to PAL or to NTSC, if you're not sure, just try one then the other.

If your display doesn't have all the fields, open the layout editor, update anything (or nothing) and hit WRITE

If you're fonts look all weird, under FONT TOOLS hit SELECT open the data folder and pick the font you want to use. I used default.mcm. Hit Open then hit Upload, still in the FONT TOOLS section.

Voltage Monitor

  • I soldered a voltage divider into the current sensor package R1 - 10k & R2 - 2.2k. I didn't have any precision resistors (1%), but 5% seems to work fine.

    • Given the voltage divider formula Vout = Z2 / ((Z1 + Z2)) * Vin where Z1 is a resistor in series between Vin and Vout and V2 is a resistor in series between Vout and ground, we get Vout = (2.2k / (10k + 2.2k)) * Vin => Vout = .18 * Vin

    • Given Vout, the voltage that the microcontroller sees, Vin = ((10k + 2.2k)/2.2k) * Vout => Vin = 5.54 * Vout

    • Cleanflight's calculation is basically: Vbattery = Vout * vbat_scale it's a little more complicated because of the ADC and rounding issues, but conceptually. That's what it's doing.

    • Cleanflight expects vbat_scale in decivolts so our value will be vbat_scale = 55.4 = 55

Current Sensing

  • In summary

    • 0A -> 0.6V

    • 100A -> 4.6V

  • The ACS758LCB-100U is a unidirectionals 40mV/A sensor.

    • Sensor sensitivity of 40mv/a means the sensor output voltage will increase 40mV each one Ampere of real current increment flowing through the sensor.

      • Therefore, when current is 100A the voltage will be 4v + the quiescent voltage (0.6, described below)
    • Unidirectional means the sensor cannot detect which direction the current is flowing. Note that when wiring up the current sensor, DIRECTIONALITY MATTERS. The datasheet shows the power line must be connected like so:

  • For example, in this photo the pink wire goes to the positive lead on the battery and the blue wire goes to the positive lead on the quad:
  • In the typical usage section this schematic is shown. I skipped the extra components and wired VIN straight from the 5v voltage regulator (described below) and VIOUT straight to pin 6 on the CC3D.
  • Per the datasheet "The ACS758 outputs an analog signal, VOUT , that varies linearly with the uni- or bi-directional AC or DC primary sampled current, IP, within the range specified" In otherwords, the output is linear and proportional to the input voltage.

  • Because of ratiometry, the input voltage to the current sensor is important, so we'll use a 5v linear regulator to ensure the proper voltage. Ratiometric output means that the quiescent (when no current is passing through) voltage output, VIOUTQ, and the magnetic sensitivity, Sens, are proportional to the supply voltage, VCC.

  • The output of the device when the primary current is zero, is defined in the datasheet, for unidirectional devices = 0.12 × VCC so our resting voltage will be 0.6 when no current is passing through.

    • The datasheet also says -- variation in VIOUT(Q) can be attributed to the resolution of the Allegro linear IC quiescent voltage trim, magnetic hysteresis, and thermal drift.
  • When setting the offset, remember it's almost impossible to see 0Amps under no-load conditions. In a real situation all your gear, mostly your AV TX, camera etc. will draw between 250mah and 400mah.

First attempt

This was my first attempt to wiring the current sensor, use the second attempt method.

  • Solder together a male and female XT-60 connector, putting the current sensor's big pins (they almost look like heatsinks) on the inline with the positive side. Directly connect the negative side of one XT-60 to the negative side of the other XT-60.

    • I soldered these by tinning the 16awg wire and fluxing the pins then heating both for a moment.
  • Pin 1 goes to VCC, +5V from a linear voltage regulator, GND goes to any common ground between the battery ground and the minimosd ground.

  • To test, I placed it inline w/ my battery charger (since we know the ouput of the charger)

  • I found that the un-attached current sensor was un-reliable as the solder joints quickly wore when the leads from the current sensor to the XT-60 connector is so short. I decided to improve the reliability by doing a few things.

Second attempt

This method worked much better.

  • Attach the current sensor to a piece of plastic or something rigid to ensure it can be properly affixed to the quad and the wires are not stressed.

  • When soldering the current sensor, tin both the sensor leads and the wire. Then take some thin wire and wrap the wire (see the copper wire in the photo below) around both the wire and the sensor lead. This will create a physical connection, making the solder stronger. If you have flux, flux the whole assembly then heat with your iron turned up to around 750. It should all flow together as you add solder creating a very strong joint.

  • Don't use an indepenent linear voltage regulator, instead, I pulled 5v off an extra pin on the OSD that I added to the 5v pin. This 5v is after the LC filter, so the voltage should be much more stable.

  • Read more on the kvosd guide, yes, this is different firmware but the electrical basics still apply.

RSSI

I tried making this work with my cheap HobbyKing T6 (FS-T6A TX/RX), but without hacking up the reciever, it seems impossible.

The T6 RX apparently uses an A7105 wireles chip which, according to the datasheet, "A7105 has built-in 8-bits ADC do RSSI measurement as well as carrier detection function" on pin 1. Per the datasheet, it seems like one could breakout a pin and make it possible:

17.1 RSSI Measurement
A7105 supports 8-bits digital RSSI to detect RF signal strength. RSSI value is stored in ADC [7:0] (1Dh). Fig 17.1 shows a typical plot of RSSI reading as a function of input power. This curve is base on the current gain setting of A7105 reference code. A7105 automatically averages 8-times ADC conversion a RSSI measurement until A7105 exits RX mode. Therefore, each RSSI measuring time is ( 8 x 20 x FADC). For quick RSSI measurement, recommend to set FSARS = 1 (FADC =8MHz, 20 us measuring time). For power saving, recommend to set FSARS = 0 (FADC =4MHz, 40 us measuring time). Be aware RSSI accuracy is about ± 6dBm.

Instead of going this route, it was easier setting up OpenLRSng and using RSSI on channel 9 of the PPM signal as described on my fpv250 post. The scarab osd configurator should set the RSSI range from 0 to 255.