Maker Pro
Maker Pro

BJT vs MOSFET for logic gates help

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
Hi I'm just trying to learn about basic logic gates with transistors, I started by using BJT's, and I had to learn that it sometimes needs voltage division because the current going into the base flows through it and otherwise sets the output high. This voltage division is very inefficient as well as just having the voltage drain through every transistor base.

I found out that MOSFET's don't do this, current does not flow through the gate and source, so you don't need voltage division on AND gates.

So I pulled one of my IRF3205's out to experiment and it does not work at all like I expected. Once voltage is brought to the gate, it just stays on... Even after disconnecting all power to it and reconnecting, it basically acts as non-volatile memory... I need to bring the gate to ground to turn it off. Is this specific to the IRF3205? Or is this with all MOSFET's? I started up this circuit simulator I use and the simulated N channel MOSFET's work exactly as I would expect them to. They don't need to be "turned off" like my IRF3205. They are only on when voltage is brought to the gate.

And are MOSFET's actually the way to go? Are they faster than BJT's? I'm thinking about purchasing some 2n7000's. Thank you!

Working in the simulator a little afterwards and it looks like you need voltage division with MOSFETS too? Otherwise current just flows through the MOSFET like its on?
 
Last edited:

Bluejets

Oct 5, 2014
6,926
Joined
Oct 5, 2014
Messages
6,926
The base resistor in a transistor is to limit the base current.
In most mosfets, it's a good idea to include perhaps a 100R gate resistor to limit any fault current from damaging the driver circuit.
Then a 10k pull down from gate to ground on an N type to make sure it will stay off when no voltage is applied and not "float".
Unless the mosfet has a certain prefix number("L" usually), then it will not operate on low voltage, logic 5v.
The 2N7000 will be ok there.

Don't know why you don't simply use logic chips and a few LEDs.
They're cheap as chips and a lot less mucking around.
We used to have to learn a few of the basic layouts for exams etc. but generally it wasn't mandatory.
What was more important was the theory which followed, and there can be quite a bit.
Seems you might have to start on discretes 101 first rather than jumping in the deep end with logic gate makeup.
 
Last edited:

Kabelsalat

Jul 5, 2011
182
Joined
Jul 5, 2011
Messages
182
Hi I'm just trying to learn about basic logic gates with transistors, I started by using BJT's, and I had to learn that it sometimes needs voltage division because the current going into the base flows through it and otherwise sets the output high. This voltage division is very inefficient as well as just having the voltage drain through every transistor base.
I'll just point out that if you set yourself a goal of making more than a couple of logic gates out of BJT's, then you should try to use the resistors wisely, and also make use of diodes. You can easily halves the amount of resistors needed.
 

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
So every single transistor needs a pull down resistor? That doesn't seem very efficient I thought MOSFET's were used because they were more energy efficient?

EDIT: realized this picture is confusing, look at the picture in my next reply. Why does a tiny amount of current flow through MOSFET's even when they re off?
 

Attachments

  • MOSFET_help.PNG
    MOSFET_help.PNG
    11.2 KB · Views: 12
Last edited:

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
I wouldn't trust simulators, its like trusting someone on the back of a motorbike, I'd do it in real life myself.
They work good for known circuits, but if you give it anything original at all it'll stuff it up I bet.

I dont know for sure, and its just a wild guess cause I havent finished my computer yet at all, but using transistors passively (make the power line come from the last output) saves more power than having power lines allthrough-out the circuit, they are all parallel to the battery, so you can just add them all up for how much watts the computer needs, but I dont know, im just worried about it myself at the moment.
 

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
I'm fairly certain it is accurate. It shows that at least 221 nano amps slip through the MOSFET no matter what. Which means MOSFET's are no good for circuits with capacitors? MOSFET_help2.PNG
 

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
I dont know that, but I can tell you the first thing wrong with it, why are those battery lines green, they should be grey with the switch disconnected. :)
 

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
Because the capacitor was already somewhat charged from the issue I am having. Ignore that first picture, even in the simpler one I just shared, it's just a grounded MOSFET, and yet current still moves through it. Wouldn't be a big problem in a logic circuit because the current if so small, but in my non-volatile memory design it is slowly charging my capacitor! I guess I will just have to use BJT's for that.
 

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
Have u designed an addressable memory array? Awesome, they are actually similar to a monitor or a camera with vertical and horizontal addressing.
Ive got a cool way of hitting the pixels (one at a time) without even a transistor opening, by just conducting vertical from + then horizontal to -, and it does an and gate just with the battery connection. Im pretty sure it would work in a circuit sim too. (if they cant even get that right, they need to shoot themselves.)
 

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
Ya I have a lot of the designs in schematics right now but here is the non-volatile memory I was talking about using BJT's. It works beautifully but I would love any advice on it. I heard that MOSFET's were better for this kind of thing and were more energy efficient so I am trying to translate the design into using MOSFET's but it is not going very smoothly lol The bus addressing system for it is pretty simple and straightforward. It could use some reorganization as I have changed a lot about it without rearranging things so it is messy but here it is:
memory_design.PNG
 

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
Thats a really nice register, you can do an oscillator in a similar space, but I probably would like to do ram with less components than that, for the addressing my best idea yet to do a square array, then have a binary tree reducing the two axi to log steps to get to the linear words, then you get nice area coverage, and the addressing is only log steps to get through. and you get the bits out in lots of whatever word is the bus size is for your computer.
 

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
Thank you! Ya I was going to just use plain old SR latches for RAM, like 2 transistors per bit and a few others for reading and writing to it. And I don't really get what you are saying, I was just going to use buses for all the addressing. An incrementor circuit would address the instructions on one bus, and then the bits in the instructions would just address the RAM on another.
 

Audioguru

Sep 24, 2016
3,656
Joined
Sep 24, 2016
Messages
3,656
A Mosfet uses an electric field (that is why it is called a Field Effect transistor) and has no resistance between its gate and source.
A Mosfet has a fairly high gate to source capacitance.
So when the Mosfet is turned on with a voltage on its gate then the voltage stays there when there is nothing to discharge the gate to source capacitance and the Mosfet stays turned on until a resistor or something causes its gate to be the same voltage as its source.
 

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
Having no resistance between the gate and source makes it switch quicker. means u should short mosfets, dont use resistors. and they dont dissipate (heat up), if they are like capacitors.
 
Last edited:

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
Ok so every MOSFET needs a pull down resistor on its gate? That would be less efficient than just using BJT's wouldn't it? EDIT oh I see ratstar said you don't necessarily need it.

And I've noticed that when I try to look up MOSFET versions of SR latch circuits, it uses like 4 times the amount of transistors that a BJT circuit would use. I am beginning to wonder why anyone would use MOSFET's, yet the internet tells me they are the primary type of transistor used in computing. Not to mention they apparently leak voltage, about 221nA with 5V, enough to slowly charge a capacitor that shouldn't be getting charged. Either MOSFET's are useless or I am still missing something here lol

Also, after reading your reply I think understand why they leak voltage, since it is basically a capacitor, bringing voltage to a drain charges the gate with opposite polarity, which inversely charges the source. I am beginning to wonder what the heck is the use of these stupid things haha. Yup my simulator was right, I just tested it, if you have the gate off, or even grounded, power going into the drain, and a capacitor going from source to ground, the MOSFET charges the capacitor. So you really cannot use these things to charge capacitors apparently?
 
Last edited:

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
When the mosfet charges the capacitor, does the gate turn off? do u mean the mosfet is discharging into the capacitor?
I dont know the solution to the problem, I was just curious myself.
I wonder if you put a loop around the mosfet, you could make it automatically cut off and only give out pulses, but it would slow down the gate activation somewhat.

if the capacitor isnt in the loop of the mosfet, it wouldnt be charged, i know that for a fact, because capacitors dont discharge to each other, only themselves, its only if they are in each others direct pathway does it happen.

BJT's are cool tho, maybe u should stick with em, I like em better too.
 
Last edited:

Tristan369

Oct 29, 2020
32
Joined
Oct 29, 2020
Messages
32
I thought capacitors in series shared capacitance or something? Anyway what I showed you in the simulator I tested on my breadboard and it charges the capacitor. Even when the gate of a MOSFET is off, it leaks voltage out from the source, about 221nA from 5V 2A I think according to my simulator. This current is very small and won't turn on another MOSFET, so I guess it can still be used in the rest of a computer, but it won't work with capacitors. The current will also drain backwards through a MOSFET's source if there is ground on the other side, again all while the gate is completely off.
 

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
Yeh caps in series do, because they are in the direct path with each other, - + - +. connecto add volts. So the capacitor charges over time? How long does it take to happen?

[EDIT] yeh sorry i didnt look at your circuit hard enough. yeh that cap might be being charged by the mosfet. [/edit]
 

ratstar

Aug 20, 2018
485
Joined
Aug 20, 2018
Messages
485
if you put a switch on the ground, then it might not. you have to switch both sides so it doesnt leak charge. yes indeed that seems perdantic, is there another solution?

you could put a loop around the capacitor and as it leaks in it leaks out. but that is *kinda* complicated hehe. then you have to learn about resistor shorting like a mad man, but it probably would be quite a hefty resistor, then its quite missable to alot that would happen, if you just made the rest as if it wasnt there.

Yeh, put a slight leak on the capacitor, thats the leak of the mosfet!!!

but it actually doesnt get rid of the problem that perfectly well, should still work tho, because the mosfet gets charge precedence because the cap is empty not full.
 
Last edited:
Top