Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
projects:electronics:dualpressuresensor [2009/01/07 19:46] – photonicsguy | projects:electronics:dualpressuresensor [2014/11/13 14:12] (current) – photonicsguy | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Barometric Pressure sensor ====== | ||
+ | |||
====== Dual pressure sensor board ====== | ====== Dual pressure sensor board ====== | ||
- | {{: | + | {{: |
- | {{: | + | |
+ | {{: | ||
+ | {{: | ||
- | < | ||
- | <IMG SRC="/ | ||
- | </ | ||
{{: | {{: | ||
Line 51: | Line 52: | ||
http:// | http:// | ||
- | |||
- | == gnuplot == | ||
- | Perl logging script | ||
- | ---- | ||
- | <code perl> | ||
- | # | ||
- | |||
- | use DateTime:: | ||
- | use DateTime; | ||
- | |||
- | $pidfile="/ | ||
- | $csvfile="/ | ||
- | $gnpfile="/ | ||
- | $logfileshort="/ | ||
- | $device="/ | ||
- | |||
- | open(FILE, ">" | ||
- | print FILE $$; | ||
- | close(FILE); | ||
- | |||
- | open(CSV, | ||
- | print CSV " | ||
- | close(CSV); | ||
- | |||
- | ($sec, | ||
- | $syear=substr($year, | ||
- | $year+=1900; | ||
- | $mon++; | ||
- | $logfile=$logfileshort.$syear.$mon.$mday; | ||
- | #print " | ||
- | |||
- | |||
- | $dt = DateTime-> | ||
- | |||
- | open(USB, "<" | ||
- | |||
- | while (1) { | ||
- | $curhour=$hour; | ||
- | $qtr=1+int($min/ | ||
- | $curqtr=$qtr; | ||
- | $dt = DateTime-> | ||
- | $count=0; | ||
- | $avgtally=0; | ||
- | |||
- | print " | ||
- | while (< | ||
- | ($sec, | ||
- | $mon++; | ||
- | $year+=1900; | ||
- | $qtr=1+int($min/ | ||
- | $dt = DateTime-> | ||
- | |||
- | if($curqtr==$qtr) { | ||
- | } else { | ||
- | $average=$avgtally/ | ||
- | $pressure=(($average/ | ||
- | $pressure = sprintf(" | ||
- | print " | ||
- | $oldcount=$count; | ||
- | $count=0; | ||
- | $avgtally=0; | ||
- | # Print Average here | ||
- | $logfile=$logfileshort.$syear.$mon.$mday; | ||
- | |||
- | open(LOG, | ||
- | print " | ||
- | $quarter=15*int($min/ | ||
- | print LOG " | ||
- | close(LOG); | ||
- | |||
- | $now=time(); | ||
- | $foravg=sprintf(" | ||
- | open(GNP, | ||
- | print GNP "$now $pressure $foravg $oldcount\n"; | ||
- | close(GNP); | ||
- | |||
- | $excel = DateTime:: | ||
- | # print "Hour: $hour\tQuarter: | ||
- | $exceltime=($hour/ | ||
- | # print " | ||
- | open(CSV, | ||
- | print CSV $excel+$exceltime; | ||
- | print CSV ", | ||
- | print CSV "," | ||
- | print CSV ", | ||
- | print CSV " | ||
- | close(CSV); | ||
- | |||
- | $dt = DateTime-> | ||
- | $curhour=$hour; | ||
- | $curqtr=1+int($min/ | ||
- | |||
- | } | ||
- | # | ||
- | # | ||
- | # } | ||
- | |||
- | $count++; | ||
- | @baro=split(/ | ||
- | $baro=$baro[1]; | ||
- | $avgtally+=$baro; | ||
- | } | ||
- | sleep(1); | ||
- | } | ||
- | </ | ||
- | Gnuplot | ||
- | ---- | ||
- | <code gnuplot> | ||
- | |||
- | set terminal png size 800 | ||
- | set title " | ||
- | set nokey | ||
- | #set xlabel " | ||
- | set grid | ||
- | set xrange [1226454300: | ||
- | set bmargin 3 | ||
- | set ylabel ' | ||
- | set xdata time | ||
- | set timefmt " | ||
- | set format x " | ||
- | set xlabel " | ||
- | |||
- | plot\ | ||
- | '/ | ||
- | '/ | ||
- | |||
- | </ | ||
- | < | ||
- | <IMG SRC=" | ||
- | </ | ||
---- | ---- |