Could a LUA app alert based on average peak voltage? - HeliFreak
Fun, Learning, Friendship and Mutual Respect START  HERE


Unregistered
Go Back   HeliFreak > R/C Electronics Support > Jeti Duplex Radio Systems


Jeti Duplex Radio Systems Jeti Duplex Radio Systems Support


Reply
 
LinkBack Thread Tools Display Modes
Old 10-11-2017, 07:40 AM   #1 (permalink)
Registered Users
 

Join Date: Apr 2013
Location: UK
Default Could a LUA app alert based on average peak voltage?

Hey folks,

This is a topic I've seen extrapilot mention a few times. A lot of us are using mAh telemetry, but if you mix pack sizes it's not always the best solution.

Pack voltage on the other hand is a great indicator regardless of pack size, but you get a lot of variance in a flight.

However, if you filter out the spikes, and average out the peak voltage, that actually gives a very consistent and reliable figure, so a filter on the pack voltage should make for a great universal alarm which would work regardless of the flight pack capacity.
https://www.helifreak.com/showthread.php?p=7467848

Does anybody know if it's possible to implement something like this in software using LUA? To my understanding calculating an average voltage every 5-10 seconds or so would seem like a way to make low voltage alarms much more relevant.

Edit: Found the older thread where this concept was discussed in some detail, with extrapilot including some graphs of voltage in flight:
https://www.helifreak.com/showthread.php?t=734583
myxiplx is offline        Reply With Quote Quick reply to this message
Sponsored Links
Advertisement
 
Old 10-11-2017, 09:21 AM   #2 (permalink)
Registered Users
 

Join Date: Sep 2010
Location: On the lamb...
Default

I don't see why it couldn't be done. You have access to the telemetry sensors where you can obtain the voltage. Of course, this means you need to have telem data sent to the TX. You'd just need a sliding window where you average the voltages. The Jeti Lua library looks to support sound output via functions such as playFile or playNumber.
GravityJunkie is offline        Reply With Quote Quick reply to this message
Old 10-24-2017, 03:11 AM   #3 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Yup, this can be done. I was working on it myself, and pinged Teros as I was struggling with the code, and in under 24hrs he had a utility released:

https://www.rc-thoughts.com/2017/10/...cher-released/

Unfortunately it's not working for my application as it seems the DS-14 LUA doesn't have access to receiver voltage, but the concept is sound. You have access to sensors, the math you need, and a clock.

I suspect that tracking max voltage and taking the average of that over a 5-10s period will be the most accurate, but it needs some testing to see what figures work best.
__________________
Backyard fun: Oxy 2 with VX1p | Trex 250 SE with VX1e
At the field: Protos 380 (Brain) | Gaui X3 (360mm + 380mm) - VX1e | Trex 600N VX1e
TX + Sims: Jeti DS14 and Realflight (Wireless)
And now a Lynx Team Pilot :-D
myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-24-2017, 08:01 AM   #4 (permalink)
Registered Users
 

Join Date: Mar 2016
Location: Essex, UK
Default

Quote:
Originally Posted by myxiplx View Post
Yup, this can be done. I was working on it myself, and pinged Teros as I was struggling with the code, and in under 24hrs he had a utility released:

https://www.rc-thoughts.com/2017/10/...cher-released/

Unfortunately it's not working for my application as it seems the DS-14 LUA doesn't have access to receiver voltage, but the concept is sound. You have access to sensors, the math you need, and a clock.

I suspect that tracking max voltage and taking the average of that over a 5-10s period will be the most accurate, but it needs some testing to see what figures work best.
Just out of curiosity; why do you need to reference the receiver voltage?
__________________
Mark

So many heli's, so little time.
Crashalotjoe is online now        Reply With Quote Quick reply to this message
Old 10-24-2017, 10:10 AM   #5 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Because I don't have any separate telemetry devices fitted to the particular plane I want to use this for, it's a lightweight F3P model.

Instead I'm running the electronics directly off a 2S lipo, which means the built in receiver voltage telemetry gives me the flight pack voltage. With a R7 nano receiver that's full telemetry for under 2g of weight!

Unfortunately on the DS-14 it doesn't look as though Jeti have exposed that particular bit of data to LUA :-(
myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-24-2017, 10:28 AM   #6 (permalink)
Registered Users
 

Join Date: Mar 2016
Location: Essex, UK
Default

Quote:
Originally Posted by myxiplx View Post
Because I don't have any separate telemetry devices fitted to the particular plane I want to use this for, it's a lightweight F3P model.

Instead I'm running the electronics directly off a 2S lipo, which means the built in receiver voltage telemetry gives me the flight pack voltage. With a R7 nano receiver that's full telemetry for under 2g of weight!

Unfortunately on the DS-14 it doesn't look as though Jeti have exposed that particular bit of data to LUA :-(
Ah, yes, makes sense.
__________________
Mark

So many heli's, so little time.
Crashalotjoe is online now        Reply With Quote Quick reply to this message
Old 10-24-2017, 10:56 AM   #7 (permalink)
Registered Users
 

Join Date: Sep 2010
Location: On the lamb...
Default

Were you using the getTxTelemetry call? It states it gives a receiver voltage.

That'd be pretty dumb if you couldn't get the data from that call.
GravityJunkie is offline        Reply With Quote Quick reply to this message
Old 10-24-2017, 12:14 PM   #8 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

So far that whole call doesn't seem to work on the DS-14. The LUA API guide for that call does state some functions aren't available on the DS-16.

I'm hoping it's something Jeti just haven't gotten time to port over yet, rather than an inherent limitation on the DS-14/16.
myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-24-2017, 01:54 PM   #9 (permalink)
Registered Users
 

Join Date: Sep 2010
Location: On the lamb...
Default

The manual stated that some of the telem values aren't available for the 14. I would have thought the function would be working though.

Are you getting an error when you call it? Or are you just not getting any returned data?
GravityJunkie is offline        Reply With Quote Quick reply to this message
Old 10-24-2017, 02:10 PM   #10 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Getting nothing at all, although I'm not familiar with the LUA debug console.

Jeti do have a demo app showing the functionality of this call, it works fine in the Jeti studio emulator, but does nothing on my DS-14.

I've emailed Jeti to ask if they can confirm if this call should or should not work on the DS-14, waiting to hear back from them.
myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-25-2017, 06:14 AM   #11 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Jeti just came back to me, the getTxTelemetry function should work fine on the DS-14. So this may be possible after all. I'll report back after some more playing.
__________________
Backyard fun: Oxy 2 with VX1p | Trex 250 SE with VX1e
At the field: Protos 380 (Brain) | Gaui X3 (360mm + 380mm) - VX1e | Trex 600N VX1e
TX + Sims: Jeti DS14 and Realflight (Wireless)
And now a Lynx Team Pilot :-D
myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-25-2017, 07:48 AM   #12 (permalink)
Registered Users
 

Join Date: Mar 2015
Location: Saguenay QC, Canada
Default

hey myxiplx, look at your Helifreak PM I cooked something for you.
StefSTG is offline        Reply With Quote Quick reply to this message
Old 10-25-2017, 02:31 PM   #13 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Thanks, but I got Teros' version working today and modified it a bit. The problem on the DS-14 was the rolling average function, it was taking up too much memory for the limits Jeti place on LUA apps on the DS-14.

I need to tweak the code a bit until I'm happy with how it tracks the voltage during a flights, but the app itself looks great and definitely works!

myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-25-2017, 03:07 PM   #14 (permalink)
Registered Users
 

Join Date: Mar 2015
Location: Saguenay QC, Canada
Default

Nice
StefSTG is offline        Reply With Quote Quick reply to this message
Old 10-25-2017, 05:05 PM   #15 (permalink)
Registered Users
 

Join Date: Nov 2010
Location: Orlando, Fla.
Default

Very good that you found what was causing the problem with DS-14/16's! I have a DS-16, but would really like to give Teros' app a try. I'm sure he will see it here and give us and update with an option for use it on our older Tx's
__________________
Align 700,600N,550,450p,450s,250s: SAB Goblin 500,380: Gaui X3,X3L: Oxy3: Blade 250cfx, 230s +:
Spartan VX1, Bavarian 3sx, Vbar pro, Brain2, BeastX. DX9, DX18, DS-16
Member of the TORCHS club.
taterb is offline        Reply With Quote Quick reply to this message
Old 10-25-2017, 05:21 PM   #16 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Oh yeah, he's away with work at the moment but we've been exchanging emails. He knows the issue on the DS-14/16 and is planning to take a look at how he can change the code.

Hats off to him, I couldn't have written this code at all myself.
myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-28-2017, 11:23 PM   #17 (permalink)
Registered Users
 

Join Date: Sep 2010
Location: On the lamb...
Default

Very nice. Glad to see you've gotten past the first hurdle.

Are you running out memory because of the shear number of telemetry readings for the time frame you're looking to doing a rolling average?

If so, you could do averages of averages. Say you're getting 5000 telem readings over your time frame you'd like to average out. You could do something like keep the last 500 readings. Once you have the 500, take the average of the 500, retain that average for use in your main voltage average. Then, at any one point, you'd only have 510 samples kept in memory instead of the full 5000.
GravityJunkie is offline        Reply With Quote Quick reply to this message
Old 10-29-2017, 12:06 AM   #18 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Yeah, that's basically what I have it doing at the moment in my version. It was tracking a rolling average of 80 values (approx 2.5 seconds of data) but running out of memory as it did that. I've changed my version to track peak voltage every second (which has minimal memory use), and then take a rolling average of the last 10 of those.

It's definitely smoothing out the result, but still under reports the voltage in flight as there's always sag under load. I'm working on a way to calibrate it now to account for that and see how accurate I can get this.
myxiplx is offline        Reply With Quote Quick reply to this message
Old 10-29-2017, 02:22 PM   #19 (permalink)
Registered Users
 

Join Date: Mar 2013
Location: Finland
Default

My version is now doing average based on max-value, it's also very easy on memory. Tested in Ds-16 with no issues.

Big thanks to everyone who came up with ideas to this one!
__________________
RC-Thoughts.com - TeroS formerly known as CP-Geek
TeroS is online now        Reply With Quote Quick reply to this message
Old 10-29-2017, 04:41 PM   #20 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Apr 2013
Location: UK
Default

Tero, I have version 1.0 code working for a calibration routine to measure, and then correct for voltage sag under different throttle levels. I'll send you a copy in a sec.

I want to have it measuring each throttle level for a little longer as the battery takes a second or two before the voltage really starts to sag and I'm not capturing that yet.
myxiplx is offline        Reply With Quote Quick reply to this message
Reply




Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the HeliFreak forums, you must first register.
Please enter your desired user name, your REAL and WORKING email address and other required details in the form below.
User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself. Use a real email address or you will not be granted access to the site. Thank you.
Email Address:
Location
Where do you live? ie: Country, State, City or General Geographic Location please.
Name and Lastname
Enter name and last name here. (This information is not shown to the general public. Optional)
Helicopter #1
Enter Helicopter #1 type and equipment.
Insurance
Please select your insurance company (Optional)
Helicopter #2
Enter Helicopter #2 type and equipment.
Helicopter #3
Enter Helicopter #3 type and equipment.
Helicopter #4
Enter Helicopter #4 type and equipment.

Log-in

Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Copyright © VerticalScope Inc. All rights reserved.
 

SEO by vBSEO 3.6.1