My project aims at finding the x and y coordinates of the point where the jockey (connected to A4 pin) touches a resistive square plate (100k measured between opposite sides). For this , an x-axis pair of electrodes applies a 5V drop for 1ms, during which the y-axis electrode pair is broken off from the Arduino circuit by 2 relay switches(for each one of the pair), so that the current flows in a straight path between the x-axis electrode pair and does not enter the y-axis electrodes. The A4 pin reads the input voltage and calculates x-coordinate. Then in the next 1ms , the x-axis electrode pair is broken from the Arduino circuit by 2 relay switches(for each one of the pair) and the y-axis pair applies 5V drop. A4 reads and calculates the y-coordinate. But since, relay has a switching speed of 10-20ms, and a limited switching life, I cannot use relays. And I cannot decrease my sampling frequency , since, I need very accurate and real-time location of the jockey. Is there any alternative to using relays? Can I use the L293D IC for this purpose?
Nope..
Just use FET's connected to your digital Outputs .
This is going to have a lot of problems* , can't you just use some form of position encoder to know where your device lands.
- variable contact resistance, resolution ...
hammy:
Just use FET's connected to your digital Outputs .
Can u provide the FET device number(gate controlled by Arduino digital pins)?
SumitAich:
Can u provide the FET device number(gate controlled by Arduino digital pins)?
I found this MOSFET. Will this be a suitable alternative to using relay switch for my purpose?
http://www.newark.com/jsp/search/productdetail.jsp?sku=99R2970
When an Arduino input is not being read it is electrically neutral withing 0 to 5V. You don't need to disconnect, it happens when you're not reading.
Google on arduino resistive touch and see how many hits you get.
GoForSmoke:
When an Arduino input is not being read it is electrically neutral withing 0 to 5V. You don't need to disconnect, it happens when you're not reading.
No , the x and y-axis pair of electrodes are connected to Arduino digital output pin, not as input.The current in the resistive plate must flow in a straight path, not bending towards y-electrodes , when the 5V drops along the x-direction. This is necessary for the square resistive plate to work as an alternating x and y-axis potentiomete
If you turn one set off (mode them as INPUT and don't read makes them neutral) at a time. No need for external switch/relay at all.
BTW, Steve Jobs BS optimism doesn't account for all the crazies that don't change the world or all the not-crazy people who have changed the world whether that was their goal or not.
Steve should have talked about THIEVES changing the world. Bill could have joined in.
GoForSmoke:
If you turn one set off (mode them as INPUT and don't read makes them neutral) at a time. No need for external switch/relay at all.
Yeah, thanks for the help.
Also I was wondering how do I detect whether the jockey is even touching the resistive plate or held away from the plate and just detecting noise signals ?
It would have to be very close to the plate for sparks to cross the gap, like hair thickness close. You could debounce the jockey in software same as debouncing buttons.
If you supply current from one corner of the plate (to the jockey) at a time (can be done in 1ms), you will get 4 values that can give you a close X-Y to use. The other corners, mode as INPUT, easy to change. The analog reads will need to be done twice each, the first read after switching pins will be bad from noise so read twice all 4 quickly (before the jockey can move more than a tiny bit) and then do the calculating using tables you store in flash where possible to reduce run-time calculating especially if it includes trig functions.
This thread seems to be a continuation of this one but with a solid plate instead of water. FYI
I've seen an article or thread with pics where the resistive surface was paper coated "evenly" with pencil lead (graphite). Contact was made with paperclips holding the corners. Graphite is conductive with resistance per mm.
How much resistance does this plate have? At 100 ohms, 5V will cause 50mA to flow and the pin max is 40mA briefly only. Bye-bye pin. A 220 ohm resistor is a good minimum resistance to put on a pin, it allows 23mA.
GoForSmoke:
How much resistance does this plate have?
SumitAich:
a resistive square plate (100k measured between opposite sides).
SumitAich:
Also I was wondering how do I detect whether the jockey is even touching the resistive plate or held away from the plate and just detecting noise signals ?
Can I use a 1nF capacitor between the ADC (jockey) pin and GND. So that the ADC reads 0 when jockey is not touching the resistive plate
The jockey is connected to the analog pin? You need a pulldown resistor, 10K to ground going to that pin as well.
Then when the jockey breaks contact the charge in the wire drains through the pulldown and the pin reads zero.
GoForSmoke:
The jockey is connected to the analog pin? You need a pulldown resistor, 10K to ground going to that pin as well.
Then when the jockey breaks contact the charge in the wire drains through the pulldown and the pin reads zero.
So, I ran this code.
void setup() {
Serial.begin(115200);
analogReference(DEFAULT);
pinMode (12, OUTPUT);
}
void loop() {
delay(100);
digitalWrite(12, 0);
Serial.println(analogRead(4));
delay(100);
digitalWrite(12, 1);
Serial.println(analogRead(4));
}
First I used the 10k resistor ,between the ADC pin and pin 12, and got these readings. The first half of the readings are for when the jockey is not touching the resistive plate and the latter part is for when the jockey is touching the resistive plate.
0
1023
0
1023
2
1021
1
1021
74
1005
75
1006
75
1005
Now, I replaced the 10k resistor with an 820ohm between the ADC pin and pin 12, ran the same code. The jockey was at the same location on the resistive plate as it was earlier.The first half of the readings are for when the jockey is not touching the resistive plate and the latter part is for when the jockey is touching the resistive plate.
0
1023
0
1023
0
1023
0
1023
7
1021
7
1020
7
1020
6
1020
GoForSmoke:
The jockey is connected to the analog pin? You need a pulldown resistor, 10K to ground going to that pin as well.
Then when the jockey breaks contact the charge in the wire drains through the pulldown and the pin reads zero.
Yeah, I have decided to use your method, but replacing the 10k with an 820ohm resistor. If the ADC input reads 1023 or 0, when digital pin 12 is set to a '1' or '0' respectively, the jockey is not touching the resistive plate.If the ADC input reads even slight less than 1023 or slight more than 0, then the jockey is touching the resistive plate.When voltage on the resistive plate is being read, then the digital pin 12 is set to pinMode INPUT so that the 820ohm gets disconnected from the circuit.
Yeah, I have decided to use your method, but replacing the 10k with an 820ohm resistor. If the ADC input reads 1023 or 0, when digital pin 12 is set to a '1' or '0' respectively, the jockey is not touching the resistive plate.If the ADC input reads even slight less than 1023 or slight more than 0, then the jockey is touching the resistive plate.When voltage on the resistive plate is being read, then the digital pin 12 is set to pinMode INPUT so that the 820ohm gets disconnected from the circuit.
No, no, no. A hundred times no. With that arrangement, you can no longer measure the position of the jockey. You cannot use a 820 ohm or even a 10k resistor, such a low value destroys the linearity of the circuit.
The problem you're trying to solve is what happens when the jockey is off the resistive sheet, right?
Okay, you can solve that problem but you need a 10 megohm resistor. Yes, 10 MEGohms. That's 10 million ohms. Yep. The analog input impedance is very high. That's all it will take to solve the problem. Anything lower just destroys the linearity of the sheet/jockey which needs to remain a ratiometric device. The 10 meg resistor will introduce about 1% error. That's about the best you can hope to do.
if you want the ADC value to go to zero when off sheet, use the 10meg as a pull down resistor. That means you connect the 10meg resistor between A4 and ground. If you want the off sheet reading to go to 1023, connect it between A4 and +5.
You'll most likely find that pulling down an analog input with a 10meg will not result in a true zero reading due to noise, but pulling it up will usually always result in a result of 1023 due the very high input impedance.
avr_fred:
You'll most likely find that pulling down an analog input with a 10meg will not result in a true zero reading due to noise, but pulling it up will usually always result in a result of 1023 due the very high input impedance.
SumitAich:
So, I ran this code.void setup() {
Serial.begin(115200);
analogReference(DEFAULT);
pinMode (12, OUTPUT);
}
void loop() {
delay(100);
digitalWrite(12, 0);
Serial.println(analogRead(4));
delay(100);
digitalWrite(12, 1);
Serial.println(analogRead(4));
}
First I used the 10k resistor ,between the ADC pin and pin 12, and got these readings. The first half of the readings are for when the jockey is not touching the resistive plate and the latter part is for when the jockey **is** touching the resistive plate.
0
1023
0
1023
2
1021
1
1021
74
1005
75
1006
75
1005Now, I replaced the 10k resistor with an 820ohm between the ADC pin and pin 12, ran the same code. The jockey was at the same location on the resistive plate as it was earlier.The first half of the readings are for when the jockey is not touching the resistive plate and the latter part is for when the jockey **is** touching the resistive plate.
0
1023
0
1023
0
1023
0
1023
7
1021
7
1020
7
1020
6
1020
If it didn't go up to 1023 for 10k , why should it read a 1023 for 10Mohm , (when the jockey was not touching the resistive sheet)
Oh, so now everything works just fine? Yeah... right.
If it didn't go up to 1023 for 10k , why should it read a 1023 for 10Mohm , (when the jockey was not touching the resistive sheet)
Because the jockey isn't infinite resistance to ground?
Because the non-powered end of the sheet (x or y) isn't grounded?
Because the sheet really isn't a linear 100k across the surface?
Because it's not wired the way you've said it is?
Which is just another way to say because you've never drawn and posted a schematic of just what the heck you're trying to do.
Ok, so what does the analog input read with the jockey in contact and at the middle of the sheet? Tell me it's 2.5 volts and reads 512 and I'll just say... show me.
But, since you never answer people's questions, you just ask more questions, I'm out of here. Good luck.
10K to GND. Not pin 12. GROUND that is always GROUND.
aarg:
This thread seems to be a continuation of this one but with a solid plate instead of water. FYI
GoForSmoke:
It would have to be very close to the plate for sparks to cross the gap, like hair thickness close. You could debounce the jockey in software same as debouncing buttons.If you supply current from one corner of the plate (to the jockey) at a time (can be done in 1ms), you will get 4 values that can give you a close X-Y to use. The other corners, mode as INPUT, easy to change. The analog reads will need to be done twice each, the first read after switching pins will be bad from noise so read twice all 4 quickly (before the jockey can move more than a tiny bit) and then do the calculating using tables you store in flash where possible to reduce run-time calculating especially if it includes trig functions.
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