Instructables

ADC Vss/Vdd on PICs(AVR/ARM is ok too) for external measurements?

Hello, i'm trying to read analog voltages from an external source such as bench supplys and sensors.

I can read voltages from withing the PIC's board, 5v, 3.3v...  But if i try using an external power supply i can't read.

If i just probe the (+) wire, i can't read...if i plug the (-) wire in the gnd/vss of the board/pic, there's a voltage drop on the supply's voltage, and i can read it, but it sounds wrong.
I also already tried to use the vref+/vref- pins, and didn't make any difference, i think.

Like, 3v from the supply drops to 0,4v  on a multimeter and in the pic adc value. It looks like it's right, but that voltage drop isn't "ok".

I read something about single-ended and differential, but i couldn't find any real explanation.

So, the bottomline i need to use external voltage sources, and i will read 4-20mA sensors so, they will use external power, i can't use the boards sources and gnd/vss.

Can someone shed some light on the matter?

Post a circuit diagram.
pmlemes (author)  steveastrouk1 year ago
Thanks for your help, i played around and tried some other things and even things looking "right" it didn't worked properly.

So i changed the analog pin, i was using AN10, and changed to AN15.

Guess what.....everything worked JUST PERFECTLY in the first try. I wasn't wrong the whole time, it was just that AN10 pin that wasn't working.

I guess, the different ports had something to do with it, considering that both were "free" pins. But thanks again.
The micro controller alone isn't going to be a good method of reading voltages.

But in order to read anything with it's own power supply you must have a shared ground between the 2 devices.
pmlemes (author)  mpilchfamily1 year ago
Thanks for your help, i played around and tried some other things and even things looking "right" it didn't worked properly.

So i changed the analog pin, i was using AN10, and changed to AN15.

Guess what.....everything worked JUST PERFECTLY in the first try. I wasn't wrong the whole time, it was just that AN10 pin that wasn't working.

I guess, the different ports had something to do with it, considering that both were "free" pins. But thanks again.
pmlemes (author)  mpilchfamily1 year ago
So, can you be a little more detailed? how can i share these grounds, or how is this done, schematics or examples are welcome.

As far as the microcontroller being able to read the voltages, i think it should be ok, precision isn't so important here, i just need it to work, from there i'll find a way.

But, tell me about sharing grounds.

But thansk for the quick answer .
The ground from the supply needs to be connected with the ground pin on the pic. Without a shared ground the pic can't read the input from the positive lead of the supply.
pmlemes (author)  mpilchfamily1 year ago
Thats the situation i described where the voltage drops from 3v to 0,4v.

When i simply conects the grounds, using internal and external vref-, there is this voltage drop, as something isn't right.

As i read about "single-ended" they said i can directly probe the analog pin of the pic, in a voltage source, but, without a comom ground i can't measure anything.

But if i wire the grounds together, theres this voltage drop and the pic, usually reads the same value as a multimeter, that is 0,4v.

I know that i'm doing something wrong, i just can't see where, i am trying to be simplistic as i can here...
Do you have a circuit for what you are trying to do, and details of which pins of the PIC are connected to what.

Without a potential divider, you can only measure voltages between 0V and Vdd of the PIC, anything above that will be pulled down to Vdd by the internal protection diodes, which may explain the voltage drop.

Alternatively, the pin that you are using to read the voltage may be set as a low output, which will try to pull the pin down to around 0V (if this is the case, it's likely that the driver for the pin will have been damaged unless the supply is regulated to 20mA or so).

The ADC in the PIC microcontrollers I've used is usually rather difficult to get set up correctly, and many of the registers involved default to odd values, so you should probably look through all the analog section of the PIC datasheet to make sure everything is set correctly in your code.
pmlemes (author)  The Skinnerz1 year ago
Thanks for your help, i played around and tried some other things and even things looking "right" it didn't worked properly.

So i changed the analog pin, i was using AN10, and changed to AN15.

Guess what.....everything worked JUST PERFECTLY in the first try. I wasn't wrong the whole time, it was just that AN10 pin that wasn't working.

I guess, the different ports had something to do with it, considering that both were "free" pins. But thanks again.
pmlemes (author)  The Skinnerz1 year ago
I am aware of the vdd limit, and i haven't even tried to measure above vdd voltages, in some experiment i used a voltage divider, and yet, didn't passed 5v.

I am configuring registers manually, adress by adress, bit by bit, so i'm certain that they are configured in the right way.

I'm still fiddling with acquisition times and conversion clocks, but thats not the problem here i think. I also used "large" timmings so the adc have a little space to work, but i respected the datasheet, read the adc section several times...

Theres no circuit at the moment, i just have a pré-assembled board, i have AN10 and AN15 pins avaidable, using PIC18F8622.

Registers-wise, it should be right, i experimented using vdd/vss internals, external via vref+ and vref-, i'm limiting the current in ports, 'cause i already fried another pic without a limiting resistor, so after changing that pic, i learned my lesson.