Increase digital input impedance of arduino uno

Smajdalf:
BTW I did not notice any change if I dipped my finger more into the water. I don't know how DMM ADC work but AFAIK it is not SAR which Arduino has. Probably it is more immune the unknown thing that caused the change you described. Or my setup was too different from yours.

Most cheap DMMs use a slow integrating ADC. Any fluctuations that happen at frequencies above it's bandwidth are averaged out.

Let me summarize problems and solutions-

Grumpy_Mike:
That is the electrolysis of water, each electrode will bubble, one hydrogen and the other oxygen. That is one of the reasons you must keep swapping the polarity over. As the bubbles form they insulate the wires and cause the contact resistance between water and wire to increase. By reversing the polarity constantly you prevent this.

So to minimize electrolysis even further and to get more real-time data, I need to increase the frequency of the pulse to match ADC sampling frequency / 12 (12=4 phases in 1 cycle * 3 analog inputs). But what is the ADC sampling frequency?. The page analogRead() says "so the maximum reading rate is about 10,000 times a second."To increase sampling frequency ,I decided that Arduino only prints raw analog data to my laptop and let my Java app do the rest calculation.I'll have to use Java to find the frequency at which Arduino prints analog data and then ,accordingly, decide the pulse frequency (injected into water).

void setup(){
Serial.begin(115200);
analogReference(INTERNAL); // 1.1V
}
void loop(){
Serial.println(analogRead(2)); 
Serial.println(analogRead(3));
Serial.println(analogRead(4));
}

Smajdalf:
I have no idea where rest of the 9V supply voltage was lost - probably metal/water contact (funny bubbles formed on the GND wire).

Yeah, I faced the same problem ,the analog readings of pins A2 and A3( placed close to ,but not touching the metal plates at the two ends of the water) were offset by 150 units(that too fluctuates with time) .So I came up with this solution - A2 and A3 are read in real-time along with A4(finger electrode) and distance calculated by--
20cm * (dA4-dA3) / (dA2-dA3) .Here, dA2, dA3, dA4 denotes difference in the analog readings taken in the 1st and 2nd phase of the input pulse. This is the distance from right end(refer schematic).

Then reverse the direction of the voltage across the water and measure again. The difference in the two measurement could give you the distance along the water.

Yeah, thanks.

What's supposed to happen when your finger is not connected? Open inputs (digital or analog) are undefined. Is that OK in your application?

No it's not OK. So, in the 3rd and 4th phase of the input pulse the voltage at both ends of the water drops to -0.3V(to account for the skin generating bio-voltage of order 10mV<<0.3V) that must read as 0 at A4 and then rises up to 2V that must read as 1023 ,when the finger is dipped in water. When finger is outside the water it is very unlikely for A4 to read every 3rd and 4th input as 0 and 1023, in that same order, with that same frequency(due to noise, bio-voltages , etc). That detects whether finger is dipped even slightly or not.

Grumpy_Mike:
If you want to measure how far one finger is along the track, then you need to put a voltage across the water cell and connect an electrode to one hand, use a metal contact and something like KY Gell to make a good contact.

I was thinking of a wristband with copper tape( copper tape ebay) on the inside.

Just that dipping my fingers depper into water changes skin impedance and hence the analog reading. Any way round this can you suggest?

Grumpy_Mike:
No it doesn't change the skin impedance, it changes the resistance because you are increasing the the contact area which of skin / water and so reducing one element of the series resistor chain you have. This is not mitigated by increasing the input impedance of your A/D.

I haven't been able to solved that part yet.

Smajdalf:
I think due to high resistances OP is measuring more (parasitic) capacitances in the circuit than real voltages.

And this too.It offsets the analog reading. I can correct it if only I get to know the offset. It is affecting the accuracy of the calculated distance. Also I distilled water being a dielectric is essentially forming a capacitor between the pair of metal plates at the the two ends of the water tank.Increasing the pulse frequency would possibly reduce this factor.

You need to synchronise the signal with the analog read. That is set the polarity one way do an analogue read, then set it another way and do another read. Then remove the potential and send the data. The voltage across the water must be the same for both polarities, not the asymmetric signal you showed in that picture.

Grumpy_Mike:
The voltage across the water must be the same for both polarities, not the asymmetric signal you showed in that picture.


Voltage is the same for both polarities --
0V and +0.55V (drop of -0.55V) , in the 1st phase of the cycle and
+1.1V and +0.55V(drop of +0.55V) , in the 2nd phase of the cycle
The 3rd and 4th phases of the cycle (-0.3V and +2V) are just to detect whether the finger is dipped in the water or not.

Can the moderators please shift this thread to the "Project Guidance" section ?

dipping my fingers deeper into water changes skin impedance and hence the analog reading. Any way round this can you suggest?

Grumpy_Mike:
You need to synchronise the signal with the analog read.

I will use micros() or millis() for time references to synchronise the signal with the analog read, since I need precision timing.

SumitAich:
dipping my fingers depper into water changes skin impedance and hence the analog reading. Any way round this can you suggest?

I believe with bare Arduino's ADC you are measuring more parasitic capacitances instead of real voltage. When you start a conversion a "low" resistance (1..100k) path to sample and hold capacitor inside Arduino opens briefly. It closes again when it is charged and then the ADC circuitry measures the voltage held in the cap. Between samplings the input resistance is very high. From this I believe capacitances of body forms "low impedance" path for the signal "around" the large resistance of skin (I imagine human skin as large resistor with tiny capacitor in parallel). IMHO by varying the voltage over water you may decrease problems with electrolysis but make the ADC unusable. To get consistent result you should place "reservoir" cap between ADC pin and GND (something under 1nF) and keep the signal stable long enough for it to charge over worst case skin resistance and then sample.

SumitAich:
I will use micros() or millis() for time references to synchronise the signal with the analog read,

No you can't do that with an analog read.

since I need precision timing.

Why.

Smajdalf:
I believe with bare Arduino's ADC you are measuring more parasitic capacitances instead of real voltage.

Absolute rubbish as we have come to expect from you.

Grumpy_Mike:
.
Absolute rubbish as we have come to expect from you.

Why? One capacitive touch sensing method implemented by Atmel's QTouch library works this way. Maybe my description is not clear? Or what part do you consider rubbish?
Referring to OP's schematic in post #43 I believe there is a capacitor parallel with R3. Sampling this by Arduino means this capacitor and S&H capacitor make voltage divider influencing the readings. Since the S&H "event" is high frequency (Datasheet is not clear how long it takes but probably not more than 1 ADC tick) both pin and body impedance is much lower than for DC in rest of the cycle.

Grumpy_Mike:
No you can't do that with an analog read.

why not?my sketch compiled with no errors.

void setup() {
Serial.begin(115200);
analogReference(INTERNAL);
}

void loop() {
if((millis()%10==0)){
Serial.println(analogRead(2));
Serial.println(analogRead(3));
Serial.println(analogRead(4));
}
}

SumitAich:
why not?

Well maybe I am misunderstanding you, so how do you propose to do this? If it is from within an ISR then I would say it was too long to be in an ISR but I don't know what else is going on. You have also not said why you need so precise timing, despite me asking before about this.

What exactly is your end system supposed to do.

SumitAich:
dipping my fingers deeper into water changes skin impedance and hence the analog reading. Any way round this can you suggest?

Are you sure about this? I tried to replicate it and failed - when dipping the finger more into the water the reading changed very little - being slightly closer to or further from GND electrode changed the reading more. But I have only 15cm of water - maybe on longer distance effect of dipping of finger is more important than slight movement to/from electrode. But you have "only" 20 cm of water too, right?
I was trying this with tap water and DC. I tried some AC but it didn't make much difference. So I don't know.
I was surprised how nice results I got. I think it can work quite reliably.
My suggestions: distilled water is not good idea - you probably don't need so high resistance and since it is open surface intended to dipping fingers etc. it will get contaminated anyway. It will probably "rot" in some time so you need to change it regulary - it will be probably much cheaper to use tap water. You should make the water as shallow and narrow as possible - it will increase resistance. If you can get negative supply you can use op amp to keep water next to "GND" electrode at Arduino's GND (so the electrode needs to be negative). This way you can use voltage next to positive electrode as ADC reference and the ADC reading will simply be relative distance of touch. The last part is usable only with DC readings but I don't see any reason to use AC (except of hydrogen formation which is VERY dangerous but I doubt AC use will reduce it much and currents in order of mA should not make it so much - unless it will be in very air tight room).

Smajdalf:
I believe with bare Arduino's ADC you are measuring more parasitic capacitances instead of real voltage.

Grumpy_Mike:
Absolute rubbish as we have come to expect from you.

alright, now this is really weird.(Note:- I'm powering the Arduino Uno and reading Serial data using my mobile phone and i'm outdoor ,away from ac mains hum)

->both water electrodes at GND , finger dipped into water, the analog input pin connected to my finger read ~60 units(AREF=DEFAULT (+5V) so 60 = +0.292V)
-> both water electrodes at +3.3V ,finger dipped into water, the analog input pin connected to my finger read ~740 units(AREF=DEFAULT (+5V) so 740 = +3.613V ). Input voltage was offset by +3.613 - 3.3V = +0.313V
->both water electrodes at GND ,finger dipped into water, the analog input pin connected to my finger read ~300 units(AREF=INTERNAL (+1.1V) so 300 = +0.322V)
->both water electrodes at GND , finger dipped into water, the analog input pin connected to my finger read ~100 units(AREF=EXTERNAL (+3.3V) so 100 = +0.322V)

->both water electrodes at GND ,the analog input pin itself dipped into water read ~40 units(AREF=DEFAULT (+5V) so 40 = +0.195V)
->both water electrodes at +3.3V ,the analog input pin itself dipped into water read ~720 units(AREF=DEFAULT (+5V) so 720 = +3.515V) Input voltage was offset by +3.515V - 3.3V = +0.215V
->both water electrodes at GND ,the analog input pin itself dipped into water read ~210 units(AREF=INTERNAL (+1.1V) so 210 = +0.225V)

After my experiment I measured the electrodes and jumper wires by DMM when they were disconnected from everything. I got strange voltages in order of hundreds of mW but I don't remember details. I concluded I maybe made "rechargeable battery": some reaction between the water and aluminium electrodes and remnants from electrolysis was generating the voltage (or was it just reaction of metal with water/some impurities?). It was also inside with mains hum all around. I really don't know and I did not care - it went to the bin to make space for dinner :wink: Maybe someone more educated can shed some light on source of this voltage.
But I do remember I had jumper wire in water close to GND electrode (connected to A0) to make reference and other (seemingly identical, just different color of insulation) to make measurements (connected to A1). Later when I dipped the A1 wire directly into water close to the reference it measured slightly less voltage (100 - 200 mV). It was in the wire, not in the ADC pin - switching wires switched readings, direct touch (under water) resulted in same voltage reading on both and difference was restored after direct contact was broken...
It is interesting topic. Sadly I know too little about current conduction in water and chemistry of metal/water(/ions?) contact - does anyone have some link to something where to start?

SumitAich:
alright, now this is really weird.

Grumpy_Mike:
Then put your other finger in the water and measure the voltage. Then reverse the direction of the voltage across the water and measure again. The difference in the two measurement could give you the distance along the water.

alright now i need not worry about those funny voltages , since I'll be swapping polarity and considering the difference of the analog reads.Thus, the offset voltage will not change the final calculated distance. This is another reason to constantly swap polarity. Thanks @Grumpy_Mike :slight_smile:
I think the only solution to the problem of varying voltage due to dipping the finger deeper is to insulate the rest of finger with electric tape, and allow only a small portion of my finger to be exposed.
But one last doubt, how do I detect whether the finger is still dipped in water or not ? Because the method I'd thought of earlier requires both water electrodes to be at the same voltage , and when read by analog input , it will have some offset.

SumitAich:
->both water electrodes at GND , finger dipped into water, the analog input pin connected to my finger read ~60 units(AREF=DEFAULT (+5V) so 60 = +0.292V)
-> both water electrodes at +3.3V ,finger dipped into water, the analog input pin connected to my finger read ~740 units(AREF=DEFAULT (+5V) so 740 = +3.613V ). Input voltage was offset by +3.613 - 3.3V = +0.313V
->both water electrodes at GND ,finger dipped into water, the analog input pin connected to my finger read ~300 units(AREF=INTERNAL (+1.1V) so 300 = +0.322V)
->both water electrodes at GND , finger dipped into water, the analog input pin connected to my finger read ~100 units(AREF=EXTERNAL (+3.3V) so 100 = +0.322V)

Please suggest a better method to detect whether the finger is still dipped in water or not .

SumitAich:
Please suggest a better method to detect whether the finger is still dipped in water or not .

please help

Grumpy_Mike:
Well maybe I am misunderstanding you, so how do you propose to do this? If it is from within an ISR then I would say it was too long to be in an ISR but I don't know what else is going on. You have also not said why you need so precise timing, despite me asking before about this.

What exactly is your end system supposed to do.

Smajdalf:
After my experiment I measured the electrodes and jumper wires by DMM when they were disconnected from everything. I got strange voltages in order of hundreds of mW but I don't remember details. I concluded I maybe made "rechargeable battery": some reaction between the water and aluminium electrodes and remnants from electrolysis was generating the voltage (or was it just reaction of metal with water/some impurities?). It was also inside with mains hum all around. I really don't know and I did not care - it went to the bin to make space for dinner :wink: Maybe someone more educated can shed some light on source of this voltage.
But I do remember I had jumper wire in water close to GND electrode (connected to A0) to make reference and other (seemingly identical, just different color of insulation) to make measurements (connected to A1). Later when I dipped the A1 wire directly into water close to the reference it measured slightly less voltage (100 - 200 mV). It was in the wire, not in the ADC pin - switching wires switched readings, direct touch (under water) resulted in same voltage reading on both and difference was restored after direct contact was broken...
It is interesting topic. Sadly I know too little about current conduction in water and chemistry of metal/water(/ions?) contact - does anyone have some link to something where to start?

I did it , I built a water touchpad sensor to track the position of my right index fingertip on a water surface! . Here's the Youtube video link - https://youtu.be/Isxqcih7TdI

Hi,

You have failed to provide the forum with your code and schematic to help finish this thread.

Anyone looking to do what you have needs to see the solution here, not on YouTube.

Thanks.. Tom... :slight_smile:

Here is the Arduino c++ code and the circuit schematic

diy_water_touchpad.ino (2.91 KB)

diy_water_pot_schematic.PNG