Offline
Newbie
Karma: 0
Posts: 6
|
 |
« on: January 22, 2013, 07:15:02 pm » |
Hello, I'm currently working on an interface using the bi-directionality of an LED array. They would display a target which the finger has to touch and sense it to locate if the target has been accurately touched... I have watched Han's video ( http://cs.nyu.edu/~jhan/ledtouch/index.html) and have looked at patents for using leds as sensors, but unfortunately I'm quite new to all of this and am a bit lost... If by any chance you know of a program that does the same thing (array of led translated to screen) or that you have it as 'old work' and that you have moved on to something else, could you please point to me where I could find them? This kind of thing is very helpful (for anyone who is interested) http://www.provolot.com/projectlog/2007/05/bidirectional_led_sensing_proc.htmlI've got very limited knowledge of processing (and arduino coding in general) and a few lines of working code would therefore help me greatly. with best wishes, Ymtees
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #1 on: January 22, 2013, 07:29:27 pm » |
If by any chance you know of a program Anyone giving you a piece of code is doing you a disservice. Go figure out what mechanism is at work and how to perform the various functions needed in your mcu. That's called learning. Copy-and-paste is for people without a brain.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 471
what?
|
 |
« Reply #2 on: January 22, 2013, 07:52:51 pm » |
once you've done it it's quite easy to understand here's some quick and dirty code i rushed but i've tried to explain each action, there are better ways but this explains the principal // LED with current limit resistor connected to digital pin 2 & 3 // LED - to pin 2 & LED + to pin 3
void setup() { Serial.begin(9600); }
void loop() { long t=0; // --------- LED Forward Voltage ------------ pinMode(2, OUTPUT); // LED - to pin 2 pinMode(3, OUTPUT); // LED + to pin 3 digitalWrite(2, LOW); // Make pin 2 0v digitalWrite(3, HIGH); // Make pin3 VCC delay(10); // ------------------------------------------
// --- Now Reverse Polarity to charge LED --- pinMode(2, OUTPUT); // LED - to pin 2 pinMode(3, OUTPUT); // LED + to pin 3 digitalWrite(2, HIGH); // Make pin 2 VCC digitalWrite(3, LOW); // Make pin3 0v // ------------------------------------------ // --------- Now Discharge the LED ---------- pinMode(2, INPUT); // make pin 2 input pinMode(3, OUTPUT); // pin 3 still output digitalWrite(2, LOW); // make pin 2 low, it is now input digitalWrite(3, LOW); // Make pin3 0v // now count how many loops until pin 2 becomes logic low and LED is discharged while(digitalRead(2) == HIGH) { t++; } Serial.println(t); // report to serial // ------------------------------------------ }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #3 on: January 23, 2013, 04:44:00 am » |
Anyone giving you a piece of code is doing you a disservice. Go figure out what mechanism is at work and how to perform the various functions needed in your mcu.
That's called learning.
Copy-and-paste is for people without a brain.
I understand I may be sounding as though I want someone to do the work for me, sorry about that, I am keen to learn but am afraid lack of guidance makes it seem as though there is a world I need to understand before I can do the smallest things. A piece of code, which I can decipher, would help me learn as I tweak it, making the whole processing more interactive, focused, and relevant to what I am trying to learn. Thank you for your reply. Ymtees
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 299
Posts: 26024
Solder is electric glue
|
 |
« Reply #4 on: January 23, 2013, 06:55:38 am » |
|
|
|
|
|
Logged
|
|
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 471
what?
|
 |
« Reply #6 on: January 23, 2013, 02:50:49 pm » |
Very interesting Mike, i've never taken the time to look that deeply into it, I dont get much time usually, so left it as a cool led hack, although i did see some guy had make two units that could talk to each other at short range
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #7 on: January 24, 2013, 05:44:24 am » |
P18F4550, Hippynerd, Grumpy_Mike, Thanks a lot for pointing it out to me, I'm following Grumpy_Mike's example and it works, although results sometimes flicker heavily, with a 10 segment display I bought yesterday ( http://www.maplin.co.uk/10-segment-display-2128). Might have been because it was night and there wasn't any 'natural' light. Grumpy_Mike, thank you for posting both the arduino and the processing code, I'm deciphering it slowly!  I've been told that to achieve my purpose, it would be better (and less complicated) to use a phototransistor in the middle of collated 2x2 or 4x4 arrays for location of a finger quickly touching the screen. If you've got any thoughts, please shoot!  Best, Ymtees
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 299
Posts: 26024
Solder is electric glue
|
 |
« Reply #8 on: January 24, 2013, 09:00:42 am » |
Bang!
Yes I think a photo transistor would be much easier to use, there is not all that software faffing about with charging and timing the discharging rate.
|
|
|
|
|
Logged
|
|
|
|
|
Cairns - Green Island for Winter
Offline
Full Member
Karma: 2
Posts: 148
|
 |
« Reply #9 on: January 25, 2013, 05:15:00 am » |
If by any chance you know of a program Anyone giving you a piece of code is doing you a disservice. Go figure out what mechanism is at work and how to perform the various functions needed in your mcu. That's called learning. Copy-and-paste is for people without a brain. A pretty ill concieved and ill considered bit of ppoor opinion if ever I have seen one Everyone learns first by following example and then with experience experimenting to push the envelope a bit further. In fact thats natures way. I would ignore such statements This is a board for posting questions to seek answers not criticism Unfortunately it is full of these types
|
|
|
|
|
Logged
|
Governments should do what they were designed to do only. Manage the larger issues best done by Government. My Family and my Property are not Government issues. To stop corruption give them 3 times the normal penalty. Have them agree on first appointment.
|
|
|
|
Cairns - Green Island for Winter
Offline
Full Member
Karma: 2
Posts: 148
|
 |
« Reply #10 on: January 25, 2013, 05:31:31 am » |
If you follow Mike's LED post and use normal led's there is a program posted here somewhere that gives the code for a function to read the time it takes for an LED to dissipate its charge to zero . If you can't find it by searching this thread then say so and I will go find it.
Surprisingly the LED used only as a light sensor can be reversed . No resistor is needed. However you are working with wire and capacitance and they vary widely from manufacturer to manufacturer . If you want a longer lead on an LED the only success I have had is with a single core shielded coax type cable with the shield as one of the wires,connected to negative , and the core as the other. Two wire shielded cable does not work and neither does twisted pair.. I think they pull in radio wave voltage in the area
The above single wire/shield works on the coax theory that the signal going into the coax comes out the same at the other end provided the capacitance in the cable does not vary so you should be able to use any length.
|
|
|
|
« Last Edit: January 25, 2013, 05:39:28 am by tytower »
|
Logged
|
Governments should do what they were designed to do only. Manage the larger issues best done by Government. My Family and my Property are not Government issues. To stop corruption give them 3 times the normal penalty. Have them agree on first appointment.
|
|
|
|
Anaheim CA.
Offline
Edison Member
Karma: 34
Posts: 2404
Experienced old Whitebeard with a Full head of Hair...
|
 |
« Reply #11 on: January 26, 2013, 12:53:30 pm » |
@ *dhenry* I understand you wear shoes make of candy so your day does have some 'Sweet Spots' in it... You seem to "Open Mouth, Insert Foot"... quite often. Really noticeably so.. Too. Hint... Is this the way that you wish to be treated...? Did it ever occur to you that the word "Mechanism" Might not be understood in the context used... OR that You ARE NOT A Gift From God, sent to save the Arduino Forum, Quite the reverse... IMO Anyone giving you a piece of code is doing you a disservice. Go figure out what mechanism is at work and how to perform the various functions needed in your mcu.
That's called learning.
Copy-and-paste is for people without a brain.
From previous code snippets you have posted and your comments about their provenance it would appear that your statement above lacks some credibility ... AS usual... Bob
|
|
|
|
|
Logged
|
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #12 on: January 26, 2013, 08:14:27 pm » |
although results sometimes flicker heavily Because the code is poorly written. All you need to do is to understand how this thing works, and code for it. The code posted earlier can serve as a good starting point: you will need to specify charge / discharge / measurement pins - for 6 leds, you need at most 7 pins. The trick, with this approach, is to use time-out, so the measurement time isn't too long when it is dark. A better approach is to use the adc module (aka charge transfer): it is much faster, offers higher resolution and is considerably simpler.
|
|
|
|
|
Logged
|
|
|
|
|
Cairns - Green Island for Winter
Offline
Full Member
Karma: 2
Posts: 148
|
 |
« Reply #13 on: January 27, 2013, 02:01:19 am » |
Charge transfer -adc module I suspect I have seen a post on this somewhere here but I have searched here for "charge transfer " and "LED charge transfer " and "adc module " and the only thing that comes up is the above post.
I have done the same searches on DuckDuckGo and not seen anything I could directly associate with an LED or even a capacitor apart from Franklin flying a kite?
Would you please elaborate on this hopefully with a reference point so I can see what you are talking about.
|
|
|
|
|
Logged
|
Governments should do what they were designed to do only. Manage the larger issues best done by Government. My Family and my Property are not Government issues. To stop corruption give them 3 times the normal penalty. Have them agree on first appointment.
|
|
|
|
UK
Offline
Faraday Member
Karma: 15
Posts: 2852
Gorm deficient
|
 |
« Reply #14 on: January 29, 2013, 02:57:19 am » |
A pretty ill concieved and ill considered bit of ppoor opinion if ever I have seen one Everyone learns first by following example and then with experience experimenting to push the envelope a bit further. Despite my normally impeccable judgement, strangely, I find myself agreeing with tyTower.
|
|
|
|
|
Logged
|
Per Arduino ad Astra
|
|
|
|
|