BS2 Math Trick anyone? Exponential Notation, Floating Point Limitations...
xanatos
Posts: 1,120
Hi,
I'm reading the output from a 12 bit ADC that monitors the output from a vacuum sensor. The ADC output is 7.20 volts when the ADC count is 2996, and 6.42 volts when the ADC count is 2675. There is a rough relationship between voltage out and ADC count of 416 (ex. 2675 ADC out / 416 = 6.430V)
So my first threshold is trying to figure out how to do this without an available floating point processor...
Add to this the following: to convert the voltage to a pressure reading, the formula is:
Pressure = 10 ^ ((1.5 * V) - 12.125)
So I have two hurdles to overcome here...
I can multiply the ADC output by 10 and get the volts and tenths... but I still want to get the hundredths. My ADC Output variable is a WORD, so I'm limited to 32,768 as a max count before it flips over.
Is this even possible on a BS2px?
Ultimately, I want to read pressure in a format of x.y e-z Torr, as in 8.5 e-3 Torr. So I need to have the voltage converted to a pressure with the exponent being available as a separate integer.
Am I completely nuts for even trying this???
Thanks,
Dave
PS., S I guess the full formula I am trying to get my stamp to operate on is:
Pressure = 10^((1.5 * (ADC/416)) - 12.125)
Could a Propeller even do that?
I'm reading the output from a 12 bit ADC that monitors the output from a vacuum sensor. The ADC output is 7.20 volts when the ADC count is 2996, and 6.42 volts when the ADC count is 2675. There is a rough relationship between voltage out and ADC count of 416 (ex. 2675 ADC out / 416 = 6.430V)
So my first threshold is trying to figure out how to do this without an available floating point processor...
Add to this the following: to convert the voltage to a pressure reading, the formula is:
Pressure = 10 ^ ((1.5 * V) - 12.125)
So I have two hurdles to overcome here...
I can multiply the ADC output by 10 and get the volts and tenths... but I still want to get the hundredths. My ADC Output variable is a WORD, so I'm limited to 32,768 as a max count before it flips over.
Is this even possible on a BS2px?
Ultimately, I want to read pressure in a format of x.y e-z Torr, as in 8.5 e-3 Torr. So I need to have the voltage converted to a pressure with the exponent being available as a separate integer.
Am I completely nuts for even trying this???
Thanks,
Dave
PS., S I guess the full formula I am trying to get my stamp to operate on is:
Pressure = 10^((1.5 * (ADC/416)) - 12.125)
Could a Propeller even do that?
Comments
mV = ADCount * 10 ** 15754 ' e.g. 2675counts --> 6430mV
or
mV = (ADCount ** 26466) + (ADcount * 2) ' ditto
For the exponential part, what is the range of pressures or voltages you expect? Also, what accuracy is required? There are fair approximations and approaches. It is tricky on the Stamp and depends on the range to cover.
The Propeller could do it. One way is to load the floating point object, in which case it is simply a matter of turning the crank. The Prop has a table of the exponential function over one octave burned into its rom, and that can help if you want to attempt it without floating point.
I'll probably play with the propeller on this since I have so many other things going on on the same project... relay controls, sensors & sensor controls, counters (using those 515 counters for my neutron counters!) - even an EMIC2 (who doesn't need their fusion reactor to talk to them? )
Basically, the vacuum gauge manufacturer (Edwards WRG) just provides the calculation to convert volts to pressure in mbar or torr, and a graph that does the same. Around 8 volts and up is atmospheric pressure basically, with an ADC output of around 3400 - which, when multiplied by ten wraps around, so I just limit the max count because I really don't care about the pressure until it gets down around 1e-2 torr and below - which is around 6.5 volts and an ADC output of ~2708. Not overly concerned about exactly accurate pressure readings - as long as I can resolve to around .1 torr I'm happy. I should be so far down Paschen's curves that there's almost no chance of arcing unless I get to the megavolt range, so I just need to know if I'm in the proper ballpark to be sure it's the right time to introduce Deuterium.
I've attached the graph if you're interested.
Thanks again for the hints - you're always a fantastic resource for my weird projects!
Dave
Dave - how's your stock of lead shielding?
Actually I do now have a roll of lead shielding, appx. 36" x 48" x 1/16" thick. I will be running this only for about 5 minutes at a time once I introduce Deuterium, and since I don't plan on having any more kids, I should be good
Like your avatar icon... "Excessively Dangerous Thing" lol! I'm actually FAR more concerned about the 35kv at 50mA than the neutrons
Dave