I'm trying to build a small circuit to sense when a voltage ref (for IO output) is supplied otherwise set a default voltage reference.

A bit of context - This is common within the Arduino ecosystem where shields should accept a IOREF input that indicates the attached board IO voltage level. I'm basically trying to to hook this input to a bi-directional level shifter (to one side of the voltage inputs) and whenever there is no input I want a fixed voltage to be applied (internal 3.3v).

Here is my attempt to achieve that using two 2n3904 NPN transistors and one diode.

  • The switches mimics the IOREF input (3.3v | 5V or none)
  • The voltmeter is the input of the voltage side on the level shifter.
  • The upper 3.3v is the default I want taken from an internal voltage regulator.

Q1 - While it seems it should work I'm worried about voltage drops caused by the IOREF transistor and the diode on the default voltage input - I will use use low Vf components and I can probably get a way with a small voltage drop but I wonder if I can avoid that???

Q2 - Should I place a pull down resistor on the base of the IOREF npn transistor?

Q3 - Should I place a resistor to ground on the emitter side of the "DEF" npn transistor?

Q4 - Do you see any problem with this circuit????

enter image description here

enter image description here

enter image description here

  • \$\begingroup\$ What exactly is the 'voltage side on the level shifter'? What is the intended purpose of the upper transistor? \$\endgroup\$ Jul 29, 2022 at 1:58
  • \$\begingroup\$ @BruceAbbott On a bi-directional level shifting IC such as the 8-Bit TXS0108EPWR you supply it with two Vcc (A & B) those are used for the output of each side. I'm trying to feed the IOREF voltage to it to get the correct output or if that pin is not connected I want a fixed 3.3V and thats why I have a second (upper transistor) which will pass the 3.3v whenever the switch (IOREF pin) is low or not connected. \$\endgroup\$ Jul 29, 2022 at 2:39
  • \$\begingroup\$ The upper transistor is shorting the 3.3V regulated supply to ground (drawing 101mA in the 3rd configuration). Doesn't appear to be a useful function. \$\endgroup\$ Jul 29, 2022 at 9:28

1 Answer 1


Here is a way to avoid the voltage drop, assuming the average current draw from the Vcc_B is modest:


simulate this circuit – Schematic created using CircuitLab


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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