Coin Flip 555 Timer Circuit

Today I built a 50-50 coin toss circuit using a 555 timer circuit, for no particularly good reason other than just to try it.

I’ve seen several variations of these circuits that use the 555 to generate a clock signal which is then conditionally fed into a flip-flop when you push a button to “flip the coin”. The button connects the oscillating clock output of the 555 to the flip-flop clock input. The flip-flop is configured to toggle on each clock transition, so when you let go of the button the flip-flop basically has a 50% chance of being high or low. This is then usually shown to you via two different LEDs – one for heads, one for tails.

It occurred to me that there was already a flip-flop inside the 555, which then led to the idea that if I could build a 50% duty cycle astable 555 circuit and make a way to start/stop the oscillation, that the whole thing could be done with just the 555 and no other chips.

Previously I had built a fairly common configuration of an astable 555 circuit as an exercise. This is the circuit that allows you to easily vary the duty cycle of the oscillation:

The duty cycle in this circuit will be 50% when the charging path, which runs through R1 and the “left half” of potentiometer R2, has the same resistance as the discharging path which runs through the “right half” of R2 (but not R1). The general idea behind picking R1 small and R2 large in this circuit is to minimize that asymmetry so that positioning the potentiometer near the middle results in nearly a 50% duty cycle.

Given that idea here is my circuit to flip a coin:


The output side of the 555 circuit is where the coin flip is displayed. If the 555 Output is high, there is insufficient voltage differential between the Output and Vcc to turn on light-emitting diode D3; conversely, the Output voltage will flow through R7/D4 and that LED will illuminate. If the 555 Output is low, the reverse is true. LED D3 will illuminate, and the current from Vcc through R6/D3 will be sunk into the 555; conversely there is insufficient (nearly zero) voltage differential between Output and ground and so D4 will remain dark.

On the left-hand side we see that when the switch is in the “run” position, the circuit is the standard astable oscillator shown before. I’ve drawn it showing fixed resistors for R2/R3 but in fact I built it using the potentiometer from the previous adjustable duty cycle circuit, so that I could experiment with the effects of different duty cycles.

If the switch is moved into the “stop” position, the Trigger and the Threshold input are disconnected from the RC network and instead are connected to a simple voltage divider. With R4 and R5 being equal value, the voltage at this point will be 1/2 Vcc which is too high to trip the Trigger and too low to trip the Threshold; consequently the 555 simply remains in whichever state it was last in at that point.

I used a push-on momentary single-pole double-throw switch, wired so the normal position is “stop” and the momentary is “run”.

In my first idea for this circuit I planned to use a double-pole switch because I thought I’d also have to toggle the Discharge pin between two connections. But that’s not really necessary; if the Discharge pin is low when the timer is stopped (50% chance of this happening) it simply continues to sink current from Vcc through R1; this will be between 5ma and 15ma depending on what voltage you use for Vcc (5V – 15V). It’s a waste of power, 50% of the time, but it works. Also, don’t forget that one of the display LEDs is also always on, so the power wasted in the Discharge is only part of the power use of the circuit and could be made somewhat insignificant. But if you cared about this wasted power you could use a double-pole double-pole switch and so that in addition to moving the Trigger/Threshold between a “run” and “stop” position you could move the Discharge in tandem (between the connection as shown above and “no connection” in the “stop” position). Alternatively you could increase R1 as the asymmetry effect R1 has on charge time versus discharge time is not really important in this application; you could choose R2 and R3 to compensate for a larger R1 such that R3 = R2 + R1 is maintained for a 50% duty cycle.

The frequency of the oscillation isn’t especially important other than you want it to be fast enough so that you can’t time your press of the button to influence the result, and slow enough that the flickering can be seen because that’s a cool effect. With the values shown above the frequency will be in the neighborhood of 25-30Hz.

So, the circuit definitely works. Here’s a movie showing that:

555 flip circuit

I had originally powered the circuit from a 5V bench supply. You can see in this movie I was trying it from a 9V battery; I probably should have increased the resistors R6/R7 for that as there is no real need to pump 90mA through the LEDs. You may wish to experiment with that if you follow this idea.

There is a pretty significant drawback to this circuit: the 50-50 fairness of the coin-flip depends on having an exact 50% duty cycle. Using my oscilloscope, and taking advantage of the fact that I had used a potentiometer for R2/R3, I was able to tune the circuit to precisely that point:

However (and “of course”) … the cheap resistors used in this circuit can drift as they warm up or cool down, and there are plenty of other variance effects that all can lead to the duty cycle drifting even after it has been adjusted to 50%.  I saw that myself just while playing with the circuit; after I had adjusted to 50% a few minutes later it was off at 49.6% as an example.

Before I built this circuit I did a lot of google searching for other examples of this idea and came up empty. I can see now why people don’t build a coin-flip circuit this way, because it’s impractical to guarantee an exact 50% duty cycle and so there is no guarantee of 50/50 heads/tails fairness.

Using an external flip-flop eliminates this problem, because the external flip-flop (assuming you have set it up this way) can toggle between high and low states only on the rising edge of the 555 output clock cycle. This makes the duty cycle irrelevant, as the amount of time the 555 output is high or low has nothing to do with how long the second flip-flop will be high or low. The second flip-flop will alternate between being high and low each for an ENTIRE clock cycle of the 555 output; only the rising edge from low to high will toggle the external flip-flop. In this way any asymmetry in the duty cycle becomes irrelevant and the coin toss is inherently fair.

Thus, this circuit I built is interesting as an exercise, but probably shouldn’t be recommended for use in any real coin-flip application. Though obviously that hasn’t stopped me from posting it — if for no other reason than other people might find it and understand why no one else builds a coin-toss 555 circuit this way! 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *