Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

My 1st project - To cycle through 7 LEDs with push button

Status
Not open for further replies.

B Foulk

New Member
I'm new to the world of electronics and circuitry, but I am familiar enough to learn with help. Thank you in advance for any assistance.

the end result - use an on/off switch for constant power to the LED; then with the push on a momentary button, cycle through seven LEDs. When the unit is powered off and then powered back on, the unit will need to light the same LED that was on prior to switching off the unit.

the reason - I have an emergency strobe light system installed in my truck (its a cheapo from amazon), but works well. It has 7 flash patterns, and utilizes an on/off switch combined with a momentary button that cycles through the patterns. Alas, I have no way of knowing which pattern is selected or how to get to a particular pattern.

I would prefer to not open the main control module and tap into it's circuitry
 
Hi B Foulk, welcome to ETO!

When I hear "cycle through 7 outputs at the push of a button" I automatically think of the 4017 decade counter, with Output 8 connected to the reset pin. However, off the top of my head I can't remember if the outputs latch or not. Might be worth looking into, anyway. Here's a quick demo I made for someone a while back showing how a pushbutton is wired to the 4017 to cycle through the outputs:


If the 4017 doesn't have latching outputs, I'm sure you could find a similar chip that does, or use some external latching circuitry.

Hope this at least puts you on the right track :)

Regards,
Matt
 
A supercap or battery could be used to keep the 4017 alive.
Or better still but less practical for a noob would be a microcontroller and store the psoition in memory.
 
B: I'm gonna send you to www.picaxe.com and look around. These are PIC microcontrollers programmable in BASIC. You don't have to use LEDs, but a single 7 segment digit might do.

FRAM memory **broken link removed** retains it's state when powered off.

Have the PICAXE receive the PB signal, keep track, and display the 1-7 or whatever, and have it re-create the PB for the lights.
 
After spending several hours researching the 4017, it may be the easiest route and most simple for a first project. I believe the basis for the project have been covered; thanks to DerStrom8 for the introduction, wiring diagram, and guidance, and thanks to dr pepper for the practical knowledge of how to make the 4017 "remember" it's last output. (during my research, I stumbled back to ETO through google to find another thread discussing this very issue 4013 and 4017 output behavior).

Once I have a working model, I'll look into the PIC microcontrollers as a second project <-- this seems like the way to go for the advantages of space and actual memory, not to mention the number display rather than LEDs.
 
The 4017 power supply current is extremely low so you can leave it powered all the time but with the LEDs it drives unpowered. Then it will remember its last setting.
Each LED should have its own current-limiting resistor to prevent the 4017 from burning inside. Some circuits show a single resistor feeding all of the LEDs which is bad because it causes the LEDs that are turned off to exceed their maximum allowed reverse voltage rating.

How will you obtain the proper ground to positive pulse from the existing momentary pushbutton switch to trigger the 4017?
 
I would prefer to not open the main control module and tap into it's circuitry
Then, like Audioguru, I don't see how you can get your circuit to respond to the existing pushbutton :confused:.
 
How will you obtain the proper ground to positive pulse from the existing momentary pushbutton switch to trigger the 4017?
I will wire the existing push button to the 4017; the 4017's ground will then be wired into the existing ground wire (which grounds the entire unit, including the push button)
Then, like Audioguru, I don't see how you can get your circuit to respond to the existing pushbutton :confused:.
The strobe unit has wired remotes (on/off & momentary); I'll wire into the remote to add this system ... as opposed to using the circuitry in the main box.

Each LED will have it's own resistor

IMG_5130_zpsmpj6um5z.jpg


(pictured: the remote box: red = power, white = positive pulse input, black = ground)
I will solder a red/white wire to the same terminal as the white. It will then connect to the 4017 clock. The 4017 clock will also have be wired to an external battery source (extremely low voltage). The 4017 ground will be wired to the black (twisted) wire in the center of the box)
 
I'll post a wire schematic later this evening/tonight, and hopefully a video of the working model! doubtful, lol.
 
The ULN2004 https://www.google.com/url?sa=t&rct...=KiqvSWVl-8cI7axrfmZ-dg&bvm=bv.88198703,d.eXY is not a bad driver IC.

The COM terminal is actually used for relay coil suppression, and it's not needed for LED driving. The chip only requires a ground connection.

The one thing that you will see quickly is mechanical switches "BOUNCE" and each push will result in a random number of events unless you debounce the contacts.

You should check to see what the open circuit voltage is on your existing switch. Single switches are usually interfaced with pull-up or pull-down resistors and thus the OEM circuitry could be looking at a rising or falling edge. Strict CMOS logic is very picky about logic levels. They have to be very close to the power supply rails.
 
Probably too daunting for a 1st project, but if you're going to open the unit and apply a PICAXE you might as well create your own controller with it. That way you can output the mode to your display and know for sure that is the mode being run.
 
The 4017 is a digital counter and is designed to count things that occur at many different speeds. The existing pushbutton switch contacts will bounce maybe 10 or 15 times then the 4017 will count each bounce. Then a debounce circuit must be added between the pushbutton switch and the clock input of the 4017.

We do not know what the existing circuit will do to the high and low voltages of the pushbutton switch then the 4017 and/or debounce circuit might not do anything.
 
I have done emergency vehicle lighting not with a picaxe, just a ordinary 8 pin pic, its not that difficult to do.
 
Assuming that the existing pushbutton switch connects between +12V and an internal pull-down resistor in your strobe unit, here's one way of doing the switch contact de-bounce for triggering the 4017.
Sequencer.gif
 
You asked about buying parts, but that opens up another can of worms. The two major distributors in the US are www.digikey.com and www.mouser.com
Case, connnectors and prototyping materials are another matter. Surface mount (SMT) is replacing through hole components rapidly. There are sometimes adapters that convert a surface mount device (SMD) to thru-hole. See **broken link removed**. Then there are wire poking non-permanent breadboards. I answered the question generally. Then there is making your own PCB (Printed Circuit Board). Proprietary layout and (Gerbers and drill file) systems exist. Somewhat free (Cadsoft Eagle), free (KiCad) and really expensive stuff exists. Places overseas can do boards reasonably.
 
Last edited by a moderator:
I buy parts from Digikey and Newark. I never bought anything from Mouser.
EDIT: Oh yeah. The OP does not say which country he is in. He should go to www.farnell.com and click on the flag of his country. Most of their locations are called Element 14 but they bought Newark and left its original name.
 
Last edited:
Assuming that the existing pushbutton switch connects between +12V and an internal pull-down resistor in your strobe unit, here's one way of doing the switch contact de-bounce for triggering the 4017.
View attachment 91414
Your counter is /8 move tap to get /7
CD4017 only drives 1 mA high ,
so you will need 7 inverting buffers to drive Cathodes low., Best bet ULN2002A/ or...4A
Then 7 current limiting R to say 12mA.. 14-2V=12V , thus 1K
CD4017 needs diode to protect against reverse boost voltages and transorb for ACU clutch spikes with big cap for interruptions.

But as said before CD4017 is powered up all the time and all LEDs (Anodes) are on switched ignition power to save 12mAh juice which isn't all that much and with HB LEDs could be reduced to 2mA and left on all the time.

Momentary switch to Clock is positive logic so switch between V+ and clock with cap and R pulldown to ground on CLK.
To sync 7 LED counter with external ring count.

You can use the same switch but use a 1M series R to 10uF cap to Reset. Then external count is on 1st LED but something other than 1st LED (Q0) is on press the CLK button and HOLD for 5 seconds to RESET LED to 1st position.
 
CD4017 only drives 1 mA high.
Nope.
The datasheet from Texas Instruments shows a typical output directly into a 2V red LED with a 10V supply is about 18mA and with a 12V supply it is about 23mA which is high enough to melt the output transistor that has a max dissipation of 100mW.
Then with the 12V supply the output transistor will have 10V across it and 23mA and will try to dissi9pate 10V x 23mA= 230mW. Use a series resistor to share or reduce some of the heat.
 

Attachments

  • CD4017 driving an LED.PNG
    CD4017 driving an LED.PNG
    28.3 KB · Views: 320
My bad, yes ESR is around 500 OHms internal but at 14.2V for 3V LED this only disspates 50% of DIP16 capacity of 500mW.

I just read the table.

Corrections below. You can add choose Series R= 0.2K ~1K according to desired brightness.
LED has ESR of 15 Ohms or so.
upload_2015-3-18_21-2-8.png


Also at 25'C Ioh=-2.6mA should be used. for 10V
Your mileage may vary.
 
But then how does one disconnect LED power and keep Counter chip ON when using a High side driver?
You cant. Because the COmmon Cathodes are grounded and the Chip drives on high side.

Hence thats the better reason to use ULN 2002/2004 is to invert and drive the low side so the Common Anodes to V+ can be switched power.

AND DONT use a pullup to continous 12V power as reversing the Vled to -12V is sudden death to at least one LED or at least infant mortality as all are rated -5V absolute MAX.


Thats what I meant anyways... :):cool:
 
Status
Not open for further replies.

Latest threads

Back
Top