It is currently Tue Feb 20, 2018 12:01 am



Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3, 4  Next
 Formula help? 
Author Message

Joined: Sun Nov 04, 2012 7:13 pm
Posts: 16
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:
float voltage = average * (5.0 / 1023.0);

change 5.0 with your new voltage.

Second:
Code:
float kpa = ((voltage / 5) - .5)/.2;

no sense to use voltage and divide by 5... just use the averaged adc read:
Code:
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

Quote:
no sense to use voltage and divide by 5... just use the averaged adc read:
Code:
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


Fri Nov 30, 2012 1:02 am
Profile

Joined: Mon Nov 05, 2012 12:50 pm
Posts: 12
You're right, your original code say:

Code:
float kpa = ((voltage / 5) - .5)/.2;


so you could write:

Code:
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!!!


Fri Nov 30, 2012 4:53 am
Profile

Joined: Sun Nov 04, 2012 7:13 pm
Posts: 16
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


Wed Dec 05, 2012 1:21 pm
Profile

Joined: Mon Nov 05, 2012 12:50 pm
Posts: 12
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


Wed Dec 05, 2012 5:39 pm
Profile

Joined: Fri Jan 08, 2010 10:36 pm
Posts: 1171
Location: Maryland
Quote:
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.


Wed Dec 05, 2012 10:22 pm
Profile

Joined: Mon Nov 05, 2012 12:50 pm
Posts: 12
1960FL wrote:
Quote:
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:


Thu Dec 06, 2012 4:18 am
Profile
Site Admin

Joined: Fri Jan 08, 2010 3:35 pm
Posts: 1664
Location: Pennsylvania
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 . . .


Thu Dec 06, 2012 8:33 am
Profile WWW

Joined: Sun Nov 04, 2012 7:13 pm
Posts: 16
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


Thu Dec 06, 2012 9:56 am
Profile
Site Admin

Joined: Fri Jan 08, 2010 3:35 pm
Posts: 1664
Location: Pennsylvania
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 ;)

viewtopic.php?f=5&t=458

_________________
Bruce

Who . . . me? I stayed at a Holiday in Express . . .


Thu Dec 06, 2012 10:13 am
Profile WWW

Joined: Sun Nov 04, 2012 7:13 pm
Posts: 16
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.


Fri Dec 07, 2012 11:49 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 34 posts ]  Go to page Previous  1, 2, 3, 4  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF