Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC16F887 ADC Reading Variation Issue

Status
Not open for further replies.

Vendrus

Newbie level 2
Joined
Jul 2, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,310
I'm stumped.
I'm currently using a PIC16F887 to read three different analogue voltages off different pins, which it happily does - except there's a ~10% variation in the readings off all three.

I've tried everything I can think of - setting the ADC clock to Fosc/32 (from internal 4MHz clock), increasing the supposedly appropriate 5ms delay after channel switching to 10, even 20ms, but nothing has any significant effect.

The first ADC is a measure of a voltage, reduced by potential divider then separated from the rest of the circuit by an opto-isolator. Input resistance is ~2kΩ. The input Voltage at the relevant PIC pin ranges from 1 to 4V, with a 10-20mV high frequency ripple due to DC-DC converters elsewhere in the circuit. However, the PIC reads values that vary far more wildly.

The other two are from LM35 temperature sensors, and the lines again exhibit no noise other than the high-freq 10-20mV ripple. I should add that the rail voltages (which the ADCs are referenced to) exhibit the same characteristics. There's some pretty decent EMC precautions on this PCB.

That said, I'm at a loose end. The input voltage characteristics heavily suggest that it's a PIC issue/setting, but I can't work out how to fix it if it is. Averaging is all very well, but for such a large inaccuracy it'd just be shoving the problem under the carpet.

Anyone got any ideas?
 

Hi,

First things to do /check if not already done so.

Have you got a 100nf fitted very close / across Vss / Vdd of the 887 chip.

Have you proved your ADC code with a set voltage, ie use a 10k trimmer or potential divider of 2 resistor to feed the same voltage to all three inputs and ensure they are all producing the same value ?

Try running just your 887 and those resistors on a separate 5v power source or 4.5v battery if you suspect you dc converters are causing a problem.
 

As you have the reference connected to the supply voltage try connecting a large capacitor (1000uf) across the supply, if that does not work then try a separate fixed reference voltage.
 

Hi,

First things to do /check if not already done so.

Have you got a 100nf fitted very close / across Vss / Vdd of the 887 chip.

Have you proved your ADC code with a set voltage, ie use a 10k trimmer or potential divider of 2 resistor to feed the same voltage to all three inputs and ensure they are all producing the same value ?

Try running just your 887 and those resistors on a separate 5v power source or 4.5v battery if you suspect you dc converters are causing a problem.

Thanks for the suggestions.

There are capacitors very close across the Vcc/Vdd of the 887, and all indications are that the rail voltage is near-enough rock steady.
I included the negligible ripple (which could possibly account for ~1% variation, but most likely less due to the high frequency) more as a demonstration that I had been decently thorough in examining the signal!

As components are surface-mount, it'd unfortunately be impossible to apply voltages direct to the pins (though I can control the voltage measure), but by calculation the readings match up to the voltages... though I have to average. It's easily proven that I'm using the right pins and conversion is happening, at least, by wiggling the measured voltage and liberal application of freezer spray (that stuff is too much fun!). I've derived the conversion factors and can get accurate but imprecise readings.

While the usefulness is little iffy (since I'd have to use a different version of the 887, in a more noisy format) I'll probably try breadboarding a DIL 887 to see if that has the same issue.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top