LM35 data acquisition system.

Hai,

I am new to Usenet groups. I so far used only bulletin boards.Forgive me if anything is wrong in my operating procedure. - Thanks

I need to monitor temperature from 12 Lm35s, So I read them one by one sequentially. My hardware line up is like this . Lm35 at the end of a 2 meter shielded 2+1 cable- input to a HEF4067 multiplexer - and from that it goes to a low pass sallen key 2 pole butterworth filter made around OP07 opamp The ADC is from a PIC18F452. with the intention of filtering out even AC hum i kept the cut off frequency of LPF at around 20HZ(unaware of the settling time issue of LPF)

For the software part I tried to made a interrupt in every millisecond, on the first state I select the channel through multiplexor- next interrupt I start conversion - and on next I read data. on next interrupt the same process is done for the next LM35. But the filter cannot settle at this rate so obviously values are not anywhere near expected. So I incresed the time between interrupts and somewhere in 100s of millisecond I am getting satisfactory results. I would like to know- What will be the cut off frequency for LPF which is optimum in such a setup using LM35 and long cables? I have read about some precautions to take while using cables for LM35. Actually I can afford more time between readings but I am interested to know How these things are done professionally. Thanks for reading.

Serpent

=93Not by accident, you may be sure, do the Christian Scriptures make the father of knowledge a serpent-slimy, sneaking and abominable.=94 Henry Louis Mencken

Reply to
Serpent
Loading thread data ...

You're doing fine so far. Most folks on USENET will be nice to the newbies, offering either kind advice or none at all. Some will jump on you with knives (or at least obscenities) in hand, but they'll do that to the long-timers, too -- think "USENET kook" when you get a reply like that.

This sort of thing has a lot of different solutions, some better than others. Even after you weed out the universally bad techniques, there will still be a lot of different ways to go depending on what your particular needs are.

One thing you can do, at the expense of some board space and power use, is to have a bunch of filters, one for each channel, then switch after the filter.

My preferred method in cases like this is to use an integrate-and-dump filter. I almost always implement this with heavy assistance from the processor, by sampling fast through a wide anti-aliasing filter and averaging all of my samples for some period. Averaging over some integer number of periods like this effectively puts a notch at the period and all of it's harmonics, while guaranteeing that there is no disturbance at the beginning of your sampling run to settle out.

In this case, you want to notch out 60Hz and it's harmonics, so you'd want to choose periods that are even multiples of 1/60th of a second for

60Hz areas and 1/50th of a second for 50Hz areas. 1/10th of a second is nifty because it accommodates both 50 and 60Hz*, but that really pushes up your sampling rate.

You may well want to use an anti-aliasing filter, and that filter will have it's own settling time that you'll have to take into account. But it'll settle faster than your 20Hz LPF, and you'll be able to pick a compromise between the ADC sample rate and the filter settling time, which is nice.

Pay close attention to the settling time vs. your desired accuracy: looking at the filter step response on an oscilloscope will make it appear to be all settled out long before it's settled out good to 16 bits.

  • But not 25Hz, if there are even any such systems left in the world.
--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

LM35's are tricky. They are prone to latchup and don't like capacitive loading or charge injection spikes from multiplexers.

I'd suggest a lowpass filter per LM35, namely a series resistor at the LM35 and a cap to ground at the other end of the cable, at the mux. So now the mux switches fast and the cable capacitance is isolated from the LM35. Be aware of mux charge injection errors.

Don't run the LM35's over 5 volts! And I'd avoid the optional negative pulldown, as it tends to make them latch up. Use an LM34 if you need to go below 0 C.

Bob Pease promised me he'd fix the LM35. I don't suppose he will now.

The SPI parts, like LM71, are handy. You just bit-bang them.

John

Reply to
John Larkin

Don't use LM35 - it is not good for several reasons. Use LM335 instead. Bypass each of LM335s with a capacitor of ~ 1uF, sample them with the multiplexed ADC. That's it. Do all of the filtering in the digital domain. The simple averaging per ~1 second will take care of the AC pickup; there is no point to have the response any faster. And don't forget to protect the inputs.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

You don't need to sample that often--the temperature isn't going to change that quickly.

If speed's your goal a filter per input lets the filters settle maximally, but you can get very decent 60Hz rejection by just taking two samples 8.333 milliseconds apart & averaging them.

Or you can take a series of readings and integrate them in software. For example, at 1/8th of a line-cycle intervals, stuff an 8-sample circular buffer with the latest reading, keep a running total of them, divide by 8, and you've got a pretty good 60Hz notch filter.

Even better: watch your cables and shields, and avoid picking up 60Hz in the first place.

Cheers, James Arthur

Reply to
James Arthur

I am new to Usenet groups. I so far used only bulletin boards.Forgive me if anything is wrong in my operating procedure. - Thanks

I need to monitor temperature from 12 Lm35s, So I read them one by one sequentially.

If your willing to look at a different method Maxim has a 1wire system that I am using to monitor 13 temperature sensors. I have had it running fine for over two months--- until four days ago when I had some computer problems (unrelated to 1 wire) I hope to get things straightened out soon. The system uses one pair to of wires with all sensors connected in parallel. It requires a 1 wire serial adapter (about $28.00) and sensors (about $4.00 ea) There are several software options I chose Lampomittari because I liked the display. It was a pain for me to work through the software but I did get it to do exactly what I wanted. It has high and low temp alarms visual and audio.

Here's info about the sensor.

formatting link

Here's the 1 wire serial adapter.

formatting link

Here's a company the sells parts. ( I haven't bought from them) I ordered directly from Maxim, package came from Malaysia.

formatting link

And here's a group that can be helpful to get your system working.

formatting link

Warning, I'm sure many will jump in and tell how bad Maxim is with customer service and parts availability. That may be their experience, my one time purchase worked out fine.

So I plugged the 1 wire serial adapter into my RS232 port attached the RJ11 coming from my string of 13 sensors and then #&$@ with software until I got it working.

Just another option. Mike

Reply to
amdx

The LM35 can pull up pretty well but pulls down wimpily. So if there's any significant hum on its output, it will make temperature errors.

John

Reply to
John Larkin

Not a problem if it's under 26mV though. Oh, wait, that's BS.

Cheers, James Arthur

Reply to
James Arthur

Even worse, it's an active part.

John

Reply to
John Larkin

The other problem is that the OP is going to be measuring the temperature of the wires, the way that almost everyone using IC temperature sensors does....along with the FFT, temperature sensors are the world champion generators of reasonable-looking wrong answers.

From our discussion on this point in Dec 2007-Jan 2008,

Cheers

Phil Hobbs

Reply to
Phil Hobbs

I know it would be more expensive, but why not use that filter on each LM35 before the sampler?

Reply to
Robert Baer

Actually my system reads 12 Channels of data, current and temperature. For the current part my range is maximum 500ma with a resolution of .

1mA. I am using a current shunt plus one op07 amplifier- another OP07 to offset for my ADC input range -then a sallen- key LPF- then multiplexor and to a 13 bit ADC MCP3304. (The noise and error there is yet to seen.) That 12 channels of current sensing and conditioning hardware occupy a large PCB real estate. Moreover Temperature is not be that much critical. A slight variation of .5 or 1 degree is not an issue provided it seems to be responsive and visibly stable on display without 'jerks'. So I did choose single LPF after mux.

May I know what you mean by "through a wide anti-aliasing filter"? Is it a LPF with a cut of frequency as high as 1khz or 500Hz. It seems so for me. also what is this? "while guaranteeing that there is no disturbance at the beginning of your sampling run to settle out"? you mean providing some time for the MUX to stabilise or settle ?

s

I have 50Hz supply so need to sample at a rate of once in 20 milliseconds and take average?

What is the role of a Anti aliasing filter when I am handling DC signal ? I was thinking my LPF filter is actaully a antialiasing filter.(functionally) right?

. How to know the settling time of a filter?

Thanks for the detailed write up. I think I need to study more theory regarding wave forms or signal conditioning. sampling rate, frequency etc in this DC context confuses me little. Nice if you can link some material.

Reply to
Serpent

This is done.

No need to go below 0 Degree in my case

Thanks for the replay

Serpent

Reply to
Serpent

Let me brief what I propose to do.

As I have already made the prototype almost completely I will try to stick on with LM35 itself plus a single OP07 based LPF. (I think it can be called as sallen key anti aliasing filter ?) before the MUX. The cut of frequency of the LPF is set around 500Hz or 1KHz.(??) . The LM35 is wired on a 2+1 shield wire with 2.2K or 4k7 resisitor directly at leads of LM35 and a 2.2uF cap at the input of MUX. In software First I will select the MUX to connect the appropriate LM35- wait for the MUX to stabilise - then I read ADC exactly at

10Millisecond gap for even number of samples. say 6 8 or 10. Then average to post result. Is this the best strategy with the current hardware?

The only issue(?) is each channel gets read only once in 1.2 to1.3 seconds since I have 12 channels to read.Also I have to find enough room to talk to ADC MCP3304 through a bit banged SPI in the meantime.

Thanks for reading Serpent

Reply to
Serpent

Corection!

My LPF comes after MUX and before ADC

Thanks

Reply to
Serpent

Minor pickey point:

The caps in the Sallen-Key filter will charge up to the channel voltage. When you switch to the next channel, that charge will be shot back into the 2.2 uF cap of the new channel. That will result in a bit of channel-channel crosstalk.

You could improve it by adding an opamp follower right after the mux.

Do you really need the post-mux filter?

John

Reply to
John Larkin

Got it. Will try by introducing a opamp follower (Buffer?) after mux if needed.

I am also not sure. How can I measure or asses noise in this type of circuits? I have a PC based DSO, oscilloscope. How I can use it to see the noise presence? is it possible?

Thanks for the response. Serpent

Reply to
Serpent

Yes. By sampling fast at the microprocessor you can let your filter widen out, which means it settles faster.

"Disturbance" wasn't the best word to use, I suppose. I meant the transient that you generate in going from an input on which the filter has settled to another one on which the filter now has to settle. From the point of view of the filter it looks like a whopping big disturbance.

You need to sample some integer number of times in 20 milliseconds and average. Once in 20 milliseconds will take your 50Hz hum and alias it down to DC, which is right where you don't want it.

Your LPF is acting as an anti-aliasing filter, correct. And the role of any anti-aliasing filter when measuring DC is the same -- it's to filter out the noise at those frequencies that will alias down to the DC that you're trying to measure. That's why I like my integrated comb filter.

I don't know of material to link to, although looking through app notes of companies such as Analog Devices may help. Spelunk through the EDN web site and see what you can find by Bonnie Baker -- she's done a lot of material on data acquisition.

The important thing to remember about these "DC" signals that you're trying to measure is that after you inject noise and switch them around with a MUX they aren't DC any more. So you don't need to get wrapped around the axle over their DC-ness.

--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

Look at the MUX input, put the scope on AC, and turn the gain way up.

--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

The good rule of thumb is that a circuit with the time constant T settles to 1% accuracy in the time of 5xT.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.