Using a digital PIC16F output to power a solid state switch - Page 1
Forum section: electronics / general

author: microvia
author_rank: Regular Contributor
timestamp: July 10, 2025, 09:55:41 am
content: Hi,I designed a circuit around a PIC16F. I want to add a solid-state switch (like a 74xxC1G66) to power a small Bluetooth module when needed. The BT module draws around 40mA.The switch would be located before a 2*pi filter which powers the BT module and reduces spikes (I can't use a DC/DC ground isolator).The switch is activated when two digital outputs of the PIC are high, but the PIC has no other free output. So, I must "AND" the two lines to activate the switch.I want to save this AND gate because my PCB is already tight. I thought about using one of the output lines to power the solid-state switch and the other to activate it.One big limitation is that the required switch needs to draw little current to be powered by the digital output, and also allow a higher current to pass through it to power the BT module.I looked on Mouser and Digikey, but neither of these sites shows the maximum current the switch can handle.Is there a common smd part which fits my needs ? Thanks.

author: mikerj
author_rank: Super Contributor
timestamp: July 10, 2025, 10:23:44 am
content: The 74xxC1G66 is an analogue switch for switching low current signals, not for power switching. Maybe you can use a couple of small MOSFETs to switch the power to the BT module, put them in series to get the AND operation.

author: Ian.M
author_rank: Super Contributor
timestamp: July 10, 2025, 12:24:25 pm
content: A BAT54A dual commonanodecathodeSchottky diode, a complimentary dual MOSFET with appropriate current rating for the load and two gate pullup resistors will do the job in minimal board area - see attachment.Seehttps://mou.sr/46zPEzLfor some possible MOSFETsThe alternative of a single gate NAND (e.g. 74LVC1G00) directly driving a P-MOSFET which eliminates the resistors can be problematic if the PIC (and NAND) don't have the same supply voltage as the Bluetooth module.I would suggest switching *AFTER* the Pi filter - the P-MOSFET with gate grounded won't introduce significant noise, has a low on state impedance, and there is no point in wasting energy charging/discharging the filter capacitors every time you cycle module power. Only minimal decoupling should be after the switch.Edit: Fixed diode common type in description.Also, if you need to reduce the inrush current, a third resistor in series with the PMOS gate can do that, at the expense of increasing its dissipation while switching.

author: microvia
author_rank: Regular Contributor
timestamp: July 10, 2025, 08:20:12 pm
content: Quote from: Ian.M on July 10, 2025, 12:24:25 pmThanks for your hints. The PIC runs at 3.3V. The BT runs at 5V.Can a pair of mosfets in series (as suggested by @mikerj) reduce the number of components ? If so I can check if this exists as a single package.

author: bookaboo
author_rank: Frequent Contributor
timestamp: July 11, 2025, 08:21:42 am
content: Presumably you have a regulator for the BT module? If that regulator is powering only the BT, then you could save component count by switching to a regulator with an enable pin. I use that approach regularly.

author: microvia
author_rank: Regular Contributor
timestamp: July 11, 2025, 01:42:29 pm
content: Quote from: bookaboo on July 11, 2025, 08:21:42 amNow I really feel stupid ! I'm indeed using a dual voltage regulator which 5V output is exclusively used for the BT module and which has its own enable input. Thus, all I need is a single AND gate between the PIC outpus and the 5V enable pin. Can't be simpler. Next step is to check whether I'm using a 74LVC gate or a pair of diodes and pull-up, whichever is cheaper...

author: ajb
author_rank: Super Contributor
timestamp: July 14, 2025, 02:45:05 pm
content: Quote from: microvia on July 10, 2025, 09:55:41 amIt's not clear how these two lines are supposed to work. Are these two outputs from the same PIC? Couldn't you do the "and" logic in the software and then only use one output pin without any extra components?

author: NorthGuy
author_rank: Super Contributor
timestamp: July 14, 2025, 02:55:58 pm
content: Quote from: microvia on July 10, 2025, 09:55:41 amWhy would you want to do that? Why can't you AND them within the PIC. This way you only need one output.

author: microvia
author_rank: Regular Contributor
timestamp: July 14, 2025, 03:50:26 pm
content: Quote from: NorthGuy on July 14, 2025, 02:55:58 pmI would have done that already ! But the two output lines are connected to a mux, so I can only use an AND gate (as I said, I don't have any free PIC output line otherwise I would perform the AND in software).

author: Ian.M
author_rank: Super Contributor
timestamp: July 14, 2025, 04:31:13 pm
content: This is what you get if youmuntzyour design too early. It is vastly preferable to design with a higher pin count, more capable MCU right up to prototype production, and only reduce to the minimum spec. MCU in the family when you are tooling up for volume production and looking closely at BOM costs. Even so, keep the ICSP/ICD pins free, so you can debug on the final hardware, and if *absolutely* *desperate* steal them for a couple of GPIOs for a last minute bodge fix.

author: NorthGuy
author_rank: Super Contributor
timestamp: July 14, 2025, 08:29:39 pm
content: Quote from: microvia on July 14, 2025, 03:50:26 pmChanging to a bigger PIC will be cheaper and will take less space than adding the AND gate. Moreover, it may give you more flexibility in the future.If you want to use your pins one to power module and another to drive its EN pin, this might be Ok. But driving the EN pin of the unpowered module may power the module through the clamping diode of the EN pin. Generally it is not a good idea to drive high any pins of unpowered devices.

author: microvia
author_rank: Regular Contributor
timestamp: July 16, 2025, 07:46:39 am
content: Quote from: NorthGuy on July 14, 2025, 08:29:39 pmI have been considering a bigger PIC, but my 4-layers pcb is tight and requires a lot of manual routing. I could simplify this with a 6-layer one, but production cost will rise. The initial idea that you refer to has been withdrawn after @bookaboo reminded me that the voltage regulator has an enable pin for the 5V channel, which the AND gate now drives.

author: NorthGuy
author_rank: Super Contributor
timestamp: July 17, 2025, 12:28:27 pm
content: Quote from: microvia on July 16, 2025, 07:46:39 amPICs are typically 4x4 mm up to 28 pins, or 5x5 mm for 40-pin. So, you wouldn't lose much space by increasing the number of pin. Having more pins would actually make it easier to route because you have a choice of where the unused pins are.

author: microvia
author_rank: Regular Contributor
timestamp: July 17, 2025, 05:27:00 pm
content: Quote from: NorthGuy on July 17, 2025, 12:28:27 pmYou're 100% right ! I actually gave it a try yesterday evening and ended up replacing the 16-pin PIC by a 20-pin one. I saved some time by using my own symbol so that the schematic required almost no modification. The PCB required some changes, but nothing complicated. And this avoided using the AND gate...