BasicMicro - Forums

www.basicmicro.com
It is currently Sat Feb 04, 2012 7:01 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Improving accuracy of a/d conversion
PostPosted: Mon Apr 12, 2010 7:11 am 
Offline
Citizen

Joined: Wed Feb 10, 2010 1:09 pm
Posts: 16
Hello, I am curious as to what, if anything, I can change with my code in order to produce better results. We are reading an analog input from a 1-5v pressure transmitter into our Atom, and converting it to a digital value for a display. We are using a 2000psi pressure transmitter and one of our customers is only dealing with pressures within the 0-20psi range. Our values are off from actual value by around ~3-8 psi. When dealing with such a small range of low pressure, being off by that much isn't what you would want.


Our analog input is a 1-5v pressure transmitter where 1v = 0psi, 5v = 2000 psi





ADin 28,3,AD_RON,RESULT



SLOPE = ((float sizelimit) FDIV (1023.0 FSUB 203.74068)) //sizelimit is constant 2000

OFFSET = (0.0 FSUB (SLOPE FMUL 203.74068))

READING = ((SLOPE fmul float RESULT) fadd OFFSET)



We’re having trouble getting the reading to be accurate. Our values seem to be off by 4-5psi and when well site are dealing with flow pressures between 0-20 psi; that is simply too big a deviation. I assume this may have something to do with the resolution of the ADC on the chip?



Any suggestions are appreciated.

Thanks,


Top
 Profile  
 
 Post subject: Re: Improving accuracy of a/d conversion
PostPosted: Mon Apr 12, 2010 7:25 am 
Offline
Citizen

Joined: Wed Feb 10, 2010 1:09 pm
Posts: 16
For example; right now at 1.029v input from the pressure transmitter, which on a 0-2000psi gauge, 1-5v transmitter, our PSI should read 14.5v but instead we are reading 7.9 psi.


Top
 Profile  
 
 Post subject: Re: Improving accuracy of a/d conversion
PostPosted: Mon Apr 12, 2010 11:55 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 784
Location: Temecula, CA
1. You should be looking at the raw AD values first and making sure they are what you expect. If they are the problem is probably error in the floating point math. The floating point math is only 32bits which means there can be a lot of error in it. It's good for about 4 to 5 decimal places but errors at that level when multiplying and dividing can add up.

I suspect however it is AD conversion errors. AD conversion isn't perfect. The capacitance of your input signal can have a major effect on accuracy. Read the Microchip data sheet for the specific chip your module is using(older ones use 16F876/7, newer ones use 16F886/7. Microchip also has a datasheet specifically on AD conversions.

Another thing oyu can do(which I emailed you about) is you can sum multiple readings and decimate the sum until you get a solid reading of higher resolution. For example sum 64 readings and decimate by right shifting 4 times will give you 12bits worth of data that should be very accurate.

If you still get consistently higher readings you may need to linearize your input signal. For example at very low AD values you may need to scale by 1.5 while at higher readings you may not need to scale the values at all.

_________________
Nathan Scherdin
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


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 © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO