I originally started writing a long-winded post about how to figure out for yourself whether the BS170 would be a suitable replacement for the BSS138 but I changed my mind because I'm struggling to make sense of the story, which meant I couldn't be bothered. Looks like I'm doing it now anyway.
Why not just buy a cheap off-the-shelf module like this?
https://www.ebay.co.uk/itm/276393247293
How do you know your 2N700Xs are counterfeit? What happens when you've got one in-circuit? Please don't just say "they don't work". Have you tested one separately, out of the circuit?
I don't see it as a very likely candidate for counterfeiting. A counterfeit transistor requires a donor, and the requirements are - cheap, available in very high quantities, usually of the correct channel (in this case N-channel) and matching the package of a much more valuable transistor. In this case, what donor transistor would you use to be able to make a return by the time the re-marking has been done? I can buy genuine 2N7002s for as little as 1p each at quantity from Mouser as an individual (as opposed to a buyer in the supply chain for a large company that makes lots of electronics). Where's the market? Packs of five for tens of pence each on eBay in dribs and drabs to hobbyists?
The BSS138 is readily available:
https://www.mouser.co.uk/ProductDetail/ ... 4arg%3D%3D almost 800k in stock
https://www.digikey.co.uk/en/products/d ... 138/244210 162k in stock
https://uk.farnell.com/onsemi/bss138/mo ... dp/9845330 500k in stock
https://uk.rs-online.com/web/p/mosfets/6710324 1.7k in stock
The BSS138 isn't a level shifter, it's an N-channel MOSFET.
Rather than just tell you whether the BS170 can replace the BSS138, I thought it'd be more useful to show you how to figure it out for yourself. You will need to know the following:
- Channel required (P or N)
- Max drain-source voltage applied when not conducting
- Max drain current when conducting
- Gate drive voltage available to ensure saturation
This will allow you to filter results on an electronics website like Mouser or Digi-Key etc. From this you can notionally choose a FET and with the datasheet you can calculate:
- Power dissipation as a result of the drain-source resistance
- Worst-case junction temperature factoring in the max ambient temperature expected
- Max gate voltage applied
Then you will check:
- Max drain-source voltage rating is not exceeded
- Max drain current rating is not exceeded
- Max gate voltage rating is not exceeded
- Power dissipation rating is not exceeded
- Junction temperature rating is not exceeded
All ideally with some margin.
If all of those are within specifications then it's a suitable replacement/alternative.
Don't just compare the datasheets as you're assuming whoever designed that circuit chose a suitable transistor (the BSS138) in the first place.