How could this GPIO-controlled LED status blinker be improved

gpiolatchledoscillator

I'm building a simple circuit to drive an LED status indicator in a project built around a RPi. The circuit takes its power from the same source as the RPi and is connected to one of the RPi GPIO pins. The aim is that the LED should start blinking when the system is powered on and continue to blink until the RPi system has finished booting, at which a process is launched to set the GPIO high, causing the LED to stop blinking and stay latched on.

I started with this circuit

LED flasher
(source: wild-bohemian.com)

Which I modified like so:

enter image description here

I've implemented a few circuits as designed by other people but this is the first I've attempted to design myself (ok, only a tiny part is mine, but hey). It does seem to work but I'm not confident that it is robust and I would appreciate any advice on how to do it better, or more simply.

One thing I've noticed when setting up on a breadboard is that if I just hold the wire that goes to the GPIO pin between my fingers – without attaching it – the LED latches on. I don't understand why. I'm not planning to put the circuit somewhere people can stick their fingers in but I would like to understand why it does this and if it is a symptom of a design flaw.

Best Answer

Aside from the fact, that you could save parts but not money by using something like a ne555, it is an interesting circuit. But as you want some hints: your third transitor will be in saturation, when activated. Depending on the type it may fail to lower the base voltage enough to prevent the right 2n3904 from conducting. If you want to be sure you should use an low VCEsat BJT. NXP and ONSEMI each have a special selection of those types. Then you may increase the resistors of your added voltage divider, but only to save some fractions of miliamperes.

So why does your circuit react to touching in this way? I bet your powersupply is causing this phenomenon. Either your RPi or the laptop connected to via usb or network is powered by a wallwart or brick PSU. Those devices tend to have a Y-capacitor between hot and cold on primary side. the middle pin is connected to ground on secondary side. This leads to the fact, that the ground of your RPi in fact has a voltage of half of your mains voltage relatively to earth. So if your mains voltage is 110V AC, your RPi's ground is at 55V AC. When you touch it, there will flow a small AC current through your body and the capacitance it forms with your environment. this current is now rectified by the base-emitter-diode in your transistor. It apparently is big enough to open up that transistor and stop the astable circuit from being astable.