Led Touch-Sense "Case Re-opened"

Lab RatLab Rat Posts: 289
edited October 2012 in Accessories Vote Up0Vote Down
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

  • 42 Comments sorted by Date Added Votes
  • Lab RatLab Rat Posts: 289
    edited August 2010 Vote Up0Vote Down
    the sensing led is green and my indicator is red and is pointing away from the green led
  • Mike GreenMike Green Posts: 22,371
    edited August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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: 22,371
    edited August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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: 22,371
    edited August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    I guess one just has to believe.
    To Heck with revelation already, I'm still waiting for documentation.
  • Mike GreenMike Green Posts: 22,371
    edited August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    im still at it so far all im getting is a really good metallic touch sensor
  • Mike GreenMike Green Posts: 22,371
    edited August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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,246
    edited August 2010 Vote Up0Vote Down
    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.



    Beau Schwabe -- Metallurgical Machine Design and Development Engineer
    ෴My Message෴www.Kit-Start.com - bschwabe@Kit-Start.com ෴෴ www.BScircuitDesigns.com - icbeau@bscircuitdesigns.com ෴෴

    "If nobody questions your dreams, then perhaps you're not dreaming big enough" - me
  • PJAllenPJAllen Banned Posts: 5,065
    edited August 2010 Vote Up0Vote Down
    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 August 2010 Vote Up0Vote Down
    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,246
    edited August 2010 Vote Up0Vote Down
    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 formatting is messed up on that page, so refer to the [B]lightmeter2.spin[/B] program that he has attached to the link.[code] formatting is messed up on that page, so refer to the lightmeter2.spin program that he has attached to the link.



    Beau Schwabe -- Metallurgical Machine Design and Development Engineer
    ෴My Message෴www.Kit-Start.com - bschwabe@Kit-Start.com ෴෴ www.BScircuitDesigns.com - icbeau@bscircuitdesigns.com ෴෴

    "If nobody questions your dreams, then perhaps you're not dreaming big enough" - me
  • Clock LoopClock Loop Posts: 1,310
    edited September 2010 Vote Up0Vote Down
    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.
    To study the nature of randomness in a digital processor network using the same clock source, 54 prop chips were all connected to a master prop. http://forums.parallax.com/discussion/127983/55-parallax-propeller-s-parallells-processing-of-permanent-perturbations/p1
    Optic communication between homogenous and commensurable, 8-core, 635nm emitting, phase locked loop, bit salad tossing units? http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
    TheBlackBox: Release v2.0 - Propeller HSS FX/Sequencer with Digital Audio SPDIF output. http://forums.parallax.com/discussion/115258/theblackbox-release-v2-0-propeller-hss-fx-sequencer-with-digital-audio-spdif
    E-Tools - Mono555 calculator, resistor calculator, voltage divider calculator, RCtime calculator, LM317 calculator, Binary-Hex-Decimal calculator, Resistor color matrix, Series LED resistance calculator, OHMS LAW calculator.
    http://forums.parallax.com/discussion/81449/e-tools-html-java-script-electronic-design-tools-free-for-you
  • Roger LeeRoger Lee Posts: 338
    edited September 2010 Vote Up0Vote Down
    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.
    This is a signature line ---> Weirdness abounds ! ( I'm sure it will all work out )
  • Lab RatLab Rat Posts: 289
    edited October 2010 Vote Up0Vote Down
    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,226
    edited October 2010 Vote Up0Vote Down
    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).
    When the going gets weird, the weird turn pro. -- HST

    my site: 1uffakind.com
    create bitmap data tool: 1uffakind.com/robots/povBitMapBuilder.php
    resistor ladder tool: 1uffakind.com/robots/resistorLadder.php
    convert images to ascii art: 1uffakind.com/apptoys/convtoascii/
    MC6808/Hero-1 assembler: 1uffakind.com/apptoys/onlinecompilers/MC6800/
  • sam_sam_samsam_sam_sam Posts: 2,144
    edited November 2010 Vote Up0Vote Down
    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]
    Sam
    _________________________>
    Now wanting to learn Spin Thanks for any idea that you may have and all of your time finding them
  • Lab RatLab Rat Posts: 289
    edited September 2012 Vote Up0Vote Down
    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,246
    edited September 2012 Vote Up0Vote Down
    I think "Tracy Allen" deserves credit here.



    Beau Schwabe -- Metallurgical Machine Design and Development Engineer
    ෴My Message෴www.Kit-Start.com - bschwabe@Kit-Start.com ෴෴ www.BScircuitDesigns.com - icbeau@bscircuitdesigns.com ෴෴

    "If nobody questions your dreams, then perhaps you're not dreaming big enough" - me
  • Tracy AllenTracy Allen Posts: 5,954
    edited September 2012 Vote Up0Vote Down
    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 September 2012 Vote Up0Vote Down
    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.