# Voltage Byte -> True Voltage

I remember seeing the formula for this somewhere. Please Help. I’m writing a custom dashboard in VB which takes data direct from the dashboard port from the OI. How do I convert the voltage byte into true voltage?

Look in the default program listing, just after the c_variable CON 1 listings.

In Initialization Constant VOLTAGE - USER DEFINED,
the number to initialize the voltage constant
is equal to INT((DESIRED … VOLTAGE + 0.4) * 16.3)

For your purpose, you’ll have to reverse the process.

Unless they removed it when they updated their site, the formula to extract a battery voltage from the 0-254 value was in the FAQ at Innovation FIRST’s site.

What’s worse, fractional people trying to use metric or base 10 people trying to use base 2?

I tried the formula in the default code. It doesn’t seem to work.

Ok, I got it. It was on First’s web site, FAQ section. I knew I saw it somewhere. There is a difference between the default code and First’s web site. If you reverse the default code, as stated above, you get a term of -0.4, while if you look at First FAQ, you get a term of 0.4. And I was off by approximately 0.8 so I see that was my problem.

A bit off topic, I’m trying to get my dashboard monitor working , but I haven’t programmed in VB for a long time. How do I round the battery voltage to one decimal place?

Quick question: Do you need sensor8 to be active in your program for the Low Bat LED function to work, or do you only need sensor8 if you are using the analog voltage somewhere in your program?

Only reason I wonder is that our low bat LED comes on after about 5 mins and we are not sure if this is because of the much higher drain on the batter this year vs last year.

*Originally posted by Manoel *
**A bit off topic, I’m trying to get my dashboard monitor working , but I haven’t programmed in VB for a long time. How do I round the battery voltage to one decimal place? **

Assuming your voltage is stored in varVolt, do something like this:

varVolt=(int(varVolt*10+0.5)/10)

Or, if you’re just outputting it, do this:
lblVoltage.caption = Format\$(varVolt,“##.0”)

I found the following formula in the FAQ on the Innovation First website:

Voltage = ((((binary_value*79)/128)+4)/10

Hope this helps.

Quick question: Do you need sensor8 to be active in your program for the Low Bat LED function to work, or do you only need sensor8 if you are using the analog voltage somewhere in your program?

Only reason I wonder is that our low bat LED comes on after about 5 mins and we are not sure if this is because of the much higher drain on the batter this year vs last year.

The Low Bat LED comes on without regard to whether or not your program uses the battery voltage.

It is my understanding that your program can set the voltage that the LED flashes
Below is from the Default Code from Innovation First:

'---------- Initialization Constant VOLTAGE - USER DEFINED -------------------
’ This is the ‘Low Battery’ detect voltage. The ‘Low Battery’ LED will
’ blink when the voltage drops below this value.
’ Basically set VOLTAGE = INT ((DESIRED FLASH VOLTAGE + 0.4) * 16.3)
’ Example, for a 10 Volt trigger, set Voltage eq 170.

dataInitVolt CON 153 '9.0 Volts

However, at a low enough voltage (I think it is 8 volts or perhaps 8.5 volts), the Low Battery LED comes on and stays on until the RC is reset (as I recall – it may require the OI to be reset also but I don’t think so). The voltage that the LED latches on is fixed and cannot be changed by us mere mortals.

I hope this helps.

Joe J.

*Originally posted by Joe Johnson *
**
However, at a low enough voltage (I think it is 8 volts or perhaps 8.5 volts), the Low Battery LED comes on and stays on until the RC is reset (as I recall – it may require the OI to be reset also but I don’t think so). The voltage that the LED latches on is fixed and cannot be changed by us mere mortals.
**

If I remember correctly, it’s a hair above 8.0v when the light stays on. The reason I say a “hair above,” is that if the voltage ever gets below 8.0 for more than an instant, the RC does not have enough power to run(minimum 8v required) and resets.