I wish to experiment with GPIO line protection circuits in the form of Transistors, Zener and Schottky diodes with resistors.

What might be a simplistic 5v GPIO equivalent circuit to test if my protection experiments are clamping my test spikes. Would be nice if it drives a Led so I can see when failure has occurred.

I have a device that uses a PIC16F917. It has the traditional pull up to 5v and ground button to toggle the units activity. Because this input is extended off the device with a push button. The cable is acting like an antenna and one in five device fail due to installation where the push button cable is extended. Sharing plastic trunking with other power cables.

Datasheet says the port/bit that I am interested in it is a TTL compatible input and CMOS output. Input current clamp is 20ma with 0v to Vdd I believe.

  • \$\begingroup\$ Can you provide more information about the GPIO you are looking to emulate? There's a fair bit of variation there. \$\endgroup\$ – jfowkes Nov 9 '17 at 14:07
  • 2
    \$\begingroup\$ Most modern microcontrollers have a decent sized transient clamp on the IO ports and this will dominate the IO characteristic under the conditions you are testing. The exact details are usually described quite well in the datasheet. \$\endgroup\$ – Jon Nov 9 '17 at 15:30
  • \$\begingroup\$ @jfowkes I have added more info to my question. \$\endgroup\$ – kingchris Nov 9 '17 at 17:52

If you are able to use additional power rails as well as 5V and 0V, you could use the base-emitter connections of two bipolar transistors to emulate the protection diode (NPN at the top, PNP at the bottom).

The transistors could then turn LEDs on using the additional power rails.

  • \$\begingroup\$ This approach may work better for me as a test bed. Once I have found a possible solution after iterating through various solutions then proof will be PIC test bed to see if it protects the failing circuit in question. \$\endgroup\$ – kingchris Nov 10 '17 at 4:08

As @Jon says, the dominant IO characteristic will be the clamping diodes.

If you want to simulate those, two diodes reversed biased across the 5V supply will be enough. The threshold voltage according to the datasheet is 0.6V, so you can get diodes to match that. But it doesn't specify any other characteristics, so if you're looking for an exact match to the diodes in the PIC you won't find it.

Really though, if you want to emulate a PIC GPIO, you need a PIC GPIO. How about using a PIC16F15313, which is about the cheapest PIC16 you can get and almost certainly shares the same GPIO as the PIC16F917.

Buy a bulk load of them, put a simple test program on them and test your protection circuitry using that.

  • \$\begingroup\$ Yes. I had thought that using a PIC is the best. However for a show and tell, (Customers, manufacturers and distributors all having a bun fight over who is responsible), a simple breadboard lash up with LED looks better when a spike blows the circuit. Using PIC with flashing light, I have been told I "programmed" the GPIO pin failure. \$\endgroup\$ – kingchris Nov 10 '17 at 3:47

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.