| Author |
Message |
|
|
Posted: Apr 16, 2012 - 07:51 PM |
|

Joined: Apr 12, 2012
Posts: 7
|
|
Hi there!
I had ordered a sample of ADS7813 form TI and tried to get work with an Arduino board. And my problem is i cant get out a better resolution than two decimal place. The first 10 bit seems ok, from MSB, but the last 6 bits are togglin. Here are my conversion results:
3.2569353 10100110101110
3.2569353 10100110110101
3.2584612 10100110110110
3.2599871 10100110111001
3.2609026 10100110110101
3.2609026 10100110111000
3.2609026 10100110110001
3.2657856 10100110110100
3.2599871 10100110110100
3.2566301 10100110110001
3.2526626 10100110110100
3.2566301 10100110110101
3.2593767 10100110101100
3.2609026 10100110110110
The first column values is in voltage the second columns values is the conversion result.
I bulid the circuit in a bread-board i used the same capacitors as in the datasheet i tried another input values and i got the same results. I tried with battery or with lab supply but i got the same result.
here is my code in Arduino (same as C):
digitalWrite(CLOCK,LOW);
digitalWrite(CONV,LOW);
//this start the conversation
delayMicroseconds(1);
digitalWrite(CONV,HIGH);
while(busy==0){ // while BUSY is high still wait
busy=digitalRead(BUSY);
}
for(int i=0;i<16;i++){ //here start the read of the 16 bit
digitalWrite(CLOCK,HIGH);
x[i]=digitalRead(DATA);
delayMicroseconds(20);
digitalWrite(CLOCK,LOW);
}
for(int j=1, c=16384j<16;j++,c=c/2){ //this is how i piece together the 16 bit data in decimal, 15bit because the firs is the sign bit
val+=x[j]*c;
}
val=5*val*(double)1/32767; //this is how i convert the number to voltage with +-5V input range
I tried to contact with TI community, but they sucked.
What did i mess up?
Cheers
Robert |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 03:40 AM |
|

Joined: Dec 30, 2004
Posts: 8763
Location: Melbourne,Australia
|
|
Board layout is critical for low noise operation. What is the source of the voltage you are measuring? What makes you sure that the ADC is not telling you the truth? Realise that once you start getting into sub 1mV values, that there are a number of physical effects that come into play. One is thermocouples that cause temperature related drift. The major contributor is noise.
Put your cell phone near your circuit and watch it go stupid as the phone reports in. |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 06:33 AM |
|

Joined: Oct 31, 2009
Posts: 148
Location: Vancouver, WA, USA
|
|
|
4ckatro wrote:
And my problem is i cant get out a better resolution than two decimal place. The first 10 bit seems ok, from MSB, but the last 6 bits are togglin.
From the ADS7813 datasheet:
Quote:
SENSITIVITY TO EXTERNAL DIGITAL SIGNALS
All successive approximation register-based A/D converters are sensitive to external sources of noise. The reason for this will be explained in the following paragraphs. For the ADS7813 and similar A/D converters, this noise most often originates due to the transition of external digital signals. While digital signals that run near the converter can be the source of the noise, the biggest problem occurs with the digital inputs to the converter itself.
...
For the ADS7813, error correction is done when the tenth bit is decided. During this bit decision, it is possible to correct limited errors that may have occurred during previous bit decisions.
However, after the tenth bit, no such correction is possible.
This seems to indicate that your problem is external noise.
Also, in the schematic you provided, I don't see a capacitor on the input from the pot. Adding one might also help. |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 06:41 AM |
|

Joined: Apr 12, 2012
Posts: 7
|
|
Thanks for fast reply!
I found a description about i should use an RC filter and a OP amp on the analoge input for signal conditioning. I will try that method then i will back.
Btw i tried to measure a cellphone battery or a lab supply voltage but i got the same result. |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 02:29 PM |
|


Joined: Dec 11, 2007
Posts: 6848
Location: Cleveland, OH
|
|
|
Quote:
I found a description about i should use an RC filter and a OP amp on the analoge input for signal conditioning.
This, unfortunately, won't change the problem you are having.
The RC filter is based on digital sampling theory. High Frequency signals, where the frequency components are higher then 1/2 of the sampling frequency, appear as low frequency signals when sampled. This can give errors in the measurements.
See Wiki Nyquist-Shannon Sampling Theory for a technical discussion on this.
A simplier example is shown here: National Instruments: Bandwidth, Sample Rate, and Nyquist Theorem .
The op-amp is to buffer the LPF and probide a low impedance signal source to drive the ADC.
JC |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 02:36 PM |
|


Joined: Apr 20, 2007
Posts: 6066
Location: Long Island New York
|
|
You will NEVER get ALL the bits to sit still no mater what filtering you add. The higher the resolution the more 'jumpiness' you will get because the last few bits will jump around from the slightest input variations. Even 8 bit A/D's do this, but not as bad because the resolution/bit is not as high. Keep in mind you are showing results 7places to the RIGHT of the decimal. just about anything is going to make those bits move around.
What you can do is set a 'reference zero' where you ignore the last couple of bits. This cn be accomplished by a bitwise AND to remove the offending bits, then shift them right xBITS to get your 'stable' reading.
Another option is to sample the input readings and take an average. More code to write.
Don't get me wrong, adding input filtering will help, but it will not eliminate the jumping.
Ask yourself, "DO I really need 7 places to the right of the decimal?" |
_________________ Jim
I have decided that I am no longer going to plan anything in advance. In a court of law this is called Pre-Meditated, and does not look good for the defense.....
Timer function not working properly? Check CLKDIV8 Fuse first
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 02:54 PM |
|


Joined: Feb 19, 2001
Posts: 25902
Location: Wisconsin USA
|
|
|
Quote:
Ask yourself, "DO I really need 7 places to the right of the decimal?"
And if you do, you need a "squeaky clean" analog subsystem. There can be >>no<< ripple in power supply or ground or reference or signal. And that ripple can easily be from external sources as well as internal (e.g. power supply). Breadboard setups are likely to never be squeaky-clean. |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 03:26 PM |
|


Joined: Dec 11, 2007
Posts: 6848
Location: Cleveland, OH
|
|
And, after you add whatever "averaging" you want for several samples, then one can add yet another layer with a "window". If the newest value, (already averaged), deosn't vary my more than X amount, then just keep displaying the previous value. This can be used to get rid of the last digit(s) jitter, bouncing back and forth between two values, that simple averaging does not eliminate.
JC
Edit: typo |
Last edited by DocJC on Apr 17, 2012 - 07:01 PM; edited 1 time in total
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 03:30 PM |
|


Joined: Nov 01, 2005
Posts: 6323
Location: Hilversum - the Netherlands
|
|
| OP wrote:
Quote:
I bulid the circuit in a bread-board i used the same capacitors as in the datasheet i tried another input values and i got the same results. I tried with battery or with lab supply but i got the same result.
With a 16 bit A-to-D on a breadboard it is almost impossible to get 16 bit accuracy. The pot gets the 5V and Gnd from the Arduino. That's a no-go. The use of a floating cellphone battery is better when you do these accurate measurements. But then still: where gets the ADS7813 the power from ? And how and where do you connect the cellphone battery ?
Signal routing as well as power routing is what this is all about.
You need a floating powersource for the ADS7813. Most powersupplies have their ground (or negative) output connected to safety ground. So that does not float. Your PC does not float either: with as a result: a groundloop. So noise and hummm.
Alternative: use a laptop running of the built-in battery. No other connections allowed, except for the Arduino USB. Power the Arduino from the laptop.
Connect the ground from Arduino to Ground of the ADS7813. Power the ADS7813 from a GOOD lab powersupply (Which doesn't have to float now since the laptop is floating). Use proper decoupling.
Disconnect the ISP-programmer (if you use that)
Add 330 Ohm resistors in all digital signal lines between Arduino and breadboard.
Connect the cellphone battery to pins 4 and 8 of the ADS7813, but only when the lab-powersupply is on !
Now test again. I cannot predict if you will achieve 16 bit accuracy with this setup. But the results will be much better ! |
_________________ Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 05:57 PM |
|

Joined: Apr 12, 2012
Posts: 7
|
|
|
Quote:
This, unfortunately, won't change the problem you are having.
You right, i tried and i got the same problem.
Quote:
You will NEVER get ALL the bits to sit still no mater what filtering you add. The higher the resolution the more 'jumpiness' you will get because the last few bits will jump around from the slightest input variations. Even 8 bit A/D's do this, but not as bad because the resolution/bit is not as high. Keep in mind you are showing results 7places to the RIGHT of the decimal. just about anything is going to make those bits move around.
I had used a 12bit Max186 ADC on protoboard and i got the results 5-6 places accurate on the right of dec. That is why i thought the ADS7813 would work on protoboard.
Maybe i not need a 6-7 places accurate on the right of the decimal but if i had this IC why shouldnt i use it with the best resolution.
Quote:
There can be >>no<< ripple in power supply or ground or reference or signal. And that ripple can easily be from external sources as well as internal (e.g. power supply).
I tried to change the supply. With a laptop battery + 7805 same result. I tried with a lab supply same thing..
Quote:
Add 330 Ohm resistors in all digital signal lines between Arduino and breadboard.
Connect the cellphone battery to pins 4 and 8 of the ADS7813, but only when the lab-powersupply is on !
I will try it! But did you mean i shoulld direct connect the resistor between Arduino and breadboard or pull up this line to 5V?
At worst case i will make a PCB layout and build it. But i still hope it will work on protoboard well, because this AD would be a little piece of the measurment equipment.
Thanks to all for responding i will think about these things then will back.
PS: Sorry my bad english  |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 08:27 PM |
|


Joined: Nov 01, 2005
Posts: 6323
Location: Hilversum - the Netherlands
|
|
|
Quote:
I will try it! But did you mean i shoulld direct connect the resistor between Arduino and breadboard or pull up this line to 5V?
in between, IN the line, so in series. Close to the Arduino, that's the best.
I am really surprised that the best you can achieve is 10 bits. I think you need to post a photo of the setup that performs best. We then can try to spot the flaw. |
_________________ Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 09:17 PM |
|

Joined: Apr 12, 2012
Posts: 7
|
|
| On thursday forenoon i will be in the lab and i will try it. I will take some photos then i'll back. |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 11:49 PM |
|


Joined: Nov 01, 2005
Posts: 6323
Location: Hilversum - the Netherlands
|
|
Attached a sketch of a setup that *should* give you better results. This sketch is a drawing of the setup I described earlier.
Make sure you use all the capacitors that are recommended in the datasheet of the ADS7813.
If you replace the clean PSU with a laptop-battery, followed by a 7805 or alike:
1. Don't make shorts !
2. Add 2 capacitors at In and Out of the voltage regulator: a tantalum cap in parallel with a ceramic one.
Good luck !
Edit: there is a lot of valuable info in the datasheet of the BurrBrown datasheet of the ADS7813. It also explains why less significant bits are jittering. |
_________________ Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
|
| |
|
|
|
|
|
Posted: Apr 18, 2012 - 03:42 AM |
|


Joined: Apr 20, 2007
Posts: 6066
Location: Long Island New York
|
|
Nard,
That CAD software package you used for the schematic is JUST what I have been looking for. What is the name and how much?
I have been using PADSLogic for so long, it would be nice to have a decent software package. |
_________________ Jim
I have decided that I am no longer going to plan anything in advance. In a court of law this is called Pre-Meditated, and does not look good for the defense.....
Timer function not working properly? Check CLKDIV8 Fuse first
|
| |
|
|
|
|
|
Posted: Apr 18, 2012 - 01:59 PM |
|


Joined: Nov 01, 2005
Posts: 6323
Location: Hilversum - the Netherlands
|
|
Glad you ask that, Jim.
It's called P&P and has been around for ages. There are an awfull lot of versions around.
Nice features are:
1. Direct printing
2. Freedom of shapes, lines and fonts
3. Easy to correct/adapt the design
4. Very well protected against copying: the source will be yours for always, unless you send it someone else: so it is transferable to another author, but only if *you* choose to
Drawbacks are:
1. No re-scaling, no re-draw. But there is a workaround using scissors and a fresh sheet.
2. Not all fonts are optimized for reading.
I have been using it for years and quite happy with it.
Check it out !
Nard |
_________________ Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
|
| |
|
|
|
|
|
Posted: Apr 18, 2012 - 02:55 PM |
|


Joined: Apr 20, 2007
Posts: 6066
Location: Long Island New York
|
|
 |
_________________ Jim
I have decided that I am no longer going to plan anything in advance. In a court of law this is called Pre-Meditated, and does not look good for the defense.....
Timer function not working properly? Check CLKDIV8 Fuse first
|
| |
|
|
|
|
|
Posted: Apr 19, 2012 - 03:44 AM |
|

Joined: Jul 21, 2005
Posts: 1373
|
|
Breadboard is very tough to get anything accurate, 10 bits is actually very decent on breadboard.
My preference is integrating and Delta Sigma ADCs for high resolution. SAR is too noise prone. |
|
|
| |
|
|
|
|
|
Posted: Apr 19, 2012 - 05:18 AM |
|


Joined: Jul 02, 2005
Posts: 5939
Location: Melbourne, Australia
|
|
I have two cad methods worth mentioning; LTS&S and HTS&S. The maximum lifetime of the images created with LTS&S is about 6 hours even on weekends.  |
_________________ Ross McKenzie
ValuSoft
Melbourne Australia
|
| |
|
|
|
|
|
Posted: Apr 19, 2012 - 04:58 PM |
|

Joined: Apr 12, 2012
Posts: 7
|
|
Well, i tested the circuit with the offered method and i didnt get a better res. I used the laptop usb 5V for the arduino with unplugged charger, the adc was supplied with a lab supply. I connceted the USB gnd with the Lab supply GND. The measurment voltage was a battery. A took some photos. And i used 3 330 resistor to the CLOCK,DATA and CONV line.
 |
|
|
| |
|
|
|
|
|
Posted: Apr 19, 2012 - 11:37 PM |
|


Joined: Nov 01, 2005
Posts: 6323
Location: Hilversum - the Netherlands
|
|
Thanks for the detailed decription and pictures, guys.
toalan wrote:
Quote:
My preference is integrating and Delta Sigma ADCs for high resolution. SAR is too noise prone.
That's a good point: successive approximation is fast but very sensitive for noise. In the datasheet it's very well explained. Delta Sigma ADCs are better
Back to the setup: I spot a few possible causes for the jitter.
1. PSU is grounded, I presume. And the oscilloscope as well. Same problem why I recommended a floating laptop. Take the scope-probes off, including the groundclips when checking the jitter.
2. Wires from the digital side of the ADS7813 "fly over" the analog circuit. And induce noise there.
3. I think you're using tinned stranded wire for the connections. There is always flux residu on the tinned ends. Noisy. Same for the tin-oxide: noisy as well. Use solid wire. With clean ends. And a good breadboard.
4. There is no decoupling close to the Vcc ( 16 ) and Gnd ( 8 ) pin of the ADS7813. Place those capacitors diagonally over the DIP-package.
5. Wires from the cellphone battery are too long for this purpose. And add a capacitor from R3in to pin 8.
I will get back to this tomorrow (Saterday)
Bedtime here.
PS In the meantime: make a program that spits the conversion results from the Arduino to a PC, running a terminal program. Use the highest baudrate that is possible. Each result is (between -32768 and +32767) should be terminated with a <CR>.
Terminalprogram saves the incoming results in a file, with .csv as type. Import that file in a spreadsheet and make it do some statistics on the numbers. We are interested in Average value and Standard Deviation.
With this SW tool you can see the effect of each measure you take. |
_________________ Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
|
| |
|
|
|
|
|