I'm looking to drive 12v logic signals (logic level shift) from a PIC24FJ MCU, which can do 3.3v and 5v logic. In one instance, I need to switch a 12v line to LOW, and in an other, I need to provide a pretty constant HIGH 12v. Both of these lines appear to sink a couple mA at most.

Would a relay be my best option for driving these lines? If so, are there any small SMD relays suitable for the job?

Response should be within milliseconds and they do not necessarily need to be low power consumption.

  • \$\begingroup\$ There are lots of ways to skin the cat. Please edit your question to indicate how fast they need to respond (seconds, milliseconds, microseconds) and whether they need to be super-low power consumption. \$\endgroup\$ – TimWescott Apr 15 at 20:30
  • \$\begingroup\$ Does your 12V supply share a ground with the PIC MCU? If not, you have few choices: a relay, or an opto-coupler. Be aware that a common ground invites problems, where transients can feed back and foul MCU execution (not so much a problem when the 12V loads you're switching are low-current). Do consider a logic-level opto-coupler switch. \$\endgroup\$ – glen_geek Apr 15 at 20:37
  • \$\begingroup\$ @TimWescott - I've edited my question. Microsecond response times are fine, and super lower power consumption isn't a necessarily required. \$\endgroup\$ – t3ddftw Apr 15 at 20:56
  • \$\begingroup\$ @glen_geek - They do have a common ground. In fact, the MCU is powered off switched 3.3v that is derived from 12v. I'll look into opto-couplers that are compatible with my requirements -- thanks! \$\endgroup\$ – t3ddftw Apr 15 at 20:57
  • \$\begingroup\$ Can you be a bit more specific about the 12V line you you need to switch low? \$\endgroup\$ – evildemonic Apr 15 at 21:09

This will drive a 0-12V digital signal from a 0-3.3V processor pin, by pulling a resistor low. It may not achieve 1ms rise times, depending on the capacitance you need to drive, and if you need to supply current, it'll have problems there, too. But it's simple.

Circuit on the left:

  • 0V in -- 12V out (assuming no load pulling low).
  • 3.3V in -- 0.2V out (assuming load less than 2mA or so)

Circuit on the right:

  • 0V in -- 0V out (assuming no load pulling high)
  • 3.3V in -- 12V - 0.2V out (assuming sink current less than 5mA or so)


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Thank you! This is indeed very simple, and it should get the job done since I don't need to supply any current. Am I correct in assuming that in order to drive a 12v signal (again, little to no current), I could use the emitter as my signal pin and drive it in the same manner? \$\endgroup\$ – t3ddftw Apr 15 at 21:40
  • 1
    \$\begingroup\$ I've clarified my answer. I'm not sure what you're asking for -- do you want to translate a 0-12V signal back to a 0-3.3V logic input? \$\endgroup\$ – TimWescott Apr 15 at 21:50
  • \$\begingroup\$ Excellent -- thanks! I would like to pull a 12v signal low using 0-3.3v logic I/O and I would also like to use the same 3.3v logic to drive a 12v signal high. My assumption here is that I could use a 2N3902 with 12v at the collector and my MCU at the base and when I drive my MCU high, the PNP should output 12v from the collector. Am I mistaken? \$\endgroup\$ – t3ddftw Apr 15 at 21:57
  • 1
    \$\begingroup\$ @TimWescott Just out of curiosity, why did you choose BJT over MOSFET? \$\endgroup\$ – evildemonic Apr 15 at 22:48
  • 2
    \$\begingroup\$ @evildemonic 1: I like 'em. 2: It seems they're more available to total newbies. 3: So I don't have to explain "logic level", or find through-hole part numbers for logic-level FETs. Frankly, there should be a logic-level to 12V driver out there someplace, but I couldn't find one in a casual search. \$\endgroup\$ – TimWescott Apr 15 at 22:58

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.