FW# | Multi rotor | Air plane | CC3D | Revo | Battery on OSD | Battery on Revo | Oplink Radio Control | RSSI on Ch10 | Charset Uploader | Safety Radius & Efficiency | Glide Est. | WP Info | Batt Type Select | LiHV detect | Stall Alarm |
01 | X | - | X | - | X | - | - | X | - | X | - | - | - | X | - |
02 | X | - | X | - | X | - | - | X | X | - | - | - | - | X | - |
03 | - | X | X | - | X | - | - | X | X | X | - | - | X (noBattCrv) | - | - |
04 | X | - | - | X | X | - | - | X | X | - | - | - | - | X | - |
05 | X | - | - | X | X | - | - | X | - | X (noEff) | - | - | - | X | - |
06 | X | - | - | X | X | - | X | - | - | X | - | - | - | X | - |
07 | X | - | - | X | - | X | - | X | X | X | - | - | - | X | - |
08 | X | - | - | X | - | X | - | X | X | X | - | X | - | X | - |
09 | X | - | - | X | - | X | X | - | X | X | - | X | - | X | - |
X | - | - | X | - | X | X | - | - | X | - | X | - | X | - | |
11 | - | X | - | X | - | X | - | X | - | X | X | X | X | - | X |
12 | - | X | - | X | - | X | X | - | X | X | X | X | - | - | X |
13 | - | X | - | X | - | X | X | - | - | X | X | X | X | X | X |
I think this was hardcoded in the version you posted before, much appretiated :)
- Stall speed warning and alarm for planes. Stall speed threshold can be set in the OSD_JDL_Config tool.
Nice!QuoteStall speed warning and alarm for planes. Stall speed threshold can be set in the OSD_JDL_Config tool.
I think this was hardcoded in the version you posted before, much appretiated :)
I watched the videos and when I saw time/distance to waypoint I had a big smile on my face. :) After that I read all the features carefully!!!
Does the config tool run under Linux/Wine? Wish list: Config tool source on a cross platform framework so it can be built under Windows, Linux, or MacOS. Sorry. Had to say it. ;)
// JRChange: Flight Batt on MinimOSD:
// #define FLIGHT_BATT_ON_MINIMOSD
// Add MicroOSD KV team mod
// #define MICRO_OSD_KVTEAM
// JRChange: Flight Batt on Revo:
//#define FLIGHT_BATT_ON_REVO
#if defined MICRO_OSD_KVTEAM
#define VOLTAGE_PIN 0 // Micro OSD KV team : Bat1
//#define VOLTAGE_PIN 2 // Micro OSD KV team : Bat2
#define CURRENT_PIN 1
#else
#define VOLTAGE_PIN 6
#define CURRENT_PIN 7
#endif
Weird. Here's a pix - I have a different layout, but the V going to the input IS 4S, but I'm only seeing one cell appearing. So I get a Battery Low alarm, plus I still get a link alarm.
if (voltage > 21.8) // min 3.63V for 6-cell (21.0-25.2) (21.0-26.1)
num_cells=6;
else
if ((voltage > 17.45) && (num_cells < 5)) // min 3.49V for 5-cell (17.5-21.0) (17.5-21.75)
num_cells=5;
else
if ((voltage > 13.2) && (num_cells < 4)) // min 3.30V for 4-cell (14.0-16.8) (14.0-17.4)
num_cells=4;
else
if ((voltage > 8.8) && (num_cells < 3)) // min 2.93V for 3-cell (10.5-12.6) (10.5-13.05)
num_cells=3;
else
if ((voltage > 5.0) && (num_cells < 2))// min 2.50V for 2-cell (7.0-8.4) (7.0-8.7)
num_cells=2;
Ok. Tested. Yes, it fixed the bat capacity issue. Now if I plug in everything except the batt1, it reads 1 cell and 0V. Plug in batt1 and it rises up to 3.94V, and the capacity goes up to 81%. Good!
But it still only reads 1 cell.
Reversing the order, plugging in batt1, then the cam/xmtr, then the fc+OPOSD+, it starts at 4cells and 15+V, then ramps down to 3.94V, plus capacity goes to about 2%, but num_cells stays 4.
I did have another weird issue. I had changed the voltage divider value, the bat capacity value to 2200 and the warning level to 3.0 in previous versions. I did a read OSD of the device, then tried changing the batt warning value in the config tool. I enter 3.5, hit enter, and the config tool crashes and goes away. I note also there were some odd values on the current items in the GUI.
I restarted the config tool, then manually reentered all the values BEFORE doing anything to the device, then hit write. Then everything was ok, and now the battery low warning is gone.
num_cells starts with value "1" on OSD boot. Later, it can go only up if higher voltage is detected, but never goes down. This meanes the cells count depends on the highest voltage seen from OSD firmware since boot up.
Code: [Select]if (voltage > 21.8) // min 3.63V for 6-cell (21.0-25.2) (21.0-26.1)
num_cells=6;
else
if ((voltage > 17.45) && (num_cells < 5)) // min 3.49V for 5-cell (17.5-21.0) (17.5-21.75)
num_cells=5;
else
if ((voltage > 13.2) && (num_cells < 4)) // min 3.30V for 4-cell (14.0-16.8) (14.0-17.4)
num_cells=4;
else
if ((voltage > 8.8) && (num_cells < 3)) // min 2.93V for 3-cell (10.5-12.6) (10.5-13.05)
num_cells=3;
else
if ((voltage > 5.0) && (num_cells < 2))// min 2.50V for 2-cell (7.0-8.4) (7.0-8.7)
num_cells=2;
#define MAX_CELLS 8
#define MAX_CELL_V 4.40 /* high voltage lipo is 4.35 */
#define TOTAL_V_FUDGE 0.20 /* help for inaccurate v dividers */
// even calcs correct cell count for zero / near-zero / negative volts
for (int cell_count=MAX_CELLS; cell_count>=0; --cell_count) {
// if voltage is higher than the next smallest cell count max v
if (voltage > (cell_count-1)*MAX_CELL_V + TOTAL_V_FUDGE) {
num_cells = cell_count;
break;
}
}
[email protected] ~/Desktop $ ./celltest
voltage +0.10
cell count 8 requires more than 31.00V requires more than 3.88V/cell.
cell count 7 requires more than 26.60V requires more than 3.80V/cell.
cell count 6 requires more than 22.20V requires more than 3.70V/cell.
cell count 5 requires more than 17.80V requires more than 3.56V/cell.
cell count 4 requires more than 13.40V requires more than 3.35V/cell.
cell count 3 requires more than 9.00V requires more than 3.00V/cell.
cell count 2 requires more than 4.60V requires more than 2.30V/cell.
cell count 1 requires more than 0.20V requires more than 0.20V/cell.
num_cells 0
[email protected] ~/Desktop $ cat celltest.c
#include <stdio.h>
#include <stdlib.h>
#define MAX_CELLS 8
#define MAX_CELL_V 4.40 /* high voltage lipo is 4.35 */
#define TOTAL_V_FUDGE 0.20 /* help for inaccurate v dividers */
void main() {
float voltage;
int num_cells;
voltage = 0.1f;
printf("voltage %+5.2f\n", voltage);
// even calcs correct cell count for zero / near-zero / negative volts
for (int cell_count=MAX_CELLS; cell_count>=0; --cell_count) {
if (cell_count) printf("cell count %d requires more than %5.2fV requires more than %5.2fV/cell.\n", cell_count, (cell_count-1)*MAX_CELL_V + TOTAL_V_FUDGE, ((cell_count-1)*MAX_CELL_V + TOTAL_V_FUDGE) / cell_count);
// if voltage is higher than the next smallest cell count max v
if (voltage > (cell_count-1)*MAX_CELL_V + TOTAL_V_FUDGE) {
num_cells = cell_count;
break;
}
}
printf("num_cells %d\n", num_cells);
}
(Interesting story: One cheap model I bought that came with motor in a pod and ESC had long ESC wires. You could hear a high whine that changed a lot during load changes in a loop; smoothly increased whine frequency (sounded about ~1kHz) under high load, opposite of what you would expect from prop. I actually suspect this was from the ESC output wires but smoothly changing frequency doesn't fit my expectation of fixed frequency 8kHz 16kHz PWM?)Could that be the switching 5V voltage regulator inside the ESC? It varies its frequency depening on the load and input voltage. But it must be much higher than 1kHz... The whine could be emitted from the (low quality?) inductor? Just guessing...
:) Sample code could be replaced with a loop to save some space (and even increase max cell count) if you are code space critical. :)Code: [Select]#define MAX_CELLS 8
#define MAX_CELL_V 4.40 /* high voltage lipo is 4.35 */
#define TOTAL_V_FUDGE 0.20 /* help for inaccurate v dividers */
// even calcs correct cell count for zero / near-zero / negative volts
for (int cell_count=MAX_CELLS; cell_count>=0; --cell_count) {
// if voltage is higher than the next smallest cell count max v
if (voltage > (cell_count-1)*MAX_CELL_V + TOTAL_V_FUDGE) {
num_cells = cell_count;
break;
}
}
Cells | Total V Threshold | Min V per cell | LiPo range | LiHV Range |
6 | 21.80V | 3.63V | 21.0 - 25.2 | 21.0 - 26.1 |
5 | 17.45V | 3.49V | 17.5 - 21.0 | 17.5 - 21.75 |
4 | 13.20V | 3.30V | 14.0 - 16.8 | 14.0 - 17.4 |
3 | 8.80V | 2.93V | 10.5 - 12.6 | 10.5 - 13.05 |
2 | 5.00V | 2.50V | 7.0 - 8.4 | 7.0 - 8.7 |
// OSD_Vars.h
static int num_cells = 1;
......
// FlightBatt.ino
static const float batt_levels[5] = {5.0f, 8.8f, 13.2f, 17.45f, 21.8f};
for (int cell_count=6; cell_count>1; --cell_count) {
if ((voltage > batt_levels[cell_count-2]) && (num_cells <= cell_count)) {
num_cells = cell_count;
break;
}
}
Another data point.
I recoded another OSD device on a quad I have using this latest firmware and charset, using the config from the other boards. It is not identical PCB, but pretty close.
I ended up resetting the divide ratio to the default.
On this system, I have to plug in the cam/xmtr first, or for some reason the OSD will not run - I get nothing on the display.
But when I do, it DOES display properly, and gets the correct cells and battery voltage! Yah! Pix enclosed.
One oddity - the battery voltage and capacity are fluctuating a lot.
Cliff did you get the new versions of the OSD you ordered yet? Another data point will be helpful.
I am having some trouble with the video. Everything is fine until I ramp up the power - then the OSD data flickers.
If I turn off the video input, the OSD data is fine by itself with the power ramped up.
I do have grounds out to the camera and video xmtr coming from the gnds next to the in/ou pins.
FYI - I added a 10uf cap right on the PCB power in leads - it definitely helped the flickering issue - now it still flickers a little, but not too bad. So I've ordered some 100uf 10V caps - will try those when they arrive. Biggest ones radial dipped I can find - the 1000uf are much pricier and axial leads. Judging by the improvement with 10uf the 100uf may be good enough, or adding the inductor to make a low-pass filter.
Another data point.
I recoded another OSD device on a quad I have using this latest firmware and charset, using the config from the other boards. It is not identical PCB, but pretty close.
I ended up resetting the divide ratio to the default.
On this system, I have to plug in the cam/xmtr first, or for some reason the OSD will not run - I get nothing on the display.
But when I do, it DOES display properly, and gets the correct cells and battery voltage! Yah! Pix enclosed.
One oddity - the battery voltage and capacity are fluctuating a lot.
Have not tried this code yet. I seem to have wrecked one of the two (sort of) working OPOSD boards I have - not sure exactly what happened - it also took out my GPS/mag. But everything else seems fine. It blinks so the cpu must be working but the overlay does not appear anymore. I swapped in the other one and another GPS/mag and they seem to work fine.
Have you found another reliable source for these boards? I want to get a bunch more.
BTW - plz message me when you want to get a quicker response. I don't check all the threads Im in all the time, but messages I check. Thanks
Interesting. Yes, please provide a hex file here. I use a lot of the Runcam 4K cameras. i recently added one to an older OSD board with your latest code - it seemed fine but then I haven't tested it in low light, only outdoors. I use the batt1 input for battery voltage detection. For some reason on this older system, the indicated voltage moves around a LOT - I can't get a clear indication of what the true battery voltage is. Here's the downlink video:
...so traced back the pin to the 16k resistor it lead to (oddly, it measures 8k on my DMM - a Fluke).
Notes and Warnings
After changing the analog reference, the first few readings from analogRead() may not be accurate.
... I imagine if I added caps on each of the 20A ESC boards themselves, it would greatly reduce the video noise.
I note on the YEP ESCs running 6S, they have two 470uf caps on the power input lines on EACH esc.
On the small planes, there are NO extra caps on the ESCs - only what the little 20A bare PCBs have on board (can't tell what they are, all surface mount).