Hi Ian,Lots of good stuff to consider, thanks for the info. You are correct regarding the resolution of the ADC and I wish the Arduino board came with at least a 12 bit ADC, however Al's idea of dropping the sensor measurement to 500psi or even 300psi would also produce better resolution. A 500psi sensor would resolve to 1.09 foot resolution which I think is all that is needed. I'm not sure that 499.3 feet on the display is any more useful than 499 or 500 whichever way rounding takes place. Besides, most psubs have a 3-4 foot deviation in depth between the top and bottom of the vessel anyway. A 500psi sensor would max out at 1123 foot depth in seawater which would cover 99.999% of psubbers anyway, so I probably overreached by purchasing a 1000psi sensor. But, I'm getting a free replacement Thursday so I'm stuck with it for the prototype anyway.
I understand the map() function didn't change the resolution of the ADC but it did provide me with a tool to smooth out the raw values I was getting. At that point I was moving toward a software solution (just before the sensor burned out). You have an interesting theory regarding whether the variations are high-frequency or not. It looks like I averaged 10 times a second not 20. I ran a loop of 20 iterations with a 100 millisecond delay between, then took an average on every iteration and returned "r" after the loop. I did try changing the number of iterations and the delay, but it didn't seem to make any difference.
for(i=0; i < 20 ;i++) { r = r + ((analogRead(pressure)-r)/i); delay(100); }I did not watch the data from each iteration of the loop, however as I noted previously when I got the hardware to a point where the ADC was producing a consistent span of only three values (210, 211, 212) , averaging provided no benefit. I was just as likely to get the same variation by averaging as I was by raw reads. For the most part, I was getting 210 for eight to ten reads (one read per second) and then a 211 would pop up. Back to eight reads of 210, and then a 211. Occasionally, a 212.
I can access the board via serial port and display data that way, so when I get the new sensor I'll try looping with a 10 or 20 millisecond delay and see what the short term readings look like, and also hook up the voltmeter as you suggested. The bypass capacitor won't hurt so I'm planning on adding that into the mix as well.
The only reason I chose the Arduino board is because it is cheap, appears to be robust, and has a ton of libraries and community support not unlike the Linux world, that make working with the hardware very easy. The goal here is to get a prototype working reliably and then publish a parts list and software code on the website so that others can build it if they want to.
Jon On 10/26/2011 12:05 AM, irox wrote:
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.
************************************************************************ ************************************************************************ ************************************************************************ 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 ************************************************************************ ************************************************************************ ************************************************************************