1
\$\begingroup\$

First post on this site, sorry if it's too basic.

I'm learning to interface with a particular chip which has a GPIO pin. I'm using the GPIO for input with a pullup resistor and a switch between the pin and ground, really simple.

Due to an implementation detail, that pin needs to be high or floating (i.e. not grounded) at power on time. The firmware on the chip doesn't start if the pin is grounded.

I was thinking something along the lines of a delay with a capacitor and transistor in series with the switch but that's where I'm a bit rusty.

Appreciate any guidance. Thanks!

\$\endgroup\$
  • \$\begingroup\$ What chip is it? ESP8266? \$\endgroup\$ – Grant Mar 2 '15 at 23:43
  • \$\begingroup\$ Yep, that's the one :) \$\endgroup\$ – tomfanning Mar 2 '15 at 23:52
  • \$\begingroup\$ And what are you connecting the ESP's GPIO to? If its a pushbutton, the solution is "dont press the button", so I assume its connected to something else? \$\endgroup\$ – Grant Mar 3 '15 at 0:03
  • \$\begingroup\$ Maybe it is not a momentary switch. More like a dip switch. Tomfanning could put, say, a BSS138 in series with the switch, between switch and ground. The gate could be controlled by another GPIO, or it could be controlled by a weak pullup, with a cap to GND. So the gate has a long exponential rise. It would be helpful to know how long the switch needs to remain disconnected. \$\endgroup\$ – mkeith Mar 3 '15 at 7:17
  • \$\begingroup\$ It's a toggle switch. That BSS138 looks good, specifically "This product has been designed to minimize on-state resistance" which should work well with the GPIO. @mkeith if you fancy posting your suggestion as an answer with a bit more detail I'll accept that. Thanks! \$\endgroup\$ – tomfanning Mar 3 '15 at 10:14
1
\$\begingroup\$

Here is the basic idea. When VCC goes high, C1 will start to charge up. After a few ms, M1 will turn on. D1 is intended to make sure the cap discharges promptly when VCC goes low. It may not really be needed.

Larger cap or larger resistor will increase the delay. This is an imprecise delay. There will be variation from unit to unit and over temperature.

Another idea, if you don't mind writing the code and you have an extra IO available is to directly control the gate of M1 with another IO pin. In this case, you would want to add a pulldown on the gate (hopefully the other pin can tolerate a pulldown!) and arrange to have code drive the gate high after the firmware has sensed the state of GPIO.

If VCC is 5V instead of 3.3, everything will still work more or less the same, although the delay will be a bit less at 5V than at 3.3.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Amazing, thanks for going to the trouble of doing this. I'll give it a go! \$\endgroup\$ – tomfanning Mar 4 '15 at 9:26
  • \$\begingroup\$ I do note you say "after a few ms" - I do not know how long this needs to be yet, but will this scale to, say, a second with reasonable R and C values? Also there is no other GPIO available to me so I have to go this way. \$\endgroup\$ – tomfanning Mar 4 '15 at 9:32
  • \$\begingroup\$ I would not go over 1 Mega Ohm. 1 Mega Ohm and 10uF should hopefully give you at least 2 seconds. If you need more than that, I would suggest only increase the cap, not the resistor. You can get a rough idea of timescale by just multiplying the cap and resistor values together. 1 million x 1 u = 1 second time constant. This means voltage will rise to within 2/3 of final value in 1 second. 10k x 1 uF = 10 ms, meaning voltage will rise to around 2/3 of VCC in 10 ms. Enjoy! \$\endgroup\$ – mkeith Mar 4 '15 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.