2

I'm using a 12 bit ADC (MAX1270), SRAM (23LC1024) and PIC18f4550 to measure temperature transient at the output of an RTD. The communication protocol is SPI. The voltage is sampled and sent to PIC, and is saved in SRAM. At the end of the experiment, the data is read back from SRAM, sent to desktop PC via UART and received using HyperTerminal.

The issue: The data read has periodic fluctuations- at an interval of around 2.5 sec. If I probe the ADC input pin with a Digital Storage Oscilloscope in High Resolution mode, the voltage variation is smooth without any fluctuation. Any idea what the problem could be?

x- axis: Interval is 50 ms. The fluctuation occurs roughly every 50 counts (50 * 50ms = 2.5 sec).

y- axis: Voltage

Plot

Edit 1: Sample and average technique is used to obtain ADC data: 16 consecutive samples are taken, sorted in ascending order and the extreme four values are discarded. The middle 8 samples are then averaged to get the final value. This process repeats itself every 50 ms (a timer interrupt is configured such that the sampling takes place every 50 ms in the main routine).

Edit 2: A 40mHz sinewave (+10V to -8V) was applied to the input of the Opamp buffer feeding the ADC. Please refer the attached image. https://i.stack.imgur.com/f1cm5.png The waveform is OK except for the first 4 seconds, in that it shows some fluctuation. The ADC is directly connected to the opamp buffer without a RC network. How big a problem can it cause? https://i.stack.imgur.com/LiUAE.png

Edit 3: I probed the RTD transient with the DSO in normal mode, without post-sampling processing (one ADC sample every 50 ms, no sample and averaging). The DSO output is in blue and ADC in red. There is an offset between the two. What could be the reason? The fluctuation seems to have gone, but I need to verify it by testing with another RTD. REF pin of the ADC is at 4.085V as against 4.096 given in datasheet. REFADJ pin is at 2.492V. The ADC is used in internal reference mode. enter image description here enter image description here

Please Note: I won't have access to the test setup for the next 5 days. I'll get back with the results of your suggestions as soon as I get access.

Limpy
  • 109
  • 1
  • 8
  • Have you tried sampling at different intervals? – Ignacio Vazquez-Abrams Sep 28 '14 at 15:58
  • Not yet. How could that cause the problem? – Limpy Sep 28 '14 at 16:03
  • 1
    You could be seeing induced voltages from another device with periodic emissions. Changing the sampling interval will allow you to prove this either way. – Ignacio Vazquez-Abrams Sep 28 '14 at 16:05
  • Ok. I'll try and get back. – Limpy Sep 28 '14 at 16:17
  • Also, try to reduce the number of 'moving parts'. Don't use the external RAM. Instead, have the program wait a couple of seconds, then store into the PICs on-board RAM. It is unlikely to fix it. However fewer parts and less code might help. – gbulmer Sep 28 '14 at 16:37
  • A circuit would possibly spill the beans. – Andy aka Sep 28 '14 at 18:57
  • 2
    It could be a mains interference beating with sampling interval. – venny Sep 28 '14 at 19:05
  • Um. Maxim applications engineer here. How exactly are you driving the analog input? Are you using an opamp buffer, or just connected the resistive RTD directly into the resistive input network of the MAX1270? See figure 4 of data sheet http://pdfserv.maximintegrated.com/en/ds/MAX1270-MAX1271.pdf – MarkU Sep 29 '14 at 01:35
  • Hi Mark, I'm using an opamp buffer (voltage follower) to drive the ADC input. All unused ADC input pins are tied to analog ground. I've also set SPI CPOL = 0 & CPHA = 0, as given in the datasheet. – Limpy Sep 29 '14 at 03:54
  • Is the RTD temperature sensor in free air (room temperature), or is it immersed in a constant-temperature reference (such as a dish of liquid water and ice) -- given the 2.5sec periodicity, could it be ambient air temperature fluctuation? Do you have another temperature measurement tool (like non-contact IR probe) to see if temperature variation correlates with the noise? If you replace the RTD with a dead short, and use one of the bipolar input ranges, what does the raw ADC output look like? – MarkU Sep 29 '14 at 05:33
  • 1
    Heh, does the data look the same when the oscilloscope is connected? And if you see 'no fluctuations' on the 'scope you're not looking hard enough-there will be some noise at least. – Spehro Pefhany Sep 29 '14 at 12:45
  • About the opamp buffer -- which manufacturer and part number? And what values are you using for the series-R-shunt-C input network between the opamp and the ADC? The SAR equivalent C can "kick back" pretty hard (charge injection into the input) when the acquisition time begins, and opamp must settle within 0.5LSB before end of acquisition time. Been years but my recollection is these ADCs with internal range select resistors seem to "kick" harder than most. – MarkU Sep 29 '14 at 20:09
  • I can't believe no one has said anything about using high resolution mode on the scope. That mode doesn't always tell the full story. Put it in normal mode, with no averaging. – Matt Young Sep 30 '14 at 15:38
  • The RTD is kept immersed in water at room temperature. The voltage fluctuation according to the ADC is about 80 mV (figure 1). As for the R-C network, I guess I made a design error. The ADC input pin is directly connected to the opamp output. How big an error is it? A correction to the SPI polarity and phase: I'm using CPOL = 0 and CPHA = 1. The ADC does not respond to (0,0) setting on the microcontroller. Please go through "Edit 2" of my first post. Thanks. – Limpy Sep 30 '14 at 15:44
  • Matt: Never thought of that. Will check it out. @Spehro: 'll verify and post the observation. Thanks. – Limpy Sep 30 '14 at 15:56
  • I still don't see which opamp you are using; it really makes a difference with this ADC due to the internal resistor network. We tried several different opamps during development of the MAX1270 Evaluation Kit, the one that worked the best was LT1013/LT1014. There are probably better op amps available today, but I'd look for at most 2us small-signal transient response time or faster. The oscilloscope might not be able to see the charge injection kickback event... but the ADC sees it. – MarkU Oct 01 '14 at 08:17
  • The opamp is [LT1114](http://cds.linear.com/docs/en/datasheet/111214fb.pdf) Please go through "Edit 3" of my first post. – Limpy Oct 02 '14 at 02:04
  • In response to your last edit, perhaps your post processing is wrong – Scott Seidman Oct 02 '14 at 10:33

2 Answers2

4

Your signal chain is quite complex, and you can have problems at every step, or even multiple problems. You have analog circuitry, into external ADC, through a PIC, into SRAM, back through the PIC, at some point employing a highly nonlinear filter, out through UART and into hyperterminal. Debugging this involves baby steps, which pretty much means you need to eliminate all the shortcuts you took getting to this point.

Where I would start would be to verify everything one step at a time. Start by sampling a CONSTANT voltage, then a sine wave out of a function generator, and make sure you understand what you see.

Once that makes sense to you, LOOK at your analog input with an oscilloscope, and make sure you understand what you see with that. There is no substitute for this. There are reasons why we use bench instrumentation, and this is one of them.

Next, find a way to get rid of all your post-sampling processing, and look at the data in as raw a state as you can. You are doing highly nonlinear processing. When you do this sort of stuff, when it doesn't work you go back and look at the whole process with a microscope.

I suspect you might have an extremely noisy signal, you're aliasing it down by not sampling fast enough, and the non-linear processing is confusing the issue.

Scott Seidman
  • 29,274
  • 4
  • 44
  • 109
  • Please go through Edit 2 of the first post. The obtained waveform involves post-sampling processing. – Limpy Sep 30 '14 at 16:05
  • 1
    @Limpy You need to look at things on an oscilloscope with a time scale that allows you to see noise clearly. Also, you don't necessarily want post-sampling processing as you try to debug this. It complicates things. – Scott Seidman Sep 30 '14 at 16:13
1

Are your power rails clean? The periodic distortion on the signal suggests some load might be disturbing the power rails, causing a "ground bounce" on either your ADC input or reference.

kabZX
  • 612
  • 4
  • 10
  • Power rails are clean, as measured by a probe. The ADC uses internal reference. Also, as pointed out before, the ADC input pin is clean, as measured by the probe. – Limpy Sep 28 '14 at 16:12
  • Try the different sampling rate as Ignacio suggests. If you get the same time period you need to look for something that is switching at the frequency. – kabZX Sep 28 '14 at 16:16
  • I was thinking of something along these lines: http://electronics.stackexchange.com/questions/112625/weird-samples-from-sar-adc – Limpy Sep 28 '14 at 16:23
  • Yes thats another possible explanation. You should check your SPI first. Although, if your SPI is not set up correctly you should not be able to communicate with the ADC at all, right? – kabZX Sep 28 '14 at 16:25
  • @kabZX Did you find the problem? Was the SPI connection? – bardulia Aug 28 '23 at 20:16