It is currently Sun Feb 25, 2018 11:36 am



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

Joined: Fri Jan 08, 2010 3:35 pm
Posts: 1664
Location: Pennsylvania
The averaging sample can be set by the end user in the PTS DM software to suit their "likes", the actual algorithm that is used for the calculations is somewhat a "secret" as it's probably one of the most important parts of how the numbers are arrived at. Sensor "noise" is taken into account, Rick is the programmer so if he feels there is something he can expand on to help you out I'll leave it up to him as it's his coding that makes it work.

Sample, baud rate, speed of the computer etc all have a play in how the numbers come out, we are still learning on the PTS DM and trying to improve our numbers

_________________
Bruce

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


Tue Nov 27, 2012 8:30 am
Profile WWW

Joined: Fri Jan 08, 2010 10:36 pm
Posts: 1171
Location: Maryland
First off samples per second are a big factor into how many iterations go into the averaging. Think about it like this lets just use a number like 100 samples per second this is about the slowest you could get a PTS dm to sample data.

If I take 100 samples into stack and average them the stack will flush 100% every second and depending on how you manage your stack will dictate how your numbers flow….. Smoothing. Sooo if my stack was say 200 then I would only have modified 50% of the data every second and the change on the screen will be slower or more stable. You want to use a FIFO stack (Array) so the first number in is the first number out you should push to the stack and average every sample. I/E 1 2 3 4 5 6 7 8 9 then 10 1 2 3 4 5 6 7 8 then 11 10 1 2 3 4 5 6 7 and so on. Each number in this example would just represent the sample increment. You have to push your array along so not knowing the arduino code you may have to have a stack algorithm that moves the data through the array.

To give you and idea the early PTS DM was serial and its lowest sample rate was 125/sec and with a stack of 200 the numbers are smooth yet you can see the data click off in .1 increments and it take some skill to get your depression at 28 every time..


Which arduino board are you using, the PWM output can interface to the SSR module, you right the PID code and depression control is a no brainer.


Rick


Tue Nov 27, 2012 11:35 pm
Profile

Joined: Sun Nov 04, 2012 7:13 pm
Posts: 16
Using the Uno R3, this is the code that's currently on it: http://www.sdsgarage.com/Misc/Projects/Flowbench6/


I'm going to have to familiarize myself more with the sample rate, but according to this page: http://arduino.cc/en/Reference/analogRead it can go up to 10,000 times per second.


I think most of my frustration comes from the serial monitor, once i get a display installed i hope that it'll be easier to read.


Thanks for the explanation though, time to put more thought into the project, lol :lol:


Wed Nov 28, 2012 12:40 am
Profile

Joined: Fri Jan 08, 2010 10:36 pm
Posts: 1171
Location: Maryland
How are you currently reading the output of the uno?

To a PC interface? what is that made up of ?

Rick


Wed Nov 28, 2012 8:35 am
Profile

Joined: Sun Nov 04, 2012 7:13 pm
Posts: 16
Just the serial monitor in the Arduino program, i looked and couldn't find a good interface program. I'm sure something could be designed but that's far beyond my current abilities.



I'm a technical manager at a casino so i do have access to quite a few different LED signs and all kinds of stuff in the "Spare or obsolete" pile at the warehouse. I might have to dig through and see if there is anything that i could use as a display.


Wed Nov 28, 2012 8:58 am
Profile

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


Thu Nov 29, 2012 4:48 am
Profile
Site Admin

Joined: Fri Jan 08, 2010 3:35 pm
Posts: 1664
Location: Pennsylvania
giuino wrote:
don't know your sensors linearity and scale, but I think you took them from a datasheet and be ok.


Best to check the linearity to a water gauge and check the voltage range as is suggested. Those sensors need tweaking ;)

My 40" range maxes out around 36" and never reaches it's stated output voltage.

_________________
Bruce

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


Thu Nov 29, 2012 8:25 am
Profile WWW

Joined: Mon Nov 05, 2012 12:50 pm
Posts: 12
Brucepts wrote:
giuino wrote:
don't know your sensors linearity and scale, but I think you took them from a datasheet and be ok.


Best to check the linearity to a water gauge and check the voltage range as is suggested. Those sensors need tweaking ;)

My 40" range maxes out around 36" and never reaches it's stated output voltage.


Yes, it's always good to check these sensors, although many times I've found errors in the code itself rather than in sensors...


Thu Nov 29, 2012 10:50 am
Profile

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



Dave


Thu Nov 29, 2012 12:38 pm
Profile

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



Dave


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) ;)


Thu Nov 29, 2012 1:06 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:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF