Application is multi use input PIC input / output pin
Supports all PIC pin modes, digital I/O & analog input.
I wonder if it will load the pin in analog mode? **broken link removed**
Since input impedance of MOSFET is quite high, it won't load the analog source. But the LED will turn on and off unexpectedly depending on voltage at the PIC's pin.
The BS170 and 2N7000 Mosfets have the same ratings. Their threshold voltage can be as high as 3V for a current of 1mA.
They are not Logic Level Mosfets so their minimum current will vary a lot with a gate voltage of only 5V.
One annoying thing with using 2N7000s on pic outputs is that they float when set to input. This is not normally a problem but when developing the product the LEDs will glow during the program download. This becomes more of a problem if your driving something like relays as the FET ends up with around half the supply voltage across it (=hot). For this reason, it is a good idea to temporarily add a pull down on the gates.
generally use of MOSFET is with a termination so that gate will not be in charged condition. As such bill might try it with say 100K pull down. It may not effect the port pins but will work as termination for the gate.
I remember some CD4xxx gates which resemble like a pair of N-mos and P-mos complimentary pairs.either we could use one off them and it will serve like 2n7000 but far cheaper,perhaps.
Wah!
you are leading us near solution.
Mr Bill has managed Opto out element with just diode of the Opto-isolator and 330E in series.
If this could work , perhaps an efficient LED also can be driven around the same 330E or at 470E for say RED color.
I pulled the 2N7000 as I was not clear how it would affect the Analog input mode when not using a relay (not shown above). You could alway put a 2N7000 where the 2N3904 is.
I put the LED directly to the I/O pin to hopefully act as a pulldown (when the I/O is an output ie RESET) as well as an indicator in relay mode.
This schematic is one behind the current, I'll update the image ASAP
**broken link removed**
It's the whole schematic (and I've added an XBEE)!
Thanks Bill, for considering the suggestion. Perhaps the 100K may not be needed as you are using a bipolar, I feel. You have not used on other pins anyway.
Nice protection of relay contact. A single transient suppressor from the common connection to the return wire of the circuit on the relay contact would do. and you can save a device while still protecting the contact.