On my project I have a need to switch a reference voltage - being input to a current-sense amplifier - between 0V and VCC (5V). (I'm doing bi-directional current sensing and need an asymmetrical output, not one centred around the ref. voltage.) I was going to just use an output pin of my MCU to provide the reference voltage - by setting the pin state high or low - but I now am in need of this I/O pin for something else. I realised that the state of my ref. voltage corresponds to the state of one of the I/O pins I'm using to actuate the load being measured by the amp, so I'm thinking I can use that existing I/O to switch the state of the reference too.
So, I figured a solution would be using a P-channel MOSFET as follows:
- Source connected to VCC.
- Drain connected to REF input on amp.
- Gate connected with 220R resistor in series to existing I/O line.
I/O line will normally be low, so MOSFET will be on, feeding VCC to the REF. When I/O toggles high, MOSFET will be off, leaving the REF input at ground.
But I have some questions:
- Do I need a pull-down resistor on the REF input? I have a feeling yes; the drain from the MOSFET will probably be floating, and not give me a proper 0V reference. If so, how big?
- Is the current-limiting series resistor on the gate
really necessary? I have read you should always have one, but then other sources say it's only really necessary when you have high switching frequencies (I don't - I'll be lucky if it approaches 1Hz
).
- Small through-hole package P-channel MOSFETs (e.g. TO-92) are scarce and expensive for some reason (like 5x price). I already have some N-channel - is it possible to do something similar with one of those?