The Best of Both Worlds: Arduino + 555 Should Confuse Commenters

Hardly a week goes by that some Hackaday post doesn’t elicit one of the following comments:

That’s stupid! Why use an Arduino when you could do the same thing with a 555?

And:

That’s stupid! Why use a bunch of parts when you can use an Arduino?

However, we rarely see those two comments on the same post. Until now. [ZHut] managed to bring these two worlds together by presenting how to make an Arduino blink an LED in conjunction with a 555 timer. We know, we know. It is hard to decide how to comment about this. You can consider it while you watch the video, below.

On the plus side, there probably is a use case for this. The LED will blink with absolutely no intervention from the Arduino. You could put the Arduino in deep sleep, if you wanted to and that LED will still blink. With a little work, you could probably adapt this idea to any number of circuits out of the 555 playbook, like a PWM generator, for example.

There’s almost nothing a 555 can’t do. If you want to see what’s under its expressionless face, this teardown is an interesting read. We just hope the comment section doesn’t overload like a Star Trek computer being asked by Captain Kirk to compute every digit of pi.

109 thoughts on “The Best of Both Worlds: Arduino + 555 Should Confuse Commenters

  1. Forgive the horrors, but I’ve used Arduino + 555 on occasions when driving MOSFETs with higher (non-logic level) Vth levels. The 555 makes a decent push-pull output that will drive the MOSFET fully on/fully off reasonably hard and fast. I know I could get a dedicated driver but that was what I had on hand. :)

        1. Exactly, chap ones like the ‘817 can vary between 50% and 600%, which makes a whole lot of difference.
          Plus, you sometimes need to turn that MOS ON/OFF really fast with a lot of charge and might need current in the A range for brief times, something opto couplers will not do.

    1. I’ve also seen two 555’s being used to create the ‘band gap’ necessary for a dual bipolar driver (inverter). That way a micro-controller brown out or reset wont make the output stage explode.

      1. Because you might need the timers and interrupts to communicate with a sensor or generate some pulse train that may glitch because of your blinker interrupt holding up the CPU just when it is supposed to trigger.

          1. The Atmel microcontrollers are more sophisticated than that, as are all others I’ve ever worked with. If an interrupt comes in while another interrupt is being processed (and how long does it take to process “invert state of LED”, anyway?), other interrupts are held, and interrupt the processor as soon as interrupts are enabled again. So this would only be a problem in this application if two drops of water fell past the sensor during the couple of microseconds it takes to service the “blink” interrupt, causing one water drop to be missed.

            And if this was a product in the real world, trying to add a self-flashing LED to the company’s inventory would probably get you a “try again” from your boss.

          2. Yeah, you typically can only get away with a couple of ISR’s before stuff gets out of hand. If you’re a programming god, you can pull off a lot of really crazy cool stuff with ISRs. But for mortals, you can end up in ISR purgatory real quick. Nothing wrong with using a perip-chip now and then. I mean if someone used a 74HC595 or MCP23XXX or a WS2811 no one would bat an eye at it. Sometimes good ol’ logic chips or analog chips along side a micro is just what the doctor ordered IMHO.

          3. >””So this would only be a problem in this application if two drops of water fell past the sensor during the couple of microseconds it takes to service the “blink” interrupt”

            That will be a problem. Suppose you’re generating a pulse train that has to operate at some arbitrary frequency without fail. When you have two interrupts running at two different frequencies, they will drift in phase relative to one another and unless the timing is carefully chosen the interrupts will periodically overlap.

            It’s a simple matter of two periodic waves having a beat frequency between them.

        1. In the exemple above it is not the blinker to put on interrupt, it is a low priority task. The task to put on interrupt is the drop detector which is the high priority task. In the exemple above the same result could be obtained without the use of a 555.

          1. Exactly what I meant…it would be extra silly to blink an indicator from an interrupt.

            But judging by the comments above we are in fact missing the point jacques1956.

            At any rate it is creative and ISR programming can be tricky.

          2. So you’re suggesting putting the opto on the interrupt and running the LED blink in a timing loop?

            (wait for it)

            “That’s just stupid.”

          3. The entire problem here is that Arduino programmers aren’t very good at it. They think they _have_ to use a busy-wait delay to blink a LED when they could be just checking the value of some timer in the main loop – whenever there’s free time – to see if it’s above or below a number and set an output pin accordingly.

          4. Exactly Dax, although I don’t know that calling them bad at it is necessary…just new. Polling the miliis() seems unnecessary when there is a built in delay function, until you are doing something timing critical.

            But there are always multiple paths to the same end and some work better for different people or applications. At the end of the day, if it works and you understand how/why it works that’s what matters. Any design can be improved upon as needed.

  2. Now I am being misquoted. What I have always said is, “why use an arduino when a $2 ARM board will do the job better and cheaper”. Now how you blink a light “better” is not clear, but every analogy falls apart at some point.

    This little project runs along the lines of using as many parts possible to do something. Let’s see it done with as many discrete transistors as possible, or maybe use a tube circuit to blink an LED. I am sure I am missing something in this “hack”.

          1. Buy ’em 10 at a time for less than the price of an Arduino and get a 32 bit ARM with some pretty nice analog input (2 channels, 8 bit, 1 us), and other goodies. Order an St-link gadget on Ebay while you are at it and go to town with them.

      1. Yeah baby, but them are some big caps. Everything of that size in my drawer has a plus end designated. I gotta think hard about just how that works in your circuit and I am too lazy just now. Like them blinking lights though.

      2. Did something like that around 1983 – with help of my father :-) But I remember the 100 Ohm resistors in series with the LEDs, and of course European transistor types, probably BC107

  3. I have in the past used a 555 to turn on and off a micro for quick calculations and transmitting
    Of course now days they make arm processors that can wake them selves after some time but it was still a fun project

    1. Did this some 15 years ago with a PIC12 and it’s internal watchdog timer. For the current consumption of the 555 I probably could have left running 10 PICs all the time (at 32kHz). At least the standard bipolar version can not use timing resistors of several MOhm and it’s internal 3*5k divider wastes 200µA at 3V

  4. Love the last line of the article. I lol’d hard.

    (…or at least half of it.) You know, a 6502, RIOT, and minimal ROM — or 6502 and RRIOT if you can still find an unused one and program it! — or a 6510 with its onboard IO, and minimal RAM/ROM — could blink an LED with ease… heck, you could drive eight of them if you threw a ULN2803A in there somewhere ;)

    …more seriously… discrete logic can take care of any sort of delay or timing issues as needed. An Arduino here is electronic convenience food. Then again, a PLC is the same thing in an industrial setting (for reference –> http://laughtonelectronics.com/Arcana/One-bit%20computer/One-bit%20computer.html — which is still more involved than the pile of 74xx chips I’n imagining, simply because it brings a ROM into the mix), and there’s something to be said for the ease of programming something and being done with it in a half hour or so of hefty keyboard use, rather than spending a few days redesigning and building anew a hardwired control circuit… even when all you’re driving is a pile of relays — or a single LED.

    Hmmm… convenience food has its place, I’d say ;)

  5. I can see this idea (using a 555 with arduino) being practical where maybe you have a mostly digital system going with the arduino, but for some part(s) you might want a more analog component.

    an environmental instability may add a particular character you’re looking for in tone or frequency generation. maybe a reaction of sorts to sensor (photo cell, flex strip, thermistor, etc…) input needs to be generated more “organically” vs. calculated and outputted.

    it’s a good way to begin thinking outside of the box when it comes to discrete components vs. the digital system-on-a-chip counterpart.

    if it can’t be effectively done in programming, this in some cases would probably be better than tacking on a second arduino (though there are probably cases where a second arduino is the more practical solution).

  6. And the 555 has a lot more muscle than the IO pin from an ARM (or an arduino if you are of that persuasion). The last time I checked it could sink 200 mA — now I gotta go find that rack of blue national semi databooks on the shelf. Actually the datasheet says it can source or sink up to 200 mA. So it has merit as a drive component or buffer. Now I am warming up to the whole idea. And it is rated for up to 12 volts, but you better watch your Pees and Queues if you are gonna go that route.

    1. I miss those blue National Semiconductor books. I had to import them to my country on the late 70’s. I had the TTL, Memory and CMOS books. They were a great reference. I also had some Motorola books as well.

  7. I’ve actually had pretty good experiences using a 555 with an Arduino and i2c or Spi potentiometers to create all sorts of outputs. It’s a good way to generate waveforms without tying up the Arduino or having a bunch of innacurate passives cluttering things up. What’s more is it’s not very hard to have the Arduino compensate for the frequency output by having it sample and tweak the values constantly.

    1. AFAIK the CPU in the arduino has some timer/counters, perfect to make squarewave-waveforms. Although the arduino IDE tries to hide this from you and abstract peripherals so much, that you don’t know easily, if a function on a pin is done in software or using dedicated hardware in the µC. What is in my opinoin a very big drawback, as people who use the arduino system sometimes completely forget to think about good use of the resources in the µC.

  8. Another example of a valid use case: I’ve used a CMOS 555 to lengthen pulses too short to be reliably detected by the mcu running at 16Mhz. CMOS 555 is a bit faster than the normal 555.

    1. Depending on the use case this often can be done with a capacitor, a resistor and a parallel diode. Charge the cap fast via the diode and discharge it slower through the resistor.

      1. Then you have a saw tooth wave. The normal is a triangle wave. The output is a square wave.

        The triangle wave can be integrated with a couple of transistors to make a sine wave. All of this is variable or you can switch fixed resistors to make musical notes.

    2. Using one-shots (monostable multivibrators) to lengthen pulses in polling based code is normal procedure. 555 is just a nice package for that. But more often you can get by with solution Martin suggested

  9. This kind of commenting “why not…” or “stupid…” is the downside of a community of nerds trying to show off to each other how smart they are.

    I think a bit more acceptance of other people’s solutions would be in order. Not everyone here is an electromechanical engineering graduate with a minor in computer science and a PhD in Biology. Or so I’ve heard.

    1. Or is it maybe you who should show a little more acceptance to people who have other talents and developed other skills than to express themselves correct and politely according to norm.

      This is not socially-successful-people-a-day

    2. It’s mostly good here. Sometimes I throw something out here because I am unsure and I expect that someone will ‘correct’ me.

      Most of the time I get polite responses but sometimes a *god of one subject* will be a bit nasty but I suspect that is simply because the visitor numbers here are increasing and these people are just finding their feet here.

      Some people here are hobbyists, some are specialists in very narrow fields and others have a broader knowledge that comes with experience.

      The irony is that when someone *jumps down your throat* attempting to sound smarter, they really are demonstrating a lack of understanding of what this place is about, which isn’t the *smartest* thing to do.

      Most of the people here are fairly intelligent and that shows by the fact that these forums are quite well behaved given that there predominantly unmoderated.

      Still, there are exceptions but thankfully they *are* exceptions.

  10. I have a project I have been intending to add a 555 to because to do it right I really need one more independent PWM output than what the AtMega328 which I started the project with can provide.

  11. It is not that hard to blink a led without delays in adruino.

    Example Sketch:
    uint8_t LedPin = 13;
    void setup() {
    pinMode(LedPin, OUTPUT);
    }

    // the loop function runs over and over again forever
    void loop() {
    static uint32_t TimeLast = millis();
    if(millis() – TimeLast>1000)
    {
    digitalWrite(LedPin, !digitalRead(LedPin));
    TimeLast += 1000;
    }
    }

  12. If you needed multiple flashing lights, all going at different rates… you either need a phenomenal number of CTC circuits OR a bunch of external multivibrators. This solution is scaleable.

    Oh, and all the digits of pi? 1234567890. You won’t find any other digits (in the decimal version, anyway)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s