LED blinking question - Page 1
Forum section: electronics / beginners

author: caius
author_rank: Regular Contributor
timestamp: November 28, 2022, 10:28:41 pm
content: Hi all,I have the need of blinking a LED when certain logic conditions are satisfied (specifically when a signal is low and another one is asserted).The simpliest solution is to use a MCU (or a PIC) but I think it's a waste for such small task.I tried the monostable timer with 555 like explained here :https://electronzap.com/brief-555-timer-monostable-one-shot-mode-circuit/It works fine but only with one condition is satisfied (a fixed low signal)Thanks in advance for any suggestion or help.

author: IanB
author_rank: Super Contributor
timestamp: November 28, 2022, 10:33:09 pm
content: Use a blinking/flashing LED so you don't need any extra circuits at all?

author: james_s
author_rank: Super Contributor
timestamp: November 28, 2022, 10:33:29 pm
content: Have you considered just using a blinking LED, the kind with a built in IC to handle the blinking? Then you just need a logic gate. A single AND gate with an inverter on one of the inputs ought to do. You could use an IC with multiple NAND gates to accomplish the same thing.

author: themadhippy
author_rank: Super Contributor
timestamp: November 28, 2022, 10:39:03 pm
content: Quotewhat state is the asserted one? if its also low the a nor and flashing led,or use the left over nors as an oscilator to flash the led

author: caius
author_rank: Regular Contributor
timestamp: November 28, 2022, 10:42:58 pm
content: Yes, I considered to use a blinking LED but the probem is that the LED is used on another circuit does not require blinking.I forgot to say that the assertion of one of the two signal is ~2.5us (while the other one is fixed low)

author: caius
author_rank: Regular Contributor
timestamp: November 28, 2022, 10:45:25 pm
content: Quote from: themadhippy on November 28, 2022, 10:39:03 pmAs said, the state of the asserted signal is low (the signal is active low) and the assertion is ~2.5us.

author: james_s
author_rank: Super Contributor
timestamp: November 28, 2022, 11:02:43 pm
content: So it sounds like you need to use that signal to load a latch.The flashing is trivial, any sort of oscillator can flash an LED. If you need to use the LED for other purposes you can use a logic gate to gate the flash signal. For example, if you want a logic high to make the LED flash, feed the oscillator to one input of a AND gate and the enable signal to the other.

author: caius
author_rank: Regular Contributor
timestamp: November 28, 2022, 11:15:41 pm
content: This is the logic : if signal 'A' is low when signal 'B' is asserted, the LED blink. If signal 'A' is high when signal 'B' is asserted, the LED stop blinking.

author: caius
author_rank: Regular Contributor
timestamp: November 28, 2022, 11:29:22 pm
content: Perhaps a latch like a 74LS373 can do the job?

author: james_s
author_rank: Super Contributor
timestamp: November 28, 2022, 11:43:53 pm
content: Quote from: caius on November 28, 2022, 11:15:41 pmSounds like a D flip flop is what you need. Signal A goes to the data input, signal B goes to the clock input. Take the output of the DFF and AND it with the output of whatever oscillator you use.

author: EPAIII
author_rank: Super Contributor
timestamp: November 29, 2022, 04:47:11 am
content: While there may be some 555 trick circuit that would do what you want, I don't know of it. And it is not in the 555 Cookbook. So I fear you will need two ICs as James suggests. You describe the classic case of a data latch, triggered by a clock or trigger pulse. The D flip flop is made just for that. Then the 555 or some other oscillator can be triggered by it;s output.But a single chip u-processor (PIC) can do it all by itself and with a lot less additional components. This is an inexpensive one that is easy to program. And the first program in the manual is for a blinking LED.https://www.sparkfun.com/products/10803Another thought is to use the 556 timer IC which has two 555s in one package. The first one can be used as a flip flop while the second one will flash the LED when enabled by the output of the first. I was unable to find a ready made circuit for this, but it can probably be done. A PIC processor would still be simpler because of the number of other components (Rs and Cs).Quote from: james_s on November 28, 2022, 11:43:53 pm

author: james_s
author_rank: Super Contributor
timestamp: November 29, 2022, 05:00:32 am
content: Easiest single IC solution probably is a microcontroller, something like one of the tiny little SOT-23-5 packages. I do see the appeal of doing it in hardware though.

author: caius
author_rank: Regular Contributor
timestamp: November 29, 2022, 09:49:42 am
content: I tried the circuit with a D flip-flop and a 555 as oscillator, it works fine.Like you all said, I coud save some parts and use an IC instead.Anyway, since I will use a CPLD to embed all the logics, I want to do an oscillator with gates instead of using a 555.Which could be a good design to achieve it?With NAND or inverter gates?

author: Zero999
author_rank: Super Contributor
timestamp: November 29, 2022, 01:44:19 pm
content: Which flip-flop IC did you use?The CD4013 can be configured as an astable. I've tested the circuit below with the CD4013. It might also work with the 74HC74, but not all brands.

author: Terry Bites
author_rank: Super Contributor
timestamp: November 29, 2022, 03:28:11 pm
content: Everyone. You need to get past this 555 thing and the evil torturing FFs.Get some therapy.Any old CMOS nand will do! If you dont have one get a tiny logic or other baby loner.

author: caius
author_rank: Regular Contributor
timestamp: November 29, 2022, 05:39:34 pm
content: Quote from: Zero999 on November 29, 2022, 01:44:19 pmI used a 74LS74 current sourcing which triggers a 555.Anyway, I also used a 74LS74 current sinking and a blinking LED instead of the 555.Both designs are working fine, I attach schematics.

author: james_s
author_rank: Super Contributor
timestamp: November 29, 2022, 05:44:00 pm
content: Quote from: caius on November 29, 2022, 09:49:42 amIs there a clock in the design? If so you can use a counter to divide it down to a reasonable frequency to blink an LED. It doesn't take a crazy amount of stages to divide down tens of MHz even.

author: caius
author_rank: Regular Contributor
timestamp: November 29, 2022, 10:07:54 pm
content: Quote from: james_s on November 29, 2022, 05:44:00 pmYes, there is a 8MHz clock signal feeding a MCU (which has no spare GPIO, otherwise I woud have used it for LED blinking).

author: james_s
author_rank: Super Contributor
timestamp: November 30, 2022, 12:04:34 am
content: Divide that down and use that to blink the LED. You can use something like this:Clock_div: process(clk)beginif rising_edge(clk) thenClkCount <= ClkCount + 1;clk_slow <= ClkCount(6);end if;end process;

author: Terry Bites
author_rank: Super Contributor
timestamp: November 30, 2022, 07:29:08 am
content: I've got spare PC. I just put a serial port card in it. Now I can test for logic levels- I usually get the whole screen to flash!Now, where is my IOT logic probe....?