# Blinking led wit variable delay

Thread Starter

#### frucinator

Joined Jun 2, 2016
2
Hi

I need to make a small and cheap pulse generator for a project of mine.

I would need a pin which hast to be approximately 30sec on low and 1sec on high whitch controls a mosfet that acts like a relay and lets trough 5volts to activate something else.

I did some reshearch for the 555 chip and it seems to me that you can get only like 1:1 ratio between high and low.
I know i can make this with an arduino but i would like to make something cheaper and smaller.

I attached a picture which shows what kind of impulse would i like to have. (approx. 30 sec low 1sec high)
and it would be even better if i could make the low time variable.

sorry in advance if i said something silly but i'm not an electrical engineer nor am i a native english speaker

Kind regards

#### MrAl

Joined Jun 17, 2014
7,891
Hi,

What picture?

Can you use a 555 timer IC or do you have to use transistors?

#### Dodgydave

Joined Jun 22, 2012
9,870
Two chips can do this.
1) 555 timer in hysterical mode.
2) Cd4093.

Thread Starter

#### frucinator

Joined Jun 2, 2016
2
here is the picture

#### Attachments

• 29 KB Views: 23

#### crutschow

Joined Mar 14, 2008
26,053
Two chips can do this.
1) 555 timer in hysterical mode.
..................
Sounds like one emotional timer.
Perhaps a 555 timer in the hysteretic mode would calm things down.

#### dannyf

Joined Sep 13, 2015
2,197
30 seconds are kind of long for a RC timing circuit but still doable.

As long as you aren't looking for precision.

#### mtonge

Joined Apr 19, 2016
93
This may require a bit of a learning curve but, you can accomplish this variable timing and output to an LED with an AVR microcontroller. If you can prototype it on Arduino, you can recreate it with an AVR like the ATmega168 or even an ATtiny45. You will need an AVR programmer like the USBtinyISP. I also recommend getting a good book like Make: AVR Programming to get started. This may be the long way to a solution, but AVRs are programmable, relatively cheap, and there is a large community for support. The code would be very simple using the delay() function for the blinker timing. On the other hand, the Related Forum Posts listed below may provide a quicker solution. Hope this was helpful, MT.

#### #12

Joined Nov 30, 2010
18,216
Sounds like one emotional timer.
Emotional? Think about my reaction to using a microprocessor to do what a 555 chip can do.

#### Dodgydave

Joined Jun 22, 2012
9,870
This may require a bit of a learning curve but, you can accomplish this variable timing and output to an LED with an AVR microcontroller. If you can prototype it on Arduino, you can recreate it with an AVR like the ATmega168 or even an ATtiny45. You will need an AVR programmer like the USBtinyISP. I also recommend getting a good book like Make: AVR Programming to get started. This may be the long way to a solution, but AVRs are programmable, relatively cheap, and there is a large community for support. The code would be very simple using the delay() function for the blinker timing. On the other hand, the Related Forum Posts listed below may provide a quicker solution. Hope this was helpful, MT.
A 555 timer is easier than a microcontroller...

#### AlbertHall

Joined Jun 4, 2014
10,783
Emotional? Think about my reaction to using a microprocessor to do what a 555 chip can do.
I'll second that emotion.

#12

#### Bernard

Joined Aug 7, 2008
5,720
This is for high side switching using a LL SMT P Ch. FET, FDS9435A because I have one. If you can use
low side switching with LL N Ch. FET , then invert D1, Source to ground, Drain to - load, + load to +5V. Connect resistor & LED across load.
.

Last edited:

#### splud

Joined Jun 30, 2013
16
A 555 timer is easier than a microcontroller...
This may require a bit of a learning curve but, you can accomplish this variable timing and output to an LED with an AVR microcontroller. If you can prototype it on Arduino, you can recreate it with an AVR like the ATmega168 or even an ATtiny45.
Actually, an ATTiny13A is more than sufficient, even with only 1KB of flash, and the price won't be appreciably different from the 555.

There are several benefits to the uC route here compared to 555:

555 has a higher voltage requirement - minimum voltage requirement is +4.5V. You can drive a uC off of 3.3V or even less (though driving your LED might pose issues at lower voltages), making it easier to run from batteries if that's part of your needs.

Timing can be changed programmatically. Since the ATTiny family has EEPROM, you could implement code to allow you to adjust the timing by providing a signal on an I/O pin. Say you connect a button to a selected pin and power it up with the button providing +V on that pin which causes the code to enter setup mode, and it starts rapidly flashing the LED (to indicate it is in setup), and you release the button which starts it measuring how long to keep the LED off (and it turns the LED off), at the end of which, you depress the button and it starts measuring how long to keep the LED on (and it turns the LED on). You release the button, the timing data is stored to EEPROM and the device restarts using the new timing settings - which it will do whenever it starts from there on out. No swapping out the RC network to make tweaks. The button doesn't need to be a permanent fixture, and the initial values in the EEPROM can be stored when initially programming the device if you know the values you want to use.

Excepting for adjustment purpose above, the uC approach, at least with the ATTiny family, requires no external components. No collection of resistors and capacitors to define the setting - just power and whatever is necessary for driving your output (so LED and current limiting resistor). You can software redefine the settings by re-flashing the device, whereas with the 555, you have to replace the RC network.

By way of comparative example, I have a simple project using an ATTiny which drives an indicator LED and an optoisolator driving a Triac to switch an electric outlet on and off. There's a button input to the uC which turns it on (if the output is off), resets it (if depressed briefly while output is on), or turns it off (if pressed and held while the output is on - kind of like a PC power switch). LED is constant state on until a minute before the timer runs out, then it starts blinking slowly, and at 30 seconds, it blinks more rapidly, before the device (and LED) shuts off.

All the logic is handled within a simple state machine (i.e. table-driven code) running in the uC, at a cost of about 400-500 bytes of flash codespace, and there's still more I/O available if I had something else I wanted to do.

I paid all of about US$0.27 per uC, which makes it a no-brainer to use them for all manner of simple tasks. #### AlbertHall Joined Jun 4, 2014 10,783 Actually, an ATTiny13A is more than sufficient, even with only 1KB of flash, and the price won't be appreciably different from the 555. There are several benefits to the uC route here compared to 555: 555 has a higher voltage requirement - minimum voltage requirement is +4.5V. You can drive a uC off of 3.3V or even less (though driving your LED might pose issues at lower voltages), making it easier to run from batteries if that's part of your needs. Timing can be changed programmatically. Since the ATTiny family has EEPROM, you could implement code to allow you to adjust the timing by providing a signal on an I/O pin. Say you connect a button to a selected pin and power it up with the button providing +V on that pin which causes the code to enter setup mode, and it starts rapidly flashing the LED (to indicate it is in setup), and you release the button which starts it measuring how long to keep the LED off (and it turns the LED off), at the end of which, you depress the button and it starts measuring how long to keep the LED on (and it turns the LED on). You release the button, the timing data is stored to EEPROM and the device restarts using the new timing settings - which it will do whenever it starts from there on out. No swapping out the RC network to make tweaks. The button doesn't need to be a permanent fixture, and the initial values in the EEPROM can be stored when initially programming the device if you know the values you want to use. Excepting for adjustment purpose above, the uC approach, at least with the ATTiny family, requires no external components. No collection of resistors and capacitors to define the setting - just power and whatever is necessary for driving your output (so LED and current limiting resistor). You can software redefine the settings by re-flashing the device, whereas with the 555, you have to replace the RC network. By way of comparative example, I have a simple project using an ATTiny which drives an indicator LED and an optoisolator driving a Triac to switch an electric outlet on and off. There's a button input to the uC which turns it on (if the output is off), resets it (if depressed briefly while output is on), or turns it off (if pressed and held while the output is on - kind of like a PC power switch). LED is constant state on until a minute before the timer runs out, then it starts blinking slowly, and at 30 seconds, it blinks more rapidly, before the device (and LED) shuts off. All the logic is handled within a simple state machine (i.e. table-driven code) running in the uC, at a cost of about 400-500 bytes of flash codespace, and there's still more I/O available if I had something else I wanted to do. I paid all of about US$0.27 per uC, which makes it a no-brainer to use them for all manner of simple tasks.
But:
The OP specified 5V to be switched to his load.
Instead of all this reflashing with new code, or writing complex button pushing code(for a beginner coder) all the '555 needs is one or two pots to set the on/off times. QED

#### mcgyvr

Joined Oct 15, 2009
5,394
Emotional? Think about my reaction to using a microprocessor to do what a 555 chip can do.
Yeah but I want a BMW... Sure my Yugo gets me to work.. But its not as cool..

Today a 555 will do what he wants.. Tomorrow.. Maybe not..

#### dannyf

Joined Sep 13, 2015
2,197
How's that different from an oscillator plus a counter? Or a 4060?

#### KeepItSimpleStupid

Joined Mar 4, 2014
4,388
It's not a 555. It can do long timer delays with a low value capacitor because of the programmability and it's one part instead of 2.

#### dannyf

Joined Sep 13, 2015
2,197
It can do long timer delays with a low value capacitor because of the programmability and it's one part instead of 2.
So can a 555 / oscillator + counter.

4060 is one part too.

#### KeepItSimpleStupid

Joined Mar 4, 2014
4,388
the CSS555 datasheet said:
Astable Operation
(Extended Period or “EP” Mode)
The circuit in Figure 15 employs the internal decade
counter to divide the 555 oscillator frequency by the
multiplier setting. The multiplier value, 10 to 10E6 is
selected by the EEPROM. The 555 analog block is
configured as a free running oscillator, which supplies the
input clock to the counter. The oscillator runs when
RESET is high (logic one) and TRIGGER is low. Each
divide by 10 stage of the decade counter consists of a
divide by 5 followed by a divide by 2. This configuration
provides a 50% output duty cycle no matter which multiplier
setting is selected. Waveforms for this mode are shown in...
You need a programmer http://www.customsiliconsolutions.com/downloads/Standard IC Products/CSS555 EZ Programmer.pdf to set the options of the CSS555. Long time delays with a 555 are nearly impossible to do nicely. 1 uf || 1 uF and a 2 M resistor would be about 4 sec in the one-shot mode.

The CSS555 is NOT a 555 timer.

Similar threads