A few weeks back, in one of my projects, what I required was to drive 8 RGB LEDs using the minimum number of pins on a 8bit AVR ATTiny micro-controller. Laying put the schematic was easy, as I knew what I had to do. I was aware I had to employ methods for current sinking and sourcing to make the LEDs glow. The conventional method would have been use of PNP and NPN transistors with lots and lots of resistors at their bases and use them as switches so that the least amount of current reaches the micro-controller pins. However, due to size limitations of my PCB, I could not use that many resistors.
Using MOSFETs was the other option as their gate current is negligible. I had read on the internet about current sourcing using P Channel MOSFETs. No one talked about current sinking using MOSFETs as such. So trivially accepting that if a P Channel sources current, an N channel would sink it. This is right to some extent but wouldn’t work if some conditions are overlooked. That prime condition being threshold voltage of the NMOS and PMOS. PMOS have higher threshold voltages compared to NMOS and hence cannot be ignored. For those who don’t know what threshold voltage, it is the minimum voltage between the the gate and source of the transistor required for switching operations. Threshold voltage for the NMOS I was using was 2V(NDS355AN) and for the PMOS was -2.5V(NDS356AP).
So getting my concepts straight about using MOSFETs as switches, I started building a daughter board for driving a single LED using a PMOS and NMOS. The schematic for which is given at the bottom of this post. It failed. Not because I had got my concepts wrong, rather I had soldered it wrong or the transistor was faulty.
The next time with immense help from my professor and guide, I was successful. We were successful.
This design concept is not just limited to driving LEDs. It can sink and source high value currents of over 2 amperes and send current in micro-amperes to the controller(current flow into the controller would be higher when using BJTs). It can be used to drive motors, LCD displays etc.
Some points to be remembered:-
- Use a supply of 5V or more for switching states. 3.3V would work, but may pose a serious problem in the presences of voltages being developed across any stray resistances which would make it very hard to debug.
- Use a current limiter resistor between the transistors, always.
- A high on the gate of the NMOS, turns on the transistor and vice versa.
- A low on the gate of the PMOS, turns on the transistor and vice versa.
- Last, as FETs can be depicted in several ways, recheck your connections before applying any voltages.