this is a very good solution especially because it uses 2 GPIo's of my choice.
One problem I have:
How to deal with changing input voltage and the calculation of R8.
I'm planning a testing platform for arduino, the Pi of course and some other devices.
Therefore I need different voltage supply AND I want to have two choices for the power input.
One 12V wall-wart (with no problems regarding to your circuit) and one with a voltage
going from about 14 to 30V.When working with it I decide which I need. So far so good.
(At the moment I'm still waiting for the Buck converters.)
Calculating the R8 with 12 V its 1.5kOhm but with 30V it becomes 5,3k. when I decide to use a 2,5k
resistance as a good average I will get the regarding currents of 11mA (30V) and 3,5mA (12V).
Would this be OK for the GPIO? If not, what is the maximum current the zener should get?
AND NOW GRAY THEORY:
When I use: https://www.elektronik-kompendium.de/si ... 012151.htm
I get the following, what shows that the max. diode power (often 500mW) should be known as well as
the load current of the GPIO when active.
I tried to calculate it but I get very different results:
P_tot=500mW / U_z=3,3V / U_ges=12V ==> I_z-max=0,15A, I_z-min=0,015A (theor.), I_ges=0,02A (with estim. load 0,005A)
R_v=435Ohm <==> differs from 1740 Ohm.
By the way, with a 100mW diode its getting more close to your values.
Can you say what the load current is? But the higher it is the lower R8 has to be. Confusing for me.
And more confusing that your circuit works obviously.
Many greetings and thanks!