-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diagnostic Vin and Vout has wrong scaling on HuskySat #634
Comments
The ADC has a reference voltage of 3.3V (not 3) and the voltage divider is 24/99 for Husky. Fox-1e does not have this diagnostic. |
Ok, this will be in 1.09j2. I was forgetting to halve the lookup value for the reference voltage, which returns twice the bus value for historical reason stretching back to 1A as I remember.. |
Does exactly half work? That does not seem quite right? Is the reference voltage for HuskySat 3.3V, and the voltage divider 24/99 (or at worst 1/4) and the values should be 6.0 and 6.3. These are not measurements...it should be exactly the same each time. |
Actually they come out now as 6.12 and 6.42.
I take the raw values. I look up the voltage in the IHU Serial Number 31
bus voltage table. That returns a value between 0 and 6.6 (for historical
reasons). I now half that and multiply the result by 99/24.
As a worked example, the diagnostic is 2043100946 at reset 8 uptime 819083,
which is 79C7 3F12. So then the type is 12, which is the one we want.
Then the Vin raw is 73F and the Vout is 79C. How do you get 6.0 and 6.3
from that?
For Vin 73F it is decimal 1855. Ignoring the lookup table, if I use 3.3
*1855/4096 I get 1.495. Then 1.495 * 99/24 gives 6.16. I get 6.12 when I
use the Bus Voltage lookup table vs just 3.3/4096
…On Tue, May 19, 2020 at 7:37 PM Burns Fisher ***@***.***> wrote:
Does exactly half work? That does not seem quite right? Is the reference
voltage for HuskySat 3.3V, and the voltage divider 24/99 (or at worst 1/4)
and the values should be 6.0 and 6.3. These are not measurements...it
should be exactly the same each time.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#634 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRDKWJFCGRINRHJJBABJEDRSMJ43ANCNFSM4NFLW6SQ>
.
--
Chris E. Thompson
chrisethompson@gmail.com
g0kla@arrl.net
|
I see what you are saying. I guess the difference is between the linear
values and the actual measurements I took, which are:
Bus Voltage Voltage/4 Vbat/4 Reading Linear
6.4 1.55136 1972 1925 -47
6.3 1.52712 1941 1895 -46
6.2 1.50288 1913 1864 -49
6.1 1.47864 1884 1834 -50
6 1.4544 1855 1804 -51
5.9 1.43016 1827 1774 -53
5.5 1.3332 1706 1654 -52
5 1.212 1556 1503 -53
4.5 1.0908 1411 1353 -58
4 0.9696 1264 1203 -61
3.5 0.8484 1115 1052 -63
3.3 0.79992 1079 992 -87
So we are both right! You are looking at the linear values (which I put on
the right with the difference between measured and actual at the far
right. I'm looking at measured.
Anyway, lots closer. Thanks.
On Tue, May 19, 2020 at 8:32 PM Chris Thompson <notifications@github.com>
wrote:
… Actually they come out now as 6.12 and 6.42.
I take the raw values. I look up the voltage in the IHU Serial Number 31
bus voltage table. That returns a value between 0 and 6.6 (for historical
reasons). I now half that and multiply the result by 99/24.
As a worked example, the diagnostic is 2043100946 at reset 8 uptime 819083,
which is 79C7 3F12. So then the type is 12, which is the one we want.
Then the Vin raw is 73F and the Vout is 79C. How do you get 6.0 and 6.3
from that?
For Vin 73F it is decimal 1855. Ignoring the lookup table, if I use 3.3
*1855/4096 I get 1.495. Then 1.495 * 99/24 gives 6.16. I get 6.12 when I
use the Bus Voltage lookup table vs just 3.3/4096
On Tue, May 19, 2020 at 7:37 PM Burns Fisher ***@***.***>
wrote:
> Does exactly half work? That does not seem quite right? Is the reference
> voltage for HuskySat 3.3V, and the voltage divider 24/99 (or at worst
1/4)
> and the values should be 6.0 and 6.3. These are not measurements...it
> should be exactly the same each time.
>
> —
> You are receiving this because you were assigned.
> Reply to this email directly, view it on GitHub
> <#634 (comment)>,
or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ADRDKWJFCGRINRHJJBABJEDRSMJ43ANCNFSM4NFLW6SQ
>
> .
>
--
Chris E. Thompson
***@***.***
***@***.***
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#634 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASNGPBKUSG7ZJKCJLPSNLDRSMQK5ANCNFSM4NFLW6SQ>
.
|
We want this to show the actual value when it will trip, don't we. So only
one is correct. Given it measures the bus voltage, will it trip when the
bus voltage says 6.12 or 6.0? Or at a different value?
On Tue, May 19, 2020 at 8:42 PM Burns Fisher <notifications@github.com>
wrote:
… I see what you are saying. I guess the difference is between the linear
values and the actual measurements I took, which are:
Bus Voltage Voltage/4 Vbat/4 Reading Linear
6.4 1.55136 1972 1925 -47
6.3 1.52712 1941 1895 -46
6.2 1.50288 1913 1864 -49
6.1 1.47864 1884 1834 -50
6 1.4544 1855 1804 -51
5.9 1.43016 1827 1774 -53
5.5 1.3332 1706 1654 -52
5 1.212 1556 1503 -53
4.5 1.0908 1411 1353 -58
4 0.9696 1264 1203 -61
3.5 0.8484 1115 1052 -63
3.3 0.79992 1079 992 -87
So we are both right! You are looking at the linear values (which I put on
the right with the difference between measured and actual at the far
right. I'm looking at measured.
Anyway, lots closer. Thanks.
On Tue, May 19, 2020 at 8:32 PM Chris Thompson ***@***.***>
wrote:
> Actually they come out now as 6.12 and 6.42.
>
> I take the raw values. I look up the voltage in the IHU Serial Number 31
> bus voltage table. That returns a value between 0 and 6.6 (for historical
> reasons). I now half that and multiply the result by 99/24.
>
> As a worked example, the diagnostic is 2043100946 at reset 8 uptime
819083,
> which is 79C7 3F12. So then the type is 12, which is the one we want.
> Then the Vin raw is 73F and the Vout is 79C. How do you get 6.0 and 6.3
> from that?
>
> For Vin 73F it is decimal 1855. Ignoring the lookup table, if I use 3.3
> *1855/4096 I get 1.495. Then 1.495 * 99/24 gives 6.16. I get 6.12 when I
> use the Bus Voltage lookup table vs just 3.3/4096
>
>
> On Tue, May 19, 2020 at 7:37 PM Burns Fisher ***@***.***>
> wrote:
>
> > Does exactly half work? That does not seem quite right? Is the
reference
> > voltage for HuskySat 3.3V, and the voltage divider 24/99 (or at worst
> 1/4)
> > and the values should be 6.0 and 6.3. These are not measurements...it
> > should be exactly the same each time.
> >
> > —
> > You are receiving this because you were assigned.
> > Reply to this email directly, view it on GitHub
> > <#634 (comment)>,
> or
> > unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/ADRDKWJFCGRINRHJJBABJEDRSMJ43ANCNFSM4NFLW6SQ
> >
> > .
> >
>
>
> --
> Chris E. Thompson
> ***@***.***
> ***@***.***
>
> —
> You are receiving this because you were assigned.
> Reply to this email directly, view it on GitHub
> <#634 (comment)>,
or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AASNGPBKUSG7ZJKCJLPSNLDRSMQK5ANCNFSM4NFLW6SQ
>
> .
>
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#634 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRDKWOP72G7KTCXKVOGSJDRSMRQXANCNFSM4NFLW6SQ>
.
--
Chris E. Thompson
chrisethompson@gmail.com
g0kla@arrl.net
|
It will trip when the bus voltage raw value is below the trip raw value.
So if you are using the same algorithm for the trip value and displaying
the raw value, then you are perfectly correct. We want those to match.
Good point...thanks.
On Tue, May 19, 2020 at 8:46 PM Chris Thompson <notifications@github.com>
wrote:
… We want this to show the actual value when it will trip, don't we. So only
one is correct. Given it measures the bus voltage, will it trip when the
bus voltage says 6.12 or 6.0? Or at a different value?
On Tue, May 19, 2020 at 8:42 PM Burns Fisher ***@***.***>
wrote:
> I see what you are saying. I guess the difference is between the linear
> values and the actual measurements I took, which are:
>
> Bus Voltage Voltage/4 Vbat/4 Reading Linear
> 6.4 1.55136 1972 1925 -47
> 6.3 1.52712 1941 1895 -46
> 6.2 1.50288 1913 1864 -49
> 6.1 1.47864 1884 1834 -50
> 6 1.4544 1855 1804 -51
> 5.9 1.43016 1827 1774 -53
> 5.5 1.3332 1706 1654 -52
> 5 1.212 1556 1503 -53
> 4.5 1.0908 1411 1353 -58
> 4 0.9696 1264 1203 -61
> 3.5 0.8484 1115 1052 -63
> 3.3 0.79992 1079 992 -87
>
> So we are both right! You are looking at the linear values (which I put
on
> the right with the difference between measured and actual at the far
> right. I'm looking at measured.
>
> Anyway, lots closer. Thanks.
>
> On Tue, May 19, 2020 at 8:32 PM Chris Thompson ***@***.***
>
> wrote:
>
> > Actually they come out now as 6.12 and 6.42.
> >
> > I take the raw values. I look up the voltage in the IHU Serial Number
31
> > bus voltage table. That returns a value between 0 and 6.6 (for
historical
> > reasons). I now half that and multiply the result by 99/24.
> >
> > As a worked example, the diagnostic is 2043100946 at reset 8 uptime
> 819083,
> > which is 79C7 3F12. So then the type is 12, which is the one we want.
> > Then the Vin raw is 73F and the Vout is 79C. How do you get 6.0 and 6.3
> > from that?
> >
> > For Vin 73F it is decimal 1855. Ignoring the lookup table, if I use 3.3
> > *1855/4096 I get 1.495. Then 1.495 * 99/24 gives 6.16. I get 6.12 when
I
> > use the Bus Voltage lookup table vs just 3.3/4096
> >
> >
> > On Tue, May 19, 2020 at 7:37 PM Burns Fisher ***@***.***
>
> > wrote:
> >
> > > Does exactly half work? That does not seem quite right? Is the
> reference
> > > voltage for HuskySat 3.3V, and the voltage divider 24/99 (or at worst
> > 1/4)
> > > and the values should be 6.0 and 6.3. These are not measurements...it
> > > should be exactly the same each time.
> > >
> > > —
> > > You are receiving this because you were assigned.
> > > Reply to this email directly, view it on GitHub
> > > <#634 (comment)
>,
> > or
> > > unsubscribe
> > > <
> >
>
https://github.com/notifications/unsubscribe-auth/ADRDKWJFCGRINRHJJBABJEDRSMJ43ANCNFSM4NFLW6SQ
> > >
> > > .
> > >
> >
> >
> > --
> > Chris E. Thompson
> > ***@***.***
> > ***@***.***
> >
> > —
> > You are receiving this because you were assigned.
> > Reply to this email directly, view it on GitHub
> > <#634 (comment)>,
> or
> > unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AASNGPBKUSG7ZJKCJLPSNLDRSMQK5ANCNFSM4NFLW6SQ
> >
> > .
> >
>
> —
> You are receiving this because you were assigned.
> Reply to this email directly, view it on GitHub
> <#634 (comment)>,
or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ADRDKWOP72G7KTCXKVOGSJDRSMRQXANCNFSM4NFLW6SQ
>
> .
>
--
Chris E. Thompson
***@***.***
***@***.***
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#634 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASNGPBWWEW2T5ZKGCNYW4DRSMR7VANCNFSM4NFLW6SQ>
.
|
Ok, I have an idea. The reason it matters about the measured number vs the calculated number is that 1) UW request a particular voltage range, namely 6.0V as minimum, and I gave them that based on meter readings, not on calculations. So it is odd to see the value showing up as 6.16 rather than 6.0. But second, if we want to play with that value, and if we'd like to look at the bus voltage to see how we are doing, we care because the battery manufacturer has specified a certain minimum value. So if you notice on the S/N 31 spreadsheet (reproduced above but not very well), the first column is the measured voltage, the third column is the actual ADC reading at that measured voltage. Then the 4th column is what we would get if we calculated what the ADC should be strictly linearly (which is essentially what your formula is doing), and the 5th column is the difference in ADC values between the calculated value and the actual value. Notice that is is pretty consistently close to 50 off. So my suggestion (long run--no rush) is that you add an offset to your calculation. In other words in the example that you supplied, use 3.3*(1855-50)/4096 and then multiply that be 24/99. This gives 5.998, darned close to 6. I added that calculation to my spreadsheet and it looks pretty good. Maybe your new scheme for future satellites already has this available, but I suspect that A/D converters will always be off a bit. This one has improved its linearity considerably since the first ones that we used, but now this offset seems to be the price we pay. Of course it could also be a tolerance issue on the voltage divide resistors.... Thanks for thinking about this! |
I've been thinking about this, and it occurs to me that it is just as sensible for ME to add the offset before I downlink it. The only disadvantage is that if there is a lot of difference between units, I can't really determine which serial number I am building for. But the same problem exists with FoxTelem, so it still doesn't matter :-) What do you think? |
I don't understand your logic. Why is there a -50mV offset. If you measured the actual bus voltages for the ADC values, then why are those not the actual values? I don't use 3/4096. I store the whole lookup table and do a linear interpolation between the two nearest values to calculate the voltage. So I would expect it to come out correctly. |
It is not a 50 millivolt offset I was proposing. It was a 50 count offset on the raw value. I misunderstood what you said you were doing...I knew you had a full table at one point, but I did not remember that you still did that. But in any case, I wish I could put the table I used earlier into fixed width font so you could see it better and I could tell you better what I am talking about. I'll try it in a bit with a screenshot. This darned A/D converter has given us more trouble over the years! |
test.pdf So just to see how far away from being linear, that is ADC=0 means 0V and ADC=4095 means 13.6V (because of the 24/99 voltage divider) the first column under Linear (that starts with 1925) shows what the ADC value would be with a strict linear calculation. And the next column shows the difference between the measured ADC count and the calculated linear count. You can see that that is usually off by close to 50, at least in the middle of the range. That's where "50" comes from. I suspected that you might be using the "linear" column rather than the "Vbat/4" column. Thus I did a few more columns. "Calculated Linear" says: "This is the voltage that would be displayed if give then Vbat/4 reading and use a strict linear interpolation from 0-4095 to calculate the voltage. And the last column, "Calculated linear with offset" says "If given the Vbat/4 reading and if you then offset it by 50 and use a strictly linear 0-4095 = 0-13.5V, here is what would you would get. I think that the "Calculated linear" is close to what FoxTelem is showing. In other words, when I measure 6V and get 1855 ADC, I think FoxTelem is actually using the linear column and turning 1855 into 6.166V. If that is true, then the Vbat/4 Reading is what you should be using. This whole thing is ridiculous and I have to do better with the ADC. My apologies for making this so darned complicated. We should get an apology from STMicrosystems for making their darned ADC not very easy to use too! |
So the table that I am using is exactly this, because it is defined in HUSKY_SAT_ihuVattSN31.tab
This came from a spreadsheet that you sent me, but I don't see that data above. I might have back calculated into the ADC values that give the final Bus Voltage. It is 2x the read value for historical reasons. I always divide the result by two giving an ADC reading from 0-3.3V So for ADC 1855 I lookup the voltage and do a linear interpolation between the values for 1246 and 1876. That is then divided by two and then multiplied by 99/24 to give 6.12V. When the actual bus voltage is displayed from the Solar Panels it is using my legacy conversion number 58, called CONVERT_COM1_BUS_VOLTAGE. This also takes the ADC value, looks it up in the table, divides it by two and divides by 0.2424, which is the same as multiplying by 24/99. Eric just specified it differently. So I am applying exactly the same conversion to the Vin/Vout as I am to the Bus voltage. If the ADC value you are sending for Vin/Vout is the actual BUS ADC value that will trip the mode, then this is the right way to display it. If it comes out as 6.12 vs 6 then we either have the wrong ADC value stored or the wrong curve, which would mean we are also displaying the Bus voltage as too high. |
Oh, I see. You are using my top left table and doubling the voltage. That was generated not by measuring the bus voltage but by placing a measured voltage on a pin that went to a different ADC channel. Whereas my lower left table was generated from the actual bus voltage being measured. Whatever...That ADC is so darned inconsistent. Or I suppose that the voltage divider could be off in its resistance. Let's not both to change anything. Thanks for explaining. |
The values are listed as 11.7 and 12.3. They should calculate out to 6.0 and 6.3. I'm not sure the values are the same for 1E and Husky.
The text was updated successfully, but these errors were encountered: