Formula help?

Pitot Style Bench discussions
Superdave
Posts: 16
Joined: Sun Nov 04, 2012 7:13 pm

Re: Formula help?

Post by Superdave »

giuino wrote:Buy a 16*2 display and you're ok

I'm reading your code...

there are some mistakes
First of all you're assuming a 5v source, so you assume you're sensor voltage swings 0-5v
In real world 5v will be more 4,5-4,8v
So, first of all find a convenient power source, test it and find your 5volt value;
then on:

Code: Select all

float voltage = average * (5.0 / 1023.0);
change 5.0 with your new voltage.

Second:

Code: Select all

float kpa = ((voltage / 5) - .5)/.2;
no sense to use voltage and divide by 5... just use the averaged adc read:

Code: Select all

float kpa = (average - .5)/.2;
the delay should be only at the end of the loop no sense to stop the routine halfway

same applies to voltage2 and kpa2

don't know your sensors linearity and scale, but I think you took them from a datasheet and be ok.

Ok, had some time to look into this.

I checked all 3 sensors as well as the datasheet for the diff pressure sensor. The A-D corrections now reflect what i found. I haven't ran the bench because my kids are sleeping, i'll try that tomorrow. The delays were also fixed, forgot to remove those as i added more to the code. lol
no sense to use voltage and divide by 5... just use the averaged adc read:

Code: Select all

float kpa = (average - .5)/.2;
The averaged ADC read is still raw though, i need a voltage value in that formula to convert to Kpa.



The 2nd MAP sensor is connected and working to correct Depression, it's corrected after the voltage to Kpa to WC conversion and and not ADC yet... That's a project for another night.

It's the temp correction that i'm now unsure about. My original plan was to use a GM Coolant temp or air intake temp sensor but i think an active sensor built for the arduino might be a better option.




I also just found the Guino Dashboard project, seems like it might be a cool deal and fit right in with what i'm looking for. need to see if it'll display text instead of just sliders and graphs though.

http://www.instructables.com/id/Guino-D ... r-Arduino/ Pretty cool.


giuino wrote:
Superdave wrote:Awesome, thanks for the advice!


I'll work that in tonight, last night I started to work on adding the 2nd MAP sensor to correct the depression numbers VS Baro.


Do you guys think it's worth correcting CFM vs air temp?

Yes, 'cause CFM is a volume measure and volume is affected by temp...
for baro correction use always a formula embedding the adc values (not the volt output) ;)

I thought so, should be a fun addition.

you think using the ADC values VS the volt output will make that big of a difference?



Thanks again for all your input.

Later,
Dave
giuino
Posts: 12
Joined: Mon Nov 05, 2012 12:50 pm

Re: Formula help?

Post by giuino »

You're right, your original code say:

Code: Select all

float kpa = ((voltage / 5) - .5)/.2;
so you could write:

Code: Select all

float kpa = ((average / 1023.0) - 0.5)/0.2 ;
basically you don't multiply and divide by 5, less calculations in float means less strange results ;)

I'm using the same smoothing routine, and found that 20 samples and 200ms delay works really good... try it!

For the temp issue... I think that a digital one wire like this

https://www.sparkfun.com/products/245

should work

Great find this GUINO!!! I'll give it a try!!!
Superdave
Posts: 16
Joined: Sun Nov 04, 2012 7:13 pm

Re: Formula help?

Post by Superdave »

I had to put this on a temporary hold, wifey has me building a play room for the kids in the basement. :?

I did manage to make an adapter to flow a Briggs 5 HP carb, more on that project in another thread though.




giuino, did you have any luck with that Guino dashboard program?





Dave
giuino
Posts: 12
Joined: Mon Nov 05, 2012 12:50 pm

Re: Formula help?

Post by giuino »

yes, I tried and tested some functions, then I thought it would have been simply useless on my bench... as I already have an lcd display and the all I need is to write down some numbers...

I'm working on a pid routine to control a stepper valve in closed loop... it should help in depression control
1960FL
Posts: 1338
Joined: Fri Jan 08, 2010 10:36 pm
Location: Maryland

Re: Formula help?

Post by 1960FL »

The averaged ADC read is still raw though, i need a voltage value in that formula to convert to Kpa.
Dave from what I read your ADC out put +/_ 0 to 1024 or 10 bit resolution you are connecting it to a pressure sensor say 40” instead of converting to voltage then converting to pressure 40/1024 = 0.0390625 thus for every bit you are .039” of water.

Average your bits and multiply by 0.0390625 this gives you your pressure. You can then test against water and fine tune your calibration . I/E on the PTS DM the 40” sensor actually will only output up to say 38”. This will help your linearity.

Rick.
giuino
Posts: 12
Joined: Mon Nov 05, 2012 12:50 pm

Re: Formula help?

Post by giuino »

1960FL wrote:
The averaged ADC read is still raw though, i need a voltage value in that formula to convert to Kpa.
Dave from what I read your ADC out put +/_ 0 to 1024 or 10 bit resolution you are connecting it to a pressure sensor say 40” instead of converting to voltage then converting to pressure 40/1024 = 0.0390625 thus for every bit you are .039” of water.

Average your bits and multiply by 0.0390625 this gives you your pressure. You can then test against water and fine tune your calibration . I/E on the PTS DM the 40” sensor actually will only output up to say 38”. This will help your linearity.

Rick.
Just for accuracy, 0 to 1023, are 1024 steps ;)
so you divide by 1023
40/1023=0,039100684 not really different from your calc. :mrgreen:
Brucepts
Site Admin
Posts: 1851
Joined: Fri Jan 08, 2010 3:35 pm
Location: Pennsylvania
Contact:

Re: Formula help?

Post by Brucepts »

The "math" is a reference and it needs to be calibrated to a water gauge trust me on this one ;)

We've now worked on 4 different designs using various DAQ cards and each one needs a different calibration based on actual comparison to the same water gauge. Then again it all depends on how accurate you want to be?

Rick has programmed in 8 decimal places to the PTS DM so we can get pretty darn close . . . :mrgreen:
Bruce

Who . . . me? I stayed at a Holiday in Express . . .
Superdave
Posts: 16
Joined: Sun Nov 04, 2012 7:13 pm

Re: Formula help?

Post by Superdave »

good advice guys, thanks.


I still have my old inclined manometer around to check the math with, but i think the next major step is going to be getting some calibration plates and picking up a nice display.


There is a shop close to me that has a SF600, i wonder if he'd let me borrow his plates for a day.



Dave
Brucepts
Site Admin
Posts: 1851
Joined: Fri Jan 08, 2010 3:35 pm
Location: Pennsylvania
Contact:

Re: Formula help?

Post by Brucepts »

Superdave wrote: There is a shop close to me that has a SF600, i wonder if he'd let me borrow his plates for a day.

Dave
Might want to read this thread if you haven't about SF and accuracy ;)

http://www.flowbenchtech.com/forum/view ... ?f=5&t=458
Bruce

Who . . . me? I stayed at a Holiday in Express . . .
Superdave
Posts: 16
Joined: Sun Nov 04, 2012 7:13 pm

Re: Formula help?

Post by Superdave »

Interesting.. lol


I should be getting payment soon for a set of heads, maybe i'll just buy a set from the store here. Do you happen to have a rent option? lol...



I grabbed a little LCD display from work today that should do pretty well on the bench, i hope to have it hooked up soon.
Post Reply