Electrical – RC Delay Ciruit for Pi power on

capacitordelaydischargeresistors

I am a bit electronically challenged and need to hold an input pin high for about 8-10 seconds. I am implementing this solution: https://github.com/NeonHorizon/lipopi/blob/master/README.power_up_power_down.md, which works fine, but I have to hold the power on switch for 10 seconds before the Pi sets the UART pin high (and keeps it high). I looked at some explanation of RC circuits, and they seem to all have the same charge delay as discharge delay. Maybe I need a diode in there somewhere? Basically, I'd like to have the capacitor charge quickly, and discharge slowly through the resistor.

enter image description here

Following onto Flàvio's suggestion, can anyone tell me if using a transistor for isolation will work, something like this? The hoped for outcome is:

  • Press switch
  • Capacitor charges
  • When switch is released, capacitor keeps base of transistor high until GPIO 14 goes high as a result of the Raspberry Pi powering up.
  • By the time the capacitor would have
    discharged, GPIO 14 takes over to keep the transistor conducting, and
    EN remains high.
  • To power down, when the switch is pressed again, the
    Raspberry Pi reads GPIO 18 and a script instructs the Pi to power
    down
  • After shutdown, GPIO goes low, the capacitor discharges, and the
    powerboost cuts power to the Pi.

enter image description here

(fixed transistor orientation)

Best Answer

By adding the capacitor C1 you can achieve that. Note that the time it takes before the capacitor empties is roughly R*C, in my example below about 10s.

The downside of using this aproach is that it will also take as long to turn off the circuit as you need the same RC time.

A note on your original schematic: the two diodes in series are a very dirty way of dropping the voltage (if it drops the voltage at all), you can better use the resistive divider (R2 and R3) shown in my schematic, with the correct values depending on your battery.

schematic

simulate this circuit – Schematic created using CircuitLab

Edit: Personally, I would use the UART pin to turn on the circuit and another one to turn the circuit off. You could use GPIO18 to turn off the circuit actually. By having it set as input by default, and only using it as an output when you want to switch off the circuit. Your circuit would then reduce to the one below, with a quick switch off time (R2*C1 = 2s).

schematic

simulate this circuit