green led red led help needed

Discussion in 'The Projects Forum' started by tech5563, Sep 30, 2010.

  1. tech5563

    Thread Starter New Member

    Sep 30, 2010
    19
    0
    trying to make a circuit:

    a user will press a single button and a green led will turn on, but randomly instead of the green led turning on a red led(flashing if poss) will turn on and an alarm(buzzer etc) will make a short loud sound whilst the red led will continue flashing until reset by user.

    ps nb: although i know a fair bit about electronic components and am ok with a soldering iron, this will be my first build(done many repairs but never a build of my own)

    thanks in advance for any and all help
     
  2. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    A little better description would help. Break it down in terms of time.

    What is random about the LEDs?
     
  3. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    I think he wants a "Russian Roulette" circuit.
    Every time the button is pressed, the LED will light..Green for "no bullet" or a random red for dead ;)
     
  4. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Well explained, Retched.

    Set up an oscillator running at some fast rate. Make this drive a divide-by-something counter (8 or 16 would be easiest). Pressing the button stops the counter and activates an LED. The LED will be red if the counter happens to stop on 0, otherwise green.

    Latching the output until you hit a reset would be easy to do, or you could just have it restart when the button is released.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Actually, a 4017 Johnson counter would work well for an arbitrary divide-by counter (from 2 to 10) - one could build the thing using that, a 4093 quad Schmitt-trigger NAND, some resistors & caps, and a pushbutton switch.
     
  6. tech5563

    Thread Starter New Member

    Sep 30, 2010
    19
    0
    yes indeed great description of what i need retched
    and thanks JOHN P great idea i now have at least a basis for my project thankyou everyone
     
  7. wayneh

    Expert

    Sep 9, 2010
    12,151
    3,058
    You could also call this a "Mexican customs" light. This is exactly how they pick which bags to search when you arrive at customs in the Mexico City airport. It's nowhere near 50:50, thankfully. The more cynical among us suspect the light is actually controlled by an unseen observer.
     
  8. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Did you say 'thankfully'? ;)

    I have a feeling crossing customs is going to be much harder for you now. ;)

    Have you ever read the "Google/Customs" conspiracy theory?

    Customs uses the searches that you preform on Google to decide weather or not to check your bags or question you. So, now, because AAC is crawled by google, and your IP is attached to your post, It is all down hill for you. ;)


    ....I mean...if you believe in that stuff...
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's what I was talking about:

    [​IMG]

    U1a, R1, C1 comprise the clock for the 4017. Pressing S1 causes the clock to stop.

    U1b, R8, C2 is the astable timer for when O0 winds up being the selected output, causing it to flash and the buzzer to beep.

    Not shown are 0.1uF metal poly film or ceramic bypass capacitors for each IC, which are required.
     
    Last edited: Oct 1, 2010
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yep, easy modification.

    [​IMG]
     
  11. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    I suggest this circuit. It's economical with components and wiring, and the odds are adjustable.

    The lines shown as "INPUT A-D" are intended to be driven with a binary code, creating the number 0-15 encoded with a 1 as Vcc and a 0 as Gnd. This could be done with pullup resistors and switches to Gnd if you want adjustability, or just wired for one number if you're sure you know what you need. The code gives a probability of getting the red light when the button is pressed:

    0: 1/16
    1: 1/15
    2: 1/14
    .....
    13: 1/3
    14: 1/2
    15: Certainty!

    [​IMG]

    Note that the LEDs must be able to withstand 5V in the reverse direction. Almost all LEDs can do this, but it's best to be sure.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Variation on a theme:

    [​IMG]

    Odds are nearly infinitely variable via pot R2; from almost always red/buzzer to almost always green.

    Not shown is a required 0.1uF (100nF) cap across the 4093's power pins.

    One 4093 quad Schmitt-trigger NAND gate, 6 resistors, 1 pot, 3 caps, 1 NC pushbutton switch (can use 1 NO pushbutton instead if R1 connects to Vdd and S1 connects to GND instead), 2 1N4148/1N914 diodes, and a transistor to drive the two LEDs and a buzzer.
     
  13. tech5563

    Thread Starter New Member

    Sep 30, 2010
    19
    0

    this schematic looks great i have been playing around with it, only thing i am not sure about is 1) U1F and U1E are not joined into the schematic is this an error?? 2) i cant seem to figure out where i would put a buzzer IE: red light on and siren sound or loud beep. thanks for all your help fantastic work all you guys helping out us newbies :)
     
  14. n1ist

    Active Member

    Mar 8, 2009
    171
    16
    U1 has 6 inverters in the package; the circuit is only using 4 of them. You do not want to let the inputs float (especially with CMOS) so tying the inputs of the unused gates either hi or lo will put them into a known state.
    /mike
     
  15. tech5563

    Thread Starter New Member

    Sep 30, 2010
    19
    0
    thnx n1ist

    now all i need to finish my project is to get the red led to stay on longer(say 20seconds or when a reset is pushed) and an alarm(siren or loud beep just the one short beep) and i will be over the moon...


    BTW is there some way i could make a donation to the site for all there help??
     
  16. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Saying thanks is more than enough.
     
  17. tech5563

    Thread Starter New Member

    Sep 30, 2010
    19
    0
    i would like to say a big thankyou to everyone on this site for not only helping me but in all the help they give everyone who visits here
    THANKYOU:)

    i know the following statement is not electronics related
    but if anyone needs help with there computer i would be only to glad to help, i have been a pc technician for 32 years..


    THANKYOU ALL
     
  18. tech5563

    Thread Starter New Member

    Sep 30, 2010
    19
    0
    can anyone see from these pics whats wrong,...the green led comes on as soon as power is on and when i press the button it just turns the green off and comes on again when i let go of the button

    http://www.data-restore.biz/pic1.jpg
    http://www.data-restore.biz/pic2.jpg
    http://www.data-restore.biz/pic3.jpg
    http://www.data-restore.biz/pic4.jpg

    when i press the button its supposed to make the green or red light come and stay on for about 10-15 seconds then reset i want to add a buzzer to the red light later too :D

    schematic by john p
     
    Last edited: Oct 29, 2010
  19. tech5563

    Thread Starter New Member

    Sep 30, 2010
    19
    0

    i have just put this together on a breadboard but all i am getting is the green led is on all time but after about 2-3seconds the red light comes on and the buzzer buzzes the only difference in my circuit is that i only have a 100k pot to hand so am using that, will that make much of a difference?
    thanks in advance..
     
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, 100k for the pot should be fine.

    One thing I'd change would be to replace R3 with a 3.9k, 4.7k or 5.1k resistor - but even if you didn't change the resistor, it still should work.
    [eta]
    Wait a minute - what value did you use for C1?
    I have 10nF shown, which is 0.01uF.
    If you used a 10uF cap, that would cause the symptoms you're seeing.
     
    Last edited: Nov 2, 2010
Loading...