op amp to PIC ADC difficulties...

Thread Starter

kutalinelucas

Joined Nov 20, 2007
98
Hi Guys

Its been a while since I've been able to get my teeth into an electronics project, and I've been loving life the past week until I hit a brick wall trying to get a sensible op amp output into the adc of a PIC18F, and I was hoping somebody would be good enough to put me on the right track

As I couldn't find anything suitable on the market, I've built a thermostat system which monitors and heats both parts of a 40kg Aluminium cast using a 150w silicon heat pad adhered to each part.

Each pad is powered by a 30v; 5A bench supply, channelled through a 10A relay which is switched by a L293D, controlled by the PIC. The PIC is controlled by a windows form C++ app through USB connectivity.

To monitor the temp of the Casts in real time, I'm using a K-type thermostat for each part, who's output is fed into a LF347N op amp, but I'm having difficulty reading any sensible data on the PIC pins.

I've tested the software by feeding the output of a voltage divider into each of the adc inputs, and I also get a linear voltage output of the op amp when I heat the thermocouple in a pan of water. I'm guessing I have some issue with signal conditioning but I think this may be beyond my ken...

I'd really appreciate a nudge in the right direction.

Thanks

Martyn

 

crutschow

Joined Mar 14, 2008
34,470
So what exactly is the problem? What voltage do you see from the op amp output? What reading to you get from the PIC?

The LF347N op amp is not designed for single supply operation so the input and output can typically go no closer then a couple volts to ground. You should use a single-supply or rail-rail type op amp.

Your posted schematic is too small to see.
 

Thread Starter

kutalinelucas

Joined Nov 20, 2007
98
HI crutschow, thanks for getting back to me. To be honest I can't even get my head around where I've ended up...If I hook the op amp output to the Adc and loop the samples, a reading is taken but is fairly nonsensical, ie, if I put a lighter to the thermocouple, or even grasp the metal I get some sort of output in my windows app...the Adc must be working because I can read the voltage off a potentiometer

I've tried so many different approaches today everything seems to be moulded into one. I could finish off the whole project in a day if I could just figure out how to present the voltage from the thermocouple on the pic port, and I was hoping somebody could point me in the direction of an omp-amp circuit which would do the trick.
 

GopherT

Joined Nov 23, 2012
8,009
I see a gain of 500 = (5M / 10k). If you have any DC off set, you will saturate your op amp. Since, as Crutschow said above, it is not a rail-to-rail input (nor rail-to-rail output), you are certainly saturating if you have a grounded reference on your (-) input.

You are better off using an inverting op amp circuit and put a pot reference on the (+) input. Then you can use gains over 15 (500 in your case). Otherwise, get a decent rail-to-rail op amp (e.g. TLC274).
 
Does the software on the PIC compensate for the volts/C of the thermocouple, the gain of the amplifier circuit, and the conversion factors for converting bits/bytes from the ADC back into volts?
 

Thread Starter

kutalinelucas

Joined Nov 20, 2007
98
II'm using 1M/10k for a gain of 100, but you're right, the output is continually saturated and I think I've come to the end of my tether, so I'll order a pile of TLC274's tonight and hope it goes more smoothly on Tuesday when I get the parts.

With the software, I'll have to come up with a look up table to convert Vin into kelvin, but I've just been trying to get any sort of logical reading up to this point.

Thanks for the advice
 

Dreso12

Joined May 19, 2013
3
Reading thermocouples in not easy as you need to use cold junction compensation or it will never work. Also you need really high gains so be ready to filter all the noise. On top of that the output of the thermocouple is not linear so you have to add compensation tables by software.

It would be much more easy to use an amplifier designed for that as analog devices AD8495. This amplifier is made for type K thermocouples, it will compensate the cold junction with an in-build temperature sensor and the output is already linearized so no necessary to add compensation tables by software.

You can find more information in Analog Devices webpage, they have many application notes about thermocouples.
 

Thread Starter

kutalinelucas

Joined Nov 20, 2007
98
Thanks for all the advice, thought I'd post my solutions to the problem, and it works sweet as a nut. The system takes continual readings from two k-type thermocouples with cold-junction compensation, and relays this data in real time to my pc. The relays (diagram 2) connect 2 150w silicon heat pads and 2 150w bench supplies. The relay is activated by the pic through a L293D, which provides power to the heater elements based on a temperature defined in a c++ app. Hope it helps somebody...

the sensor board...

[/url]
greenshot free download[/IMG]

and the complete circuit...

[/url]
image hosting site over 5mb[/IMG]

peace
 
Last edited:

Thread Starter

kutalinelucas

Joined Nov 20, 2007
98
Thanks for all the advice, thought I'd post my solutions to the problem, and it works sweet as a nut. The system takes continual readings from two k-type thermocouples with cold-junction compensation, and relays this data in real time to my pc. The relays (diagram 2) connect 2 150w silicon heat pads and 2 150w bench supplies. The relay is activated by the pic through a L293D, which provides power to the heater elements based on a temperature defined in a c++ app. Hope it helps somebody...

the sensor board...



and the complete circuit...



peace
 
Top