Computing stuff tied to the physical world

Switching with a lower voltage

In Hardware on Nov 10, 2012 at 00:01

The SMA Bluetooth relay described yesterday has to switch the power to the RN-42 module using an I/O pin on the ATmega. Currents are fairly small: up to about 50 mA.

I tried directly powering the RN42 from two I/O pins in parallel, but it looks like they don’t have enough current drive capacity for this purpose. So the task is to find a simple way to switch on power somehow.

The simplest solution would seem to be a P-MOSFET in the “high side” supply, i.e. between PWR and the RN-42′s supply pin, but there is a problem: PWR will be somewhere between 3.3 and 5V (actually it’s more like between 3.6 and 4.0V with the 3xAA Eneloop batteries I’m using), but the I/O pin on the ATmega won’t be more than 3.3V – since the ATmega sits behind a 3.3V voltage regulator. I tried the P-MOSFET, before realising that it’d always be driven on – the I/O pin voltage is sufficiently low to switch the MOSFET on, even with a logic “1″ – not good!

MOSFETs are driven by voltage whereas transistors are driven by current, so an obvious thing to try next is to use a PNP transistor in more or less the same configuration. Voltage differences wouldn’t be so critical, if no current flows. Also, there’s the extra base-to-emitter voltage drop or so that each normal transistor has. Still, a simple PNP transistor might switch on if the difference in voltage is large enough – this can be overcome with a PNP Darlington transistor, which is simply two PNP transistors, cascaded in a certain way. The property of these things – apart from their high amplification (hFE) – is that you need to drive the base with a slightly larger voltage. A lower voltage in this case, with PNP types. Could also have used two discrete PNP transistors.

Here’s the circuit:

Screen Shot 2012 11 07 at 15 15 47

And sure enough, it works. I happened to have an SMD “BCV 28″ lying around:

DSC 4238

The 10 kΩ resistor in series with the base limits the drive current to under 1 mA – more than enough to drive the Darlington into saturation, i.e. the state where the collector-to-emitter voltage drop is at its lowest.

That’s it. Every 5 minutes, a reading arrives on the central JeeLink, as shown by JeeMon:

Screen Shot 2012 11 07 at 15 21 56

Drat, cloudy again! Oh well, just the usual gray November day…

  1. Could you pull up the pmos gate and turn it off by setting the micro’s pin to hiZ? And on by setting the pin low?

    • The problem is that all I/O pins have ESD protection diodes to VCC and GND. So I/O pins will newer be more than VCC + say 0.7V for those diodes to start conducting. I tried it, but with 5V power, the 3.3V + 0.7V was still low enough to turn on the P-MOSFET in this case.

  2. There are a few options, here. For your application, I think you may have found the optimal one, but there are some situations where a few others might be more ideal.

    First, WHY does your solution work? The Darlington works here because you have an extra emitter-base diode in series with the first. That SHOULD make the turn-on voltage about .7v lower. In fact, if you didn’t care about a darlington, you could achieve the same effect by simply putting a few diodes in series. The ADVANTAGE of the darlington is that you don’t have to sink as much current in the IO pin to turn the switch on.

    BUT, for low currents, BJTs are generally non-ideal. In terms of the current that flows into the bluetooth module, most of it will flow through a .7v emitter-base drop. If you’ve got 50mA going into the bluetooth module, that’s 35mW burnt in the switch.

    On the other hand, let’s say you used a P-MOS (not an NMOS, though you sometimes would in this situation, because gate drivers are annoying and expensive). With an on resistance on the order of 25 mΩ, we’re now talking more like 62.5 µW burned in the switch. The OTHER advantage is that you can get mosfets in a range of Vth voltages (in fact, these guys might be ideal!

    DRIVING the gate properly can be a challenge, but in your case, it’s luckily not. Normally, you’d run the risk of breaking a PMOS with an abnormally large Vgs, but you’ll definitely not get that here (I mention it because when I was switching 24V off a solar panel into a switching regulator, it was an issue to clamp Vgs to >10V. One reason you might use an NMOS with a gate driver instead).

    The typical application block on that very datasheet above is almost exactly what you want, although in your case, you probably don’t even need a secondary gate drive switch since your driving source (the microcontroller) already swings from a sufficiently high voltage to turn the device off to a sufficiently low voltage to turn it well on.

    • Thanks for this detailed analysis. One minor comment:

      that’s 35mW burnt in the switch

      True, but otherwise it’d be burnt in the linear voltage regulator on the Bluetooth module.

  3. Ahh what I left out is, to make your PMOS situation work (3.3-4=-.7Vgs is really enough to turn on your PMOS? Sounds fishy…), use a pull up resistor on the gate (to turn it off when the pull-down element is in high impedance) and a pull-down element (likely a small signal NMOS) to pull down the gate and turn the PMOS on.

    • Hello Alex – good points. I probably could indeed have used a P-MOSFET as you describe, but the trouble here is that the only ones I had laying around (BSH203 and SI2333) both have a very low turn-on voltage.

  4. The problem with this circuit is that with a high supply voltage, low tolerance 3.3V regulator, and a low VBE Darlington, it may not turn off properly. A better approach is to use an NPN transistor in common base mode as a level shifter, combined with a single PNP switch. The NPN collector connects to the PNP base; the NPN base connects directly to the 3.3V rail, and the NPN emitter is wired though a current-limiting resistor to the output pin. Taking the output low turns the NPN on, and its collector current flows into the PNP base turning the Bluetooth module on. The current-limiting resistor sees (3.3 – VBE) across it, and it’s value should be chosen to saturate the PNP appropriately. When the output pin is high, both NPN and PNP are off. Good practice also suggests a fairly high value resistor between base and emitter of the PNP to ensure it tuns off fully.

Comments are closed.