PIC18F4410 Analogue Input Woes

Status
Not open for further replies.

yapyapyap

New Member
PIC18F4410

Hi There,

Am new to all this PIC stuff so apologise in advance if I say anything that drives you crazy. The problem I am having is with the analogue input on this PIC, before you say it I have read the datasheet on this several times but cannot see a solution. It says in BOLD on the data sheet that the Impedance cannot be greater than 2.5Kohmes for any analogue input.

I am trying to get a pressure sensor working on this input and have used the +5v and 0v ref (the supply voltage).

Now although it said 2.5Kohmes what I am using is probably more than that as I have one resistor between ground value 2kOhmes then it is attached to the pressure sensor which itself is a variable resistor whose value changes with pressure (when no pressure is applied it is a huge resistance value). The other connector goes to +5v.

The signal wire is taken where the 2k resistors and the pressure sensor meet and goes to the PIC.

0volts----[2k]-------(Sensor Connection to PIC)------[Pressure Sensor]-------------+5v

Hence I don’t think I meet the 2.5kohme limit required so if anyone has any way of changing that let me know.

Anyway the questions if have are as follows:

1) How to solve the Impedance limit.
2) How to calculate the correct TAD to use
3) Check through my pressure sensor function and see if at least that part looks ok.

Just need to be pointed in the right direction J
Many Thanks.

//Analogue Inputs
TRISA= 1; //setting trisa as input
PORTA= 0b00000001;
//END of ANALOGUE INPUTS

void pressure_sensor(void)
{

char highpressure;
char lowpressure;
char counter;

highpressure = 0;
lowpressure = 0;
counter = 0;

ADCON1 = 0b00000000; //Switches on port AN0
ADCON0 = 0b00000000; //Set Enable A/d off
ADCON2 = 0b00100110;
ADCON0 = 0b00000001;
ADCON0 = 0b00000011;

while ((ADCON0 != 0b00000010)&& (counter !=1) && (ADIF==1) ){
highpressure = ADRESH;
lowpressure = ADRESL;
putch('<');
putch(highpressure);
putch(lowpressure);
putch('>');
ADIF =0;
ADCON0 != 0b00000000;
counter = 1;
}
 
Hence I don’t think I meet the 2.5kohme limit required so if anyone has any way of changing that let me know

The source resistance is equal to 2K in parallel with the pressure sensor's resistance. This is known as the Thevenin equivalent resistance. It is definitely less than 2.5K.

However, If you really want to reduce the source resistance even further, you may attach a unity gain buffer amplifier (A.K.A. a source follower) between it and the PIC's A/D input.
 
An impedance of over 2.5k does not make the ADC fail to read, it is just off a few codes. Longer acquisition times help some.

The point being that the 2.5k forms a voltage divider with the output resistance of the sender. That output resistance must be significant to motivate such a strategy, it's often inconsistent and somewhat ill-specified as well.

It also decreases the amplitude of the signal, which decreases the accuracy of the ADC. Using an external, lower vref might be needed to try to compensate.

Overall this will decrease your accuracy far more than using a source greater than 2.5k ohms. I've never heard of it being an effective strategy.

If you have a moderately high output resistance, like 5k, and don't need high accuracy, I'd investigate whether this will yield acceptable results. If not, buffer.

But you mention a pressure sensor. These are almost always a strain gauge bridge which means a differential output. Since you don't describe having a differential signal, I suspect the part is one which has an internal output buffer in which case you will not see a output impedance issue.
 
yapyapyap said:
The signal wire is taken where the 2k resistors and the pressure sensor meet and goes to the PIC.

0volts----[2k]-------(Sensor Connection to PIC)------[Pressure Sensor]-------------+5v

Before doing anything else, I would suggest connect up the circuit as quoted, without the PIC and having a DVM across the 2K resistor.

Collect data on the voltage across the 2K resistor to see what voltages you can get with different/highest pressure you are going to measure. Plot your data.

Then one can decide whether an opamp buffer is needed from the data.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…