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
 

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
87
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.
 

Dodgydave

Joined Jun 22, 2012
8,472
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...
 

Bernard

Joined Aug 7, 2008
5,288
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.
.Thirey Second Tie 00000.jpg
 
Last edited:

splud

Joined Jun 30, 2013
12
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
8,539
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.:mad:
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.. ;)
 
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.
 
Top