Main Site Documentation

Noob needs voltage divider help analog input


#1

I have the following setup:

  • Fez domino
  • I have a voltage divider on a breadboard
  • 2K resistor (measured 1996) from GND to point (1)
  • 10K resistor (measured 10021) from +3.3v to point(1)
  • Analog connection from point(1) to AN3.

Using a voltmeter I assert that there’s 3.3v from GND to +3.3v (just to verify)
When my voltmeter measures GND to point(1) I get 0.546 millivolts

Now in code:


in = new AnalogIn(pin);
in.SetLinearScale(0, 3300);
int value = in.Read();

This code does NOT read 546.And does not match up to the voltmeter

However, when I connect the 3.3v directly to AN3 I get a proper reading of 3299.

Now, when I change both resistors to 10k it suddenly adds up (but then its not a voltage divider anymore)

Theres nothing else connected to the board.It seems the readout of the analog pin gets more off as the analog input goes to 0v.


#2

Try a slightly larger current … Say from 3.3v to point (1) 3.3k and from gnd to point (1) 680 ohm

That should get you nearly the same @ 560mV but with a larger drive current…

I remember something about adc’s max input resistance of 10k…

If this works then the ADC cant sample the 270uA efficiently, but should the 800uA sample

Cheers Ian


#3

Hmmm that is interesting…

I experimented with a variable 10k resistor and those values are reported correctly across the scale.


#4

For what it’s worth, i am trying to make a 15v tolerant voltmeter


#5

Once you have this cracked… Will you be offering a small oscilloscope ( with a Graphical interface ?)

Anything’s possible with this gear…

Cheers Ian


#6

[quote] have the following setup:

  • Fez domino
  • I have a voltage divider on a breadboard
  • 2K resistor (measured 1996) from GND to point (1)
  • 10K resistor (measured 10021) from +3.3v to point(1)
  • Analog connection from point(1) to AN3.

Using a voltmeter I assert that there’s 3.3v from GND to +3.3v (just to verify)
When my voltmeter measures GND to point(1) I get 0.546 millivolts

Now in code:

in = new AnalogIn(pin);
in.SetLinearScale(0, 3300);
int value = in.Read();

This code does NOT read 546.And does not match up to the voltmeter

However, when I connect the 3.3v directly to AN3 I get a proper reading of 3299.

Now, when I change both resistors to 10k it suddenly adds up (but then its not a voltage divider anymore)

Theres nothing else connected to the board.It seems the readout of the analog pin gets more off as the analog input goes to 0v.[/quote]

Two 10k resistors would still make a voltage divider - any two of the same value would divide the voltage exactly in half. So with two 10k dividers, and a 3.3v input, you should see 1.65v.

It would be .546 volts, not .546 mV… first off. :slight_smile: That should still read 546 on the FEZ. What value are you getting?


#7

Looking at your original post again, one thing you must realize is that the FEZ will never read 546 on a .546 volt input.

For ADC to work, you need to take many samples and average them at the simplest form, you can get more complex with anti-aliasing, throwing out values <> x% of baseline, etc. There is always noise on the ADC and that will show up on your readings.

Try taking 60 readings per second, average them and print the output every second and see what you get.


#8

@ Patrick: The first post said his readings were non linear as he approached gnd…Noise is also generated with a higher impedance. If he lowers the impedance to 3-5K the readings will be less noisy as well …

Cheers Ian


#9

With an input impedance that low you’ll likely load down the very voltage source your trying to measure. A good VOM will have an input impedance of 10meg Ohm to prevent influencing the circuit you are trying to measure.


#10

I don’t think 600uA is going to load the voltage source too much…

I have 1k pots on my length and angle sensors that’s only 3mA per sensor… If I use 5k I then have to oversample by 10 to soften the noise… at 10k its worse.

It very much depends if you’re running on batteries or not. It’s always a trade off…

Like I said earlier Jeff… The ADC input impedance should not be higher than 10k, its not a scope input we’re dealing with…

Cheers Ian

OMG Sorry Jeff I’ve just realized! He’s making a voltmeter…There will have to be an impedance converter of some sort…