Is it possible to change the value of the lower reference voltage on the ADC to something higher than ground? Ideally I would like to be able to use a DAC to set the reference to somewhere between 1 and 3 volts.
I suppose you could “float” the Arduino’s ground to some voltage above your input circuit’s ground but that would not be easy and it could cause other difficulties.
It might make more sense to shift-down your DC input voltage with a summing amplifier (sum your DC voltage with -1 to -3V) so it goes down to zero.
Are you sure you need to do this? Can you subtract from the digital reading?
In short, no!
But as always, if you explain why you might want to do this - in detail - other suggestions may be forthcoming.
What do you mean by "something higher than ground"? It already is set to be 5V higher than ground. Yes you can lower it to any voltage higher than 1V providing it is less than or equal to the supply voltage. I think the others might have missunderstood this, or else I am. :)
Basically I want to be able the measure a resistance (represented by R4 in the schematic). This circuit supplies a constant current and then I want to measure the voltage to determine the resistance (the voltmeter represents the arduino analog input). The resistance comes from a sensor and it will be varying from roughly 300kohms to 500kohms, this corresponds to an output voltage of 1.5-2.75v. Since I want to make use of as much of the ADC's resolution as possible I was hoping to set Vref+ to 2.75v and Vref- to 1.5v, but it looks like I'll have to find a different solution.
As a secondary question, how reliable are the 5V and 3.3V power supplies coming from a USB connection?
Sure you can do that. The only thing to watch out for is that when there is no resistance in R4 then the voltage into the Arduino is Vcc what ever that is. This must not exceed 5V.
I don't think you mean reliable here, I think you mean how accurate. If so then it is +/- 5%.
If I'm not mistaken then R4=0 would result in a voltage of 0 into the arduino. But it doesn't matter because the resistance would never go much below 300k.
Nevermind, misunderstood completely
Hold on, what? If you start floating the arduino, then what are you measuring against?
So you are going to power down, replace the resistor and power up to make your measurements?
I finally think I've grasped what you're trying to accomplish.
I'm not sure you've quite grasped the hardware though. Obviously the circuit has to have a potential in common with the arduino for any measurement to work. On the arduino side, that needs to be ground. If you want to measure from 1.5V, you need to seperate the power supplies. Then you need to have a voltage reference of 1.5V tied to your circuit, which you then in turn connect to arduino ground. Then you need to tie in a new reference supply to the arduino side, 1.25V for arduino AREF input.
Regarding your side question... USB power is notoriously fickle, voltage wise. Not to be used as any sort of precision reference for anything.
If you want accurate results keep everything ratiometric, ditch the constant current and just use a voltage divider - yes you'll have to do a bit of calculation to convert the reading to resistance, but ratiometric measurements are generally a Good Idea.
Also a 1% metal film/oxide resistor is far simpler/cheaper than an opamp circuit.
Thanks for the solid advice everyone, I think i still haven’t stated by question properly. I would rather not deal with any floating power supplies etc. I was just wondering if there was a way to make the ADC output 0… for some arbitrary voltage instead of ground. That way I could have the full range of 0 to 1024 for voltages between 1.5 to 2.75. I’m pretty sure by now that the answer must be no.
On the contrary, the answer is - yes.
MarkT is correct in pointing out that if you want to measure a resistance, you want a ratiometric system which references it to another resistor. You then feed the resistor pair from VREF so that to the extent it changes, both the source and measured voltage change in proportion.
You were going to use an op-amp anyway. Note the problem here - an op-amp which can operate rail-to-rail at 5V is no simple thing. Nevertheless, you use the op-amp not to generate the constant current, but to provide a high input impedance for your resistance measurement and to provide the offset.
That explained, I’ve had enough for tonight - someone else may provide the circuit, or I can look into it tomorrow.
I think i still haven’t stated by question properly
I was hoping to set Vref+ to 2.75v and Vref- to 1.5v
I think the problem is not so much that you stated your question incorrectly as it is that you misunderstand how Vref can be configured:
The analogReference voltage settings are ALWAYS referenced to the arduino ground (including EXTERNAL reference) regardless of which reference you set. The analogReference GROUND ,(which you describe as “analogReference (-)” , CANNOT be OFFSET from the arduino ground through any S/W configuration. Whether or not it could be done using H/W is another question which I won’t address. Only the analogReference voltage (which you describe as “analogReference (+)” can be configured via S/W.
That being said, I think this question is unnecessary as :
That way I could have the full range of 0 to 1024 for voltages between 1.5 to 2.75.
because if you explain WHY you want to do this I am sure the answer will lead to the conclusion that you want better resolution , which can be obtained using this.
(don’t forget to read the instructions in the code how to set it for the 16 bit version of the chip , the ADS1115 since the example code has a default configuration for the 12-bit ADS1015)
I believe someone else already mentioned that one of the problems with your question is that if you shift the 0 - 5V range up by 1.5V, the high end of that range would be 8V which exceeds the allowable range for the analog input pins. If you added two LM1117 voltage regulators with one output set to 1.5V (or used a AA battery), and the other to 6.5V and you added a single supply OP AMP non-inverting amplifier with a Gain of 4 with op amp input signal ground connected to the -Vee (negative supply voltage which is connected to the LM1117 1.5V output and the +Vcc (positive supply voltage) to the LM1117 8V output and referenced the op amp output signal to the arduino GND you could do it but the LM1117s input voltage could not share a common ground with the arduino. The op amp circuit GND (the 1.5V reg output) would connect to the arduino ground. The voltage range 6.5V-1.5V would therefore be 5V , which is compatible with the arduino. The (UNKNOWN ) signal you want to measure that has a 1.25V range starting at 1.5V would be amplified 4 times to give a range of 5V.
SEE ATTACHED SCHEMATICS
Schematic-A: (using LM317)
Schematic-B: (Same circuit using LM1117)
(SEE LM317/LM1117 datasheets for circuit wiring)
Note: LM1117 PS circuits DO NOT SHARE COMMON GROUND with Arduino. Both LM1117s can be powered from a floating 9Vdc WALL WART . The “floating GNDs” in the schematic are the wall wart -V line. The LM1117 circuits are powered by the wall wart +V line. The purpose of the LM1117/op amp circuit is to convert a 1.5V to 2.75V signal to 0V - 5V. This requires the x4 amplification. The op amp
circuit is powered by floating power supplies, one of which is set to 1.5Vdc output and serves
as the op amp circuit GND and -Vee supply. (It’s a singled ended configuration). The other,
the 8Vdc floating supply serves as the op amp +Vcc. The op amp draws so little power that
it could be powered by a much much lower power regulator than the LM1117 but have not found one yet.
Unknown signal to be measured is applied to input of op amp circuit and shares common ground with op amp and arduino.
That should work but it is easier to use a 16-bit ADC.
raschemmel: That being said, I think this question is unnecessary as : because if you explain WHY you want to do this I am sure the answer will lead to the conclusion that you want better resolution , which can be obtained using this.
+1 By far the easiest thing to do is to use an external AD converter. Fewer components and higher resolution... what's not to like?