Shop OBEX P1 Docs P2 Docs Learn Events
Led Touch-Sense "Case Re-opened" — Parallax Forums

Led Touch-Sense "Case Re-opened"

Lab RatLab Rat Posts: 289
edited 2012-10-22 08:38 in Accessories
I am reopening a completed project that i tried and failed. LED Touch-Sensing.
I am using the Basic Stamp Homework Board with an imbedded BS2.

I wrapped my LED's with black electrical tape except for the very tip.
I am using the LED's provided in the Whats a microcontroller kit.

I am attaching the code that i used for my attemp. could anyone tell me what going wrong. it doesnt work like it is supposed to but it works if i touch a lead from the led instead of the tip. HELP!!!

Thanks
«1

Comments

  • Lab RatLab Rat Posts: 289
    edited 2010-08-29 06:26
    the sensing led is green and my indicator is red and is pointing away from the green led
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-29 07:33
    I've not built one of these, but I've read previous postings and seen demos. I think the problem is that the Stamp (and PBasic) is too slow. There's not a lot of charge in the LED junction capacitance and the time between charging and testing the voltage level is on the order of 1ms. I suspect the charge has leaked away long before that.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-29 08:29
    For one thing, I think you need to lose the DEBUG "off", CR in the loop. That takes a long time and it's blowing the deal.
  • Lab RatLab Rat Posts: 289
    edited 2010-08-29 13:03
    Hey mike how you been its been a while since ive been on here.

    I have a few 10mm LED's i know i have blue but i might have white. i know i have white 5mm. do you think that the larger LED might solve it.


    PJ i am gonna have to agree with you the DEBUG "off" it takes up alot of space in the debug window. i put the PAUSE 100 at the end because i wanted to slow down the poll cycle.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-29 13:13
    Well, I've always thought this thing was the bunk, because there's no documentation. Where's the data?
    A moderator moved the "project" that you'd replied to out of Completed Projects and into The Sandbox. Short of The Dustbin, or the Propeller Forum, I guess that's the best one can expect.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-29 13:39
    The idea is not "bunk". The problem is implementing it properly. I suggest you find some other (successful) implementations on the web and study how they're done. It may be that you will need to use a Propeller rather than a Stamp.

    Some links: here and here
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-29 13:43
    The point is, though, the claims Stamp-wise in the first place.

    If it's sound, then why isn't it all around us? Why isn't this on everything coming out of PLA_Mart?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-29 13:50
    Additionally, I have, as our illustrious president (pbuh) put it, "some skin in the game" for my trouble. I was on my BoE instead of the HWB and I whacked a freaking pin on my BS2. When I moved the sense LED from the SIP to the breadboard, I'd left a wire connected to V_dd and... it's not outputting anymore.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-29 14:14
    PJ,
    Claims aside, this is what engineering is all about. LEDs are not designed for this use and the junction capacitance is not at all controlled since it's irrelevant to the normal use of an LED (as a light source). Similarly, the amount of charge injected into the junction capacitance is not controlled. Based on existing demonstrations, this technique is usable, but may require a level of part selection and circuit and algorithm tuning that's prohibitive for mass production. If it's important enough for mass produced products, someone will eventually produce LEDs designed (or selected) for this use. Like a lot of similar things (like plasma displays), this sort of thing will appear first in premium, low volume products and eventually may make it to mass production.
  • Lab RatLab Rat Posts: 289
    edited 2010-08-29 14:16
    i myself was worried about the documentation part not existing

    also im gonna start tapeing over my power indicators just incase they really can talk lol


    PJ Allen wrote: »
    Additionally, I have, as our illustrious president (pbuh) put it, "some skin in the game" for my trouble. I was on my BoE instead of the HWB and I whacked a freaking pin on my BS2. When I moved the sense LED from the SIP to the breadboard, I'd left a wire connected to V_dd and... it's not outputting anymore.

    i actually have a homework board in the scrap pile i fried it last year. i just dug it out and im gonna use morts parts from it again lol
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-29 14:25
    I guess one just has to believe.
    To Heck with revelation already, I'm still waiting for documentation.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-29 14:40
    PJ,
    How about looking at the links I posted? They're to one person's experience with small arrays of sensors ... hardware, software, and documentation. One of the last postings in the list off one link has some musings about what this technology is good for and what it's not good for (like sensing in sunlight).
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-29 14:55
    Where do the BasicStamp and LED_sensors lines intersect? That's my only interest. I'm not engineering anything.
  • Lab RatLab Rat Posts: 289
    edited 2010-08-29 15:39
    PJ Allen wrote: »
    Where do the BasicStamp and LED_sensors lines intersect? That's my only interest. I'm not engineering anything.

    im starting to get this funny feeling that the bs2 isnt gonna cut the mustard.

    i was hoping that i would be able to figure it out on the homework board then transfer it to its own circuit and run it independant of the stamp
  • Lab RatLab Rat Posts: 289
    edited 2010-08-29 15:51
    im still at it so far all im getting is a really good metallic touch sensor
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-29 16:04
    Again, read about other people's experience with LED touch sensing. See what they've done. Try to duplicate it with a Stamp. Maybe it's too slow. You won't know unless you try the setup they're using and measure the voltages involved and their changes over time. In a couple of blog postings, they talked about using an ADC. Maybe that'll make a difference rather than using just the voltage threshold of an I/O pin. You'll be able to look at the voltage over time. Rather than just guessing whether this'll work with a Stamp (and maybe guessing wrong), you'll know based on measured data.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-31 05:48
    Again, I'm not interested in anybody's experiences, accounts, anecdotes, or claims. The common thread in those links is none shows his work. Let's see the work, let's see the documentation; save the specious claims for the Ufology convention.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2010-08-31 08:29
    I'm having a difficult time seeing where the problem is.

    In it's simplest form an LED is nothing more than a P-N junction on silicon. ALL P-N junctions exhibit photon emission properties as well as photon absorption properties. Depending on how you dope this junction you can exaggerate one feature over another to form an LED, Photo-diode, or several other options that exist in between.

    A P-N junction acts as a conductor (diode) when it is forward biased.

    A P-N junction acts like an insulator (forming a capacitor) when it is reverse biased.

    A P-N junction exposed to light will conduct proportionally to the amount of light at the junction, thus making a P-N junction configured as an insulator act like a capacitor with a resistor in parallel. (discharging the capacitor)

    So the whole idea of using an LED (P-N junction diode) as a switch requires you to use it in a reverse biased mode. This mode charges the 'capacitor' formed across the P-N junction. Once this capacitor is charged, you monitor the discharge until the voltage falls below the threshold of the I/O. Less light equals a longer time before the threshold is met, while More light equals a shorter time before the threshold is met.

    It's also possible to use multiple LED's in parallel to increase the overall effect, or to place an external (small) capacitor to slow the effects. Remember though, each P-N junction with multiple parallel LEDs have it's own P-N junction capacitor to deal with, where an external cap only has the one P-N junction to deal with. In other words if the capacitor is too large, the effects by the time the I/O threshold is reached may not be easily distinguished.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-31 09:08
    The problem is that there is no documentation, no working example. This doesn't fit into the flights of fancy narrative so prevalent hereabout. And enough with the subject changing, too. Some delusional cuts and pastes some total BS from another site and it goes viral. It's BS, that's what Lab Rat was asking about.
    Enough talk, already, let's see the work - the proponents'/advocates' work.
  • Lab RatLab Rat Posts: 289
    edited 2010-08-31 19:04
    i believe that it works but i need cold hard evidence that it works. evidence that i can replicate. what is there i also looked for it and everyone says how its supposed to work and i tried it and failed so i have no evidence of success. someone throw me a bone and give me schematics and code that work along with what processor
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2010-08-31 20:09
    Lab Rat,

    Here is some of the work that Tracy Allen did on it using the Propeller Demo Board.


    I just put this together using a RED led, and omitting the 220pF capacitor and it worked just fine on the Propeller Demo board. Actually it started sensing the shadow of my hand about 1ft away from the LED!!

    http://forums.parallax.com/showpost.php?p=574644&postcount=8

    The [code] formatting is messed up on that page, so refer to the lightmeter2.spin program that he has attached to the link.
  • Clock LoopClock Loop Posts: 2,069
    edited 2010-09-01 05:18
    LoL.

    Binning of leds is done with Luxeon leds, this makes standardization of leds for qualitites like uniform capacitance possible.

    I made a project that uses 32 leds as sensors in a musical device.
    http://forums.parallaxinc.com/forums/default.aspx?f=21&m=376422


    The bs2 might be too slow for led sense, if someone has a scope they could run a test with a few scope shots to show the RCtime of the typical led junction capacitor.
  • Roger LeeRoger Lee Posts: 339
    edited 2010-09-01 13:39
    Found this old forum link:
    http://forums.parallaxinc.com/forums/default.aspx?f=21&m=128677

    LEDsensor_TDW_001.spin by Timothy D. Swieter about half way down the first page. A few quick changes to some of the constants and it works great.
  • Lab RatLab Rat Posts: 289
    edited 2010-10-21 15:32
    im sorry to say i didnt buy a parallax product to finish this project. but instead i decided to go with PIC because of price and availability but not to be alarmed i am still working on projects with my BS2 because of its simplicity.
  • ZootZoot Posts: 2,227
    edited 2010-10-30 09:12
    I use LEDs as both emitters and light detectors in a number of projects and it works great. A Stamp will probably be too slow to be useful, except when it's dark (because the discharge time then can get quite large). And certainly with variations in individual LEDs, calibration and testing on the bench is required.

    I generally use LEDs in this way with an SX which is fast enough to monitor the discharge. I also usually limit the "longest" discharge (when it's dark rather than bright) as "dark enough" otherwise the system must wait too long between readings.

    See this thread -- http://forums.parallax.com/showthread.php?t=121817

    The LED emitter/light sensor is the single LED that has both anode and cathode hooked up to I/O pins (RC.6 and RC.7).
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-11-12 07:33
    I have use this routine a few times in a few project and it work great
    How ever I play around with the timeing and found that if you made the PAUSE to short or to long it did not work right at all

    Also I found that GREEN LEDs work the best for this

    [PHP]
    dly1 = 1
    dly2 = 50 'Changing This Value Will Change The Light Level Respone
    dly3 = 100
    [/PHP]

    If you make the pause to short then It will not work right


    [PHP]
    DO
    HIGH led
    LOW chg
    PAUSE dly1

    'charge
    LOW led
    HIGH chg
    PAUSE dly1

    'input
    LOW led
    INPUT chg
    PAUSE dly2 'Changing This Value Will Change The Light Level Respone
    DEBUG CR, DEC ? chg
    IF chg = 0 THEN ' what ever you want to do next

    LOOP
    [/PHP]
  • Lab RatLab Rat Posts: 289
    edited 2012-09-30 10:36
    ok so i have been away from this project for quite a long time and i still have the circle shaped led bar displays that i bought specifically for this project in a few weeks i will be buying a propeller programming kit and iw ill figure out how to make it do exactly what i want. i was reading into what was posted above and i seen that Beau Schwabe suceeded with it on the prop so i will be fine tuning his code to try to get it to sense at finger touching the led point instead of a foot away. cause i would like to use this as a variable controller. thats what the initial project was. so i will be reposting as soon as i get the prop kit and try this out
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-09-30 10:42
    I think "Tracy Allen" deserves credit here.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-09-30 11:17
    Aha, this keeps rising like a zombie. It does work in practice just fine on the BS2 Stamp.

    I'm sure I posted the attached program in some other thread, but here is a BS2 demo LEDphotometer. It makes a fine photometer over a wide range of light levels, and the choice of a green LED does seem to be optimal.

    It is an interesting idea you have, to try it with a bar or circle type display. I recall that difficulties with the circuit have to do with picking up extraneous electric fields, so short wiring and shielding are in order to achieve best results.

    [FONT=courier new][SIZE=1]' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' program LEDphotometer.BS2
    ' Tracy Allen, EME Systems
    ' makes an LED act as a photodiode light sensor
    ' and the same LED flashes as feedback.
    ' Flashing rate is proportional to photocurrent.
    ' The period is printed on the debug screen. 
    
    ledP PIN 12    ' anode of LED (long lead)
    ledN PIN 13    ' cathode of LED (flat side, short lead)
    ' Note on circuit. A resistor in the range of 270 to 1k ohm 
    ' should be in series with the LED.
    ' A capacitor of ~100 pf can be placed in parallel with the LED.
    ' More capacitance for brighter light.
    ' No capacitor necessary for dim indoor light.
    
    wx VAR WORD
    wy VAR WORD
    
    
    ' initialize 
      HIGH ledP ' forward bias LED to produce light
      LOW ledN
      PAUSE 200
    
    ' program
    photometer:
      DO
       LOW ledP        ' reverse bias LED, capacitance, photometer
       HIGH ledN    
       wy=-1
       DO
        RCTIME 13,1,wx ' discharge capacitance; measure time
        wy=wy+1 ' it may take more than one cycle
       LOOP UNTIL wx ' until done
       DEBUG CR,DEC wy,".",DEC4 wx**10000 ' show result,psuedoDecimal
       HIGH ledP ' blink the LED, forward bias
       LOW ledN
       PAUSE 20 ' 20 millisecond flash
      LOOP[/SIZE][/FONT]
    
  • Lab RatLab Rat Posts: 289
    edited 2012-09-30 12:08
    ty tracy i will keep this circuit in mind when i get back to pennsylvania. i am currently residing in montana and all of my electronics are in pa so im getting the prop kit to get me back in the game till i can get home.
Sign In or Register to comment.