[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PSUBS-MAILIST] Electronic help request



Hi Jon,

the Arduino map() function is useful for converting (linear)
scales, but it won't improve the resolution of the data.  Even
mapping to one step representing 4inches (a pressure delta of
0.1482psi), the display will still update in steps of 1.22psi
(33inches), since this is the best resolution the ADC can do
(under ideal conditions).

I think there is a clue when you say that sampling 20times a
second (and I assuming averaging these readings) didn't help.
This would imply that the variations you are seeing are not
high-frequency, but must be inducing these changes at a
period greater than one second.

Is it possible to have the Arduino board relay the data it
gathers back to your host or development computer where you
could graph the results over a larger time period?  This could
give you a kind of poor man's low frequency o-scope/data logger.

>From there you could look for patterns in the variation and
also identify a possible period for variance.  See if this
correlates to anything going on on the board (display switching,
sampling other sensors, time between sampling etc).  Possibly
hooking up the voltmeter when it's hooked up to the Arduino
and seeing if the voltmeter is still steady (any reason not to
do this?).

And of course, on the software side, with a large chunk of samples
on your desktop/laptop you could more averaging and find the ideal
sample period.  For example, may be sampling over several seconds
and taking the average before updating the display would improve
things (this means the display updates less often, but would more
accurate).

As for temp sensor variance vs pressure sensor variance, I think
the nature of the sensor comes into play.  The temp sensor is
probably a thermistor (a resister changing resistance as temp
changes), relying on molecular vibration which takes while to
propagated through the material.  The pressure sensor is based
on a piezoelectric crystal, small changes to the crystal structure
general a signal.  The quality of the signal most likely depends
on the quality of the crystal and how uniform crystal structure
is.  It's possible that minute vibrations and internal tension
(reformations) in the crystal structure can generate a constantly
varying signal.

Anyway, mainly software solution ideas which are probably obvious
to most software guys.  Also not so useful if the sensor is toast.
I am hoping some more EE or hardware guys can give you a good
solution, I seem to run into similar things with gyros and accelerometers.

Cheers,
  Ian.

-----Original Message-----
>From: Jon Wallace <jonw@psubs.org>
>Sent: Oct 24, 2011 6:56 AM
>To: personal_submersibles@psubs.org
>Subject: Re: [PSUBS-MAILIST] Electronic help request
>
>
>Hi Ian,
>
>The ADC is 0-5v input and your math regarding the steps and values are 
>correct.  However you can get better resolution (more steps) by using a 
>routine called map() to map the 1023 steps to any other value, which is 
>a nice feature.  By using the map routine I was able to get each step to 
>represent 4 inches of water.
>
>Regarding the sensor accuracy, you are correct with the numbers however 
>I would expect that the error is steady.  Since the sensor was just 
>sitting on my workbench the pressure was not changing quick enough to 
>cause a 4 step difference over 1 or 2 seconds.
>
>I think the voltmeter was accurate because the voltage corresponded to 
>the range of steps that were being displayed.  In other words, I know 
>that the sensor puts out 1v at 0psi which corresponds to an ADC step of 
>204.8 on a 1023 step scale.   The average ADC reads were in the 212, 
>213, 215 range which represents +/-14psi.  So it looked like the range 
>was correct for 1ATM of pressure which also matched the output of the 
>sensor.  The problem was the steps jumping around when the sensor was 
>holding steady.
>
>I tried sampling 20 times a second but found that the sampling was no 
>more accurate than just reading once, after I had gotten the hardware to 
>a point of only producing a 3 step difference.  However, I didn't try 
>the algorithm you described which would have smoothed out the results 
>nicely.  I knew I could take care of things with software enough to get 
>fairly accurate and dependable results, but it wasn't making sense that 
>the output from the ADC was erratic especially since the temperature 
>sensors were rock steady.  If anything, I would expect more variation 
>from the temp sensors than the pressure sensor, relative to just sitting 
>on the workbench while I'm testing the circuit.  So I was trying to make 
>sure that I had looked at every possible angle from a hardware 
>perspective before "fixing" things in software.
>
>I'm a software person as well and hate the electronics part.  And I can 
>prove I'm no good at it...last night I was getting really weird 
>results.  I tested the pressure sensor this morning and I apparently 
>burned it up at some point.  The pressure sensor is no longer producing 
>an output voltage.  I used both my ac/dc converter and tested it with a 
>car battery to double check.
>
>sigh....
>
>
>
>On 10/24/2011 12:38 AM, irox wrote:
>> Hi Jon,
>>
>> what is the input voltage range of the ADC?
>>
>> If it's 0-5v, which when mapped to a 1-4v scale it
>> gives 819 useful discrete values (0-1v is not used).
>> Each step would represent 1.22 psi.
>>
>> According to the PDF, the accuracy of the sensor
>> is +/-0.5% for the 1000psi range.  Which give +/-
>> 5psi error.  Or +/- 4 step/discrete values read on
>> the ADC.
>>
>> Unless it's a really high end ADC, you can probably
>> discount the least significant bit.  I've found, even
>> when spending $100 on a ADC, if I want 12bit accuracy,
>> buy a 16bit converter.
>>
>> I think what you are seeing would match what I would
>> expect.
>>
>> I guess the read mystery is why the volt meter is
>> showing a stead reading and the ADC isn't.  How
>> accurate is the volt meter?  What type of ADC is in
>> the volt meter and does the right most digit really
>> count for anything?  I tend to kill volt meters, so
>> I buy cheap ones and find the last digit is more
>> for show than use...
>>
>> To really find out what is happen, I would look to
>> borrow an oscilloscope and see what is happening with
>> when hooked up to the Arduino and compare that to the
>> voltmeter.
>>
>> Ultimately, I would just solve this in software (as best
>> as I could).  Over sample the sensor voltage (take 100
>> or more samples per second) and average that.  Since
>> the temp sensor are steady (and unlikely to change very
>> quickly), you could sample them once every few seconds
>> and use the CPU cycles for more pressure sensor readings.
>> How many times a second are you sampling?  How many times
>> a second can you sample if you didn't do anything else?
>>
>> There is another algorithm I use a lot in situations
>> likes this:
>>   - Calculate the your normal wobble/wonder/variation. (call it "W")
>>   - Keep the last "X" sample average (X = 100 or how ever many works)
>>   - If the delta between the latest sample and average is less
>>     than "W" then discard it as noise, otherwise update the average.
>>   - Display the average.
>> I normally have to tweak this depending on what I am sampling,
>> how often and accurate I can sample it and what I am doing with
>> the results.
>>
>> Hope that helps.  I am mainly a software guy, probably fixing
>> my hardware mistakes with software...
>>
>> Your project looks great!
>>
>> Cheers!
>>    Ian.
>
>
>
>
>************************************************************************
>************************************************************************
>************************************************************************
>The personal submersibles mailing list complies with the US Federal
>CAN-SPAM Act of 2003.  Your email address appears in our database
>because either you, or someone you know, requested you receive messages
>from our organization.
>
>If you want to be removed from this mailing list simply click on the
>link below or send a blank email message to:
>	removeme-personal_submersibles@psubs.org
>
>Removal of your email address from this mailing list occurs by an
>automated process and should be complete within five minutes of
>our server receiving your request.
>
>PSUBS.ORG
>PO Box 53
>Weare, NH  03281
>603-529-1100
>************************************************************************
>************************************************************************
>************************************************************************
>




************************************************************************
************************************************************************
************************************************************************
The personal submersibles mailing list complies with the US Federal
CAN-SPAM Act of 2003.  Your email address appears in our database
because either you, or someone you know, requested you receive messages
from our organization.

If you want to be removed from this mailing list simply click on the
link below or send a blank email message to:
	removeme-personal_submersibles@psubs.org

Removal of your email address from this mailing list occurs by an
automated process and should be complete within five minutes of
our server receiving your request.

PSUBS.ORG
PO Box 53
Weare, NH  03281
603-529-1100
************************************************************************
************************************************************************
************************************************************************