I want to use the digital output of an Arduino Nano to switch the VPP pin of an AT89C1051 between 12 V and 5 V, for programming.
The tolerances for 5 V are 3.5-5.5 V and for 12 V the tolerances are 11.5-12.5 V. The maximum current for programming is 250 μA. I have designed the following circuit] using a single NPN, and a current source to simulate the AT89C1051.
Both the on (5 V) and off (12 V) state use the 12 V power source, the 470 Ω serving as a voltage divider for the on state. I'm avoiding diodes in the 12 V path to avoid voltage drop.
Varying the current source from 0-250 μA at either the on (5 V) or off (12 V) state, everything seems to be within spec. But given the circuit is very simple compared to anything else I could find and that I am not an expert, I'd like to have a second opinion on this.
Also I'm assuming the transistor I have (2N2222) will behave close enough to Falstad's NPN. According to figure 3 in the datasheet, at ~7 mA in Ic at ~25 °C I should expect 150 hFE in the transistor, which reduces the on state to around 4 V (still fine).