LED/Switch Project

Discussion in 'General Electronics Chat' started by Viper5, Jul 3, 2009.

  1. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    I need some advice on using LED's. Basically, I want to build a simple circuit with a RGB LED which at the push of one button, it can make the lights go from red to green to blue (not continously), and with the push of another button, make it go in reverse order. Is anyone familiar with this sort of thing? I guess it's kind of like on a cellphone where you can adjust the color of the backlight. If you hit one button, it will go through a set rotation (such as up button), and another button will go in opposite rotation (such as down button). Thanks in advance.
     
  2. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Have you read this?

    LEDs, 555s, Flashers, and Light Chasers

    What you want to do is easy enough, but digital in nature.

    You want 3 states, and to be able to count up or down in those three states. Correct?
     
  3. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    That is correct. I briefly looked at that link you provided. It seems that I need one of those CLK, Output 1, 2, 3 devices but I may be mistaken.
     
    Last edited: Jul 3, 2009
  4. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Let me think about it, you need a CLK UP, CLK DOWN, counter with 3 outputs. While I consider it simple you might find it pretty challenging. Have you ever used a protoboard?

    I personally haven't done this before, so someone else might have a better idea. I think it will take around 3-4 chips and a couple of transistors.
     
    Last edited: Jul 3, 2009
  5. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    My experience consists of EE I and II with a lab in college so I sort of know about the clock stuff but I only really knew what I needed to, to do well in class. Let me know if/when you come up with something. I was thinking about stopping by my school next week to talk to one of the EE professors about it.
     
  6. millwood

    Guest

    this sounds like a perfect job for a little mcu. a lowly 12f675 can do it in a flash, literally. and you can further apply pwm signal to the LEDs to change their intensity and create many color combinations - which I just did.

    i am happy to show you the code if that's the approach you want to go down. just one chip (12f675 in 8pdip packaging), and a few resistors + the leds. cannot beat that.
     
  7. pradeep d rajmane

    New Member

    Dec 22, 2008
    4
    0
    just use decade counter and reset after count of three and use q0 q1 and q3 for ur three leds
     
  8. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    And how would you count down?


    OK, what other accessories are needed to program this sucker? I've never done it, so you have the floor. Remember that the OP is new to this, that is my assumption at the moment at least.

    When I have time I'll draw something up using discrete logic, if it is still wanted. 4th of July is a major holiday in the USA, so I'm going to be with my family for a while.
     
    Last edited: Jul 4, 2009
  9. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    Thanks everyone for the response. When you say you will show me the code, are you saying I need to program a chip or something? I know a little programming, but thats about it (c/c++/graphing calculator).
     
  10. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    It's definitely something I want to pursue so let me know whenever you figure it out.
     
  11. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Sorry, I haven't forgotten you, but I've been kinda bogged down.

    Post #7 (Pradeep D Rajmane) has a valid point. A CD4017 or a CD4022 can count in one direction, and you only have 3 states. Two designs that occur is a single button arangement, or if you must have and UP/DWN the DWN button sends two pulses (with a second chip).

    After that it gets problematic how many chips it will take. The project has my interest, either a simple shift register or a constrained ripple counter would do it too, with several chips. If you didn't understand the last two names don't worry about it, they are just technical names for 2 different types of counters that can go up and down.
     
  12. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    I understand the idea, but I haven't built anything of that nature before. If I had a schematic of some sort I could go from there.
     
  13. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    OK, here's the 1st schematic, I'm thinking 4 total. Basically the simpliest. You didn't say what kind of RBG diode you use, I assumed common anode, but common cathode is also easy to do.

    [​IMG]

    Each push of the button the LED will switch, the 4017 toggle on the positive transistion. With changes a 4022 could also be used. You may have said, but I don't recall the power supply voltage you will use. I could also use the Vf of each diode, and the recommended current of each LED, to calculate resistor values.
     
  14. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    Ok, looking at the schematic it appears that what I want is clearly designed. It'll be a common anode as you suspected and it's for a circuit where it typically illuminates a 12V 3W bulb. How do I incorporate an LED (knowing what range of data such as V and W I need to not burn out my LED and get a well desired brightness)?

    Also, the only thing I can't figure out is how much capacitance/resistance do I need? I know there are calculators for the resistance such as here:
    http://ledcalc.com/ and from the schematic it looks like I should just use 1 LED as my amount since there will only be 1 on at a time but I have no idea how much capacitance. Finally, I need a good location to purchase the U24017 chip. Thanks for your help.
     
  15. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Well, the diodes should have a spec sheet. I need the power supply voltage, then I can get you in the ballpark. As a general rule of thumb LEDs are pretty consistant, unless they're really old, so I can fake it if you don't have the specs.

    This circuit won't approach 3W, so measure the voltage without a bulb. Is one set of LEDs going to be enough?

    With some minor modifications you can step through other color combinations (up to 10), which would give you other colors. RGB covers the entire human color spectrum, including white.
     
  16. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    It's for my car so I'll need to look over my service manual for the electrical diagram. I'll get back when I know what it is. Obviously, the car runs off the 12V battery, but there might be resistors in between so I don't know if it's getting the full amount. Maybe I'll scan the page with this info so you can analyze it if I have a hard time figuring it out.

    EDIT: The manual doesn't appear to be very useful in this dept. All that is revealed is....

    Bulb ---I / 11 .5 Gr/Bl

    As mentioned before though, the bulb is a 12V 3W (Although I switched it with a 4.9 W to make it a little brighter)
     
    Last edited: Jul 11, 2009
  17. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    <shakes head> This is not an insignificant detail, but it answered my questions. A vehicle generally has 13.6V while running, and 12V when the engine is off. I don't know what the bulb you keep referring to has to do with anything, but you won't be able to use this (or any circuit) is series, so I'm not going to worry about it, since an LED is not a light bulb.

    [​IMG]

    Parts List
    R1 - 10KΩ ¼W 5%
    R2,3,4 - 4.7KΩ ¼W 5%
    R5 - 560Ω ½W 5%
    R6 - 510Ω ½W 5%
    R7 - 470Ω ½W 5%
    C1 - 1µF Capacitor (non critical)
    U2 - CD4017 CMOS IC
    Q1,2,3 - 2N2222A NPN transistor (non critical, any low power switching transistor will do).
     
  18. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    The application is for my instrumet cluster. I guess I should have mentioned that in the beginning.

    Some questions to things I don't quite understand:

    1. Why is it necessary to have a resistor before and after transistor?
    2. Aren't resistors dependent on the LED being used so how do you have values for them?
    3. I don't see how there is one button for going up and one for going down (only an S1)
    4. Why is a capacitor necessary?
    5. How did I answer your questions about voltage since the bulb may not be getting 12V or even 13.6V?
    6. What did you mean about not worrying about using this circuit in series. I know what series means, but I think you were talking about the LED/Lightbulb configuration and I didn't quite understand.

    I'd like to learn from this experience so that in the future I may be able to do something on my own. Thanks again.
     
  19. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    1. Because that is how transistors work. Base resistors limit current to and through the base, and LEDs need their current limited too. Two jobs, two resistors.

    2. I'm frankly guessing, but it is an educated guess. Best I could do without the data sheet on the LEDs, which I asked for.

    3. Going down is more circuitry. I'll work on it if you want, but the chip in question goes one way only. Press once for one color and twice for the other.

    4. It's called a debounce capacitor. Buttons and other human interface devices tend to make and break several times very quickly when you press them, and that 4017 will faithfully catch each time and count it. The cap make it where you press once, it will only see once.

    5. You didn't really, but that's the way to bet. If you find out differently I'll adjust the values of the resistors, all of them.

    6. I have no clue how you're using this circuit. If it is in series with other components, such as a light buld, then it likely won't work. I go with the information I'm given.

    That article I pointed you to explains most of how I designed this. Read it, and then don't be afraid to ask questions.
     
  20. Viper5

    Thread Starter Member

    Jul 3, 2009
    13
    0
    I thought you needed the voltage going through the light bulb. If you just need the LED info I can get that for you.

    I'll probably just buy them from superbrightleds.com or another similar place. If I were to use that website as an example, however, I would most likely use the smallest ones they have (3mm) unless there is another place with even smaller ones. I'll probably get one of each color (white, blue, green, aqua, red, yellow, and orange). I don't have a lot of space to pack all of the led's I'll be using but I don't want to sacrifice intensity for size. Looking at the intensity values though it doesn't seem like that should be a problem since diameter doesn't appear to limit this area.

    I'm looking for something that will match the brightess of my current 14V 4.9W light bulb. I also forgot to mention that there are currently 2 bulbs and thus I need 2 LED's for each color and need to integrate both of the same color together in the circuit (i.e. 2 blues, 2 greens). I don't know if series or parallel is appropriate for that. I'm guessing series.
     
Loading...