MOSFET vs. Transistor LED Circuit(s)? +Mosfet Clarification

Thread Starter

Mark Johnsen

Joined Nov 30, 2015
15
Hi all,

Thanks for taking the time to look at my question. Let me start with what I want to do and then my two questions are listed below.

WHAT DO I WANT TO DO?
I want to use a magnetic encoder chip, AMS5045B, for rotary encoder feedback and I want to use the pins 1 MagINCn and 2 MagDECn as feedback that the magnet is aligned or misaligned with three LED's (GRN, YEL, & RED). The pins are active low via open drain output and their status' are shown below:

upload_2015-12-4_11-53-45.png

What I want is Pin 1 MagINCn to toggle 2 switches (mosfet or transistor); one normally open for the YEL LED and one normally closed for the Green LED. The reason I mention mosfet is because I found a similar project for the AMS AS5311 linear encoder where the person used 3 mosfets. See his schematic from Eagle below.

MOSFET SCHEMATIC:
upload_2015-12-4_12-10-9.png

QUESTION 1
I think I understand the P-chan Enhanced mosfets (Q1 & Q3 BSS84) for the YELLOW and RED MOSFETS, but the n-chan enhanced mosfet (Q2 BSS123) for the GRN LED has me twisted about?

A. I don't understand how that circuit will work or if it will act as a normally closed switch for the GRN LED? The chart below shows that Vgs +VE of a N-chan enhancement MOSFET will have the switch open. But, it seems then that both Q1 and Q2 are only in the correct state when pin MagINCn 1 is high? So it seems like the circuit won't work like I want it to?
B. I've read that a depletion mode mosfet could work, but since I don't understand that piece of the circuit I'm confused.
C. I've read that JFet's could work as well??

Further, the negative voltage at some of the mosfet's gates confuses me?

FROM: http://www.radio-electronics.com/in...-effect-transistor/mosfet-basics-tutorial.php
upload_2015-12-4_12-13-23.png

QUESTION 2
Why mosfets and why not Transistors? Would my schematic below be correct w/ the pnp and npn transistors?

I pulled off the web at Yahoo answers some transistor info that:
NPN transistors will allow current to flow from collector to emitter when current flows through the base. (hence normally open?)
PNP transistors are the opposite (normally closed). They will allow current to pass from the COLLECTOR to the EMITTER, until you apply current to the BASE (then it turns off).

TRANSISTOR SCHEMATIC
upload_2015-12-4_11-27-20.png

Thanks,
Mark
 

Attachments

dl324

Joined Mar 30, 2015
16,788
You have the collector and emitter of the PNP reversed. That LED will be on when MagINC is LOW (ON). Yellow LED will be on when MagINC is HIGH (OFF). Red LED will be on when MagDEC is HIGH (OFF).
 

crutschow

Joined Mar 14, 2008
34,201
Some clarity on transistors:

MOSFETs are transistors (Metal-Oxide-Semiconductor-Field-Effect-Transistor) as are BJTs.

MOSFETs have a very high input impedance at the gate (looks like a capacitor).
BJTs have a low input impedance (the base emitter junction looks like a forward biased diode).

Either NPN or PNP transistors work the same way, just the polarity is reversed. The are both off (open) with no base-emitter current.
NPNs require a positive collector to emitter voltage for normal operation with a positive base-emitter current turning them on.
PNPs require a negative collector to emitter voltage for normal operation with a negative base-emitter current turning them on.
 

Thread Starter

Mark Johnsen

Joined Nov 30, 2015
15
dl324,

Thanks for the reply and good catch on the PNP direction!

I changed the PNP transistor:
upload_2015-12-4_16-25-9.png


You have the collector and emitter of the PNP reversed. That LED will be on when MagINC is LOW (ON). Yellow LED will be on when MagINC is HIGH (OFF). Red LED will be on when MagDEC is HIGH (OFF).
Yes- that when the MagINC is LOW, I want the Yellow LED to be OFF and the Green LED ON. When MagINC is HIGH, then I want green OFF and Yel ON.

Thanks - Mark
 

dl324

Joined Mar 30, 2015
16,788
If you're interested in suggestions that would make your schematic easier to read.

Flow should generally be from left to right and top to bottom. Unnecessary wire jogs and crossings should be avoided. Since the outputs are on the left side of the component you're using, you could mirror or just draw the outputs on the left. I've redrawn your schematic in Eagle with the suggestions I made (I printed instead of using a screen capture to avoid the colors Eagle uses and that I don't find all that useful):
upload_2015-12-4_16-41-0.png
 

Thread Starter

Mark Johnsen

Joined Nov 30, 2015
15
Some clarity on transistors:

MOSFETs are transistors (Metal-Oxide-Semiconductor-Field-Effect-Transistor) as are BJTs.

MOSFETs have a very high input impedance at the gate (looks like a capacitor).
BJTs have a low input impedance (the base emitter junction looks like a forward biased diode).

Either NPN or PNP transistors work the same way, just the polarity is reversed. The are both off (open) with no base-emitter current.
NPNs require a positive collector to emitter voltage for normal operation with a positive base-emitter current turning them on.
PNPs require a negative collector to emitter voltage for normal operation with a negative base-emitter current turning them on.
Crutschow - It took a little for it to sink in and your explanation is exactly why my transistor circuit will work as I'd like. The key is the negative base-emitter current for the PNP that will make my circuit work. That's because when the MagINC is LOW, I'll have 0Vdc at my Base and 5Vdc at my emitter, which is a -5Vdc Base-emitter current. When MagINC is HIGH, I now have 5Vdc at both base and emitter, so I have no flow through the emitter/collector part. Sweet! I suppose you could say the "light' went on, but that's a bad pun:)

QUESTION for you and dl324: I still don't understand if the Q2 n-chan enhancement MOSFET would work in the first circuit in a similar 'mode' as the transistor circuit? I'm wondering if the mosfet circuit would toggle the LEDs (green on and yel off) based on MagINC LOW. It has to do w/ the Vgs being pos or neg to the VE.

Thanks - Mark
 

Thread Starter

Mark Johnsen

Joined Nov 30, 2015
15
If you're interested in suggestions that would make your schematic easier to read.

Flow should generally be from left to right and top to bottom. Unnecessary wire jogs and crossings should be avoided. Since the outputs are on the left side of the component you're using, you could mirror or just draw the outputs on the left. I've redrawn your schematic in Eagle with the suggestions I made (I printed instead of using a screen capture to avoid the colors Eagle uses and that I don't find all that useful):
View attachment 95905
Dennis - I am absolutely interested in suggestions. That schematic looks awesome and I'll change my to match! Your's is so much cleaner w/ out all my zig zags... hahahah...
 

dl324

Joined Mar 30, 2015
16,788
Dennis - I am absolutely interested in suggestions. That schematic looks awesome and I'll change my to match!
Glad you find it helpful. It's one of my pet peeves. There's an art to drawing schematics, and well thought out schematics are a pleasure to see. I see quite a few that make me scratch my head and wonder what the author was thinking; if I think they're from people who just didn't know better, I offer suggestions.
 

Thread Starter

Mark Johnsen

Joined Nov 30, 2015
15
You are correct, I don't know any better. I'm sure you noticed that my schematic layout matched the mosfet schematic layout because I figured they knew what they were doing better than I did.

I got this far by taking a 'hacker' intro to eagle, which was always an interest and the intro was great and the instructor talked about layout, but we never got to that too much. Most of it was 'canned' to be able to cobble something together. I really realized that when I started looking into 'simple' mosfets and bjt transistors. My head started hurting bad.

Anyway, I want to try to make a board and make some encoders for my milling machine and if someone else wants to use these, all the better. I suppose it's better to just buy them, but then I wouldn't learn anything...

Thanks again,
Mark
 

dl324

Joined Mar 30, 2015
16,788
I'm sure you noticed that my schematic layout matched the mosfet schematic layout because I figured they knew what they were doing better than I did.
There's a lot of good stuff on the WEB and a lot of bad stuff. As with most things, you have to use your knowledge and experience to determine which is which. I'll repeat this whenever the opportunity presents itself. There will be some who think it's unnecessary. I don't agree and I'm too old to care what some self-proclaimed-know-it-alls think.
I really realized that when I started looking into 'simple' mosfets and bjt transistors. My head started hurting bad.
It doesn't have to be difficult.

BJT's are current controlled devices. You turn them on by causing current to flow into the base of NPN transistors or out of the base of PNP.

MOSFETs are voltage controlled devices. You turn them on by applying a voltage to the gate that exceeds the threshold voltage. For N channel enhancement mode MOSFETs, Vgs is positive and for P channel it's negative. For MOSFETs, driving them harder will reduce ON resistance.

Depletion mode MOSFETs aren't common and are on with no gate bias. Same for JFETs; except that depletion mode MOSFETs can also be operated in enhancement mode.

I want to try to make a board and make some encoders for my milling machine
I'm envious. I want a CNC milling machine, but it's not feasible at present...
 
If you're interested in suggestions that would make your schematic easier to read.

Flow should generally be from left to right and top to bottom. Unnecessary wire jogs and crossings should be avoided. Since the outputs are on the left side of the component you're using, you could mirror or just draw the outputs on the left. I've redrawn your schematic in Eagle with the suggestions I made (I printed instead of using a screen capture to avoid the colors Eagle uses and that I don't find all that useful):
View attachment 95905
Much nicer layout! Here's the same circuit in an online tool that let's you simulate as well:
https://www.systemvision.com/design/indicator-circuit
I didn't take the time yet to try and match the transistor datasheets, but there is a tool for that on the site.
indicator circuit.png
 

Thread Starter

Mark Johnsen

Joined Nov 30, 2015
15
I'm envious. I want a CNC milling machine, but it's not feasible at present...
You're welcome to come by any time and use it. It doesn't get enough use. I just ask that its left in usable condition for whomever turns it on after you.

I have a demo board of a different AMS magnet sensor and I'm going to put it on my spindle motor for rigid tapping. That's how I got hooked on these sensors. We'll see how it goes...

Thanks again for your help.
 
Whoa - that's pretty cool, I'll ceck it out.

Mark
Mark,
I updated the schematic at https://www.systemvision.com/design/indicator-circuit/ with component models for 2N3904 and 2N3906 models. It appears that with a 10K pull-up resistor (R8), the pnp transistor was staying on when it wasn't supposed to. I modified it to 1K and the circuit seems to work better.

You can make a free account on www.systemvision.com and make a copy of the circuit. This will allow you to play with the biasing to optimize the configuration.

Darrell
 

Thread Starter

Mark Johnsen

Joined Nov 30, 2015
15
Mark,
I updated the schematic at https://www.systemvision.com/design/indicator-circuit/ with component models for 2N3904 and 2N3906 models. It appears that with a 10K pull-up resistor (R8), the pnp transistor was staying on when it wasn't supposed to. I modified it to 1K and the circuit seems to work better.

You can make a free account on www.systemvision.com and make a copy of the circuit. This will allow you to play with the biasing to optimize the configuration.

Darrell

Darrell,

Thanks for doing that. I created an account and copied the design. For some reason when I goto your link, it doesn't show as copied, but I do have it and will look at it.

Interesting to hear that the PNP circuit didn't work as planned. Seems nothing is as easy as you'd like:)

I might try replacing the transistors w/ Mosfets for fun, just to see how that changes the circuit. I did plan on breadboarding the circuit and will have the parts middle of the week. I also bought a couple mosfets to try as well, so I can compare.

Thanks again!
Mark
 

dl324

Joined Mar 30, 2015
16,788
Interesting to hear that the PNP circuit didn't work as planned. Seems nothing is as easy as you'd like:)
I didn't give much consideration to the resistor values as they depend on the voltage used for VCC; which wasn't specified.

I might try replacing the transistors w/ Mosfets for fun, just to see how that changes the circuit.
You won't have a problem with bias currents if you use MOSFETs.
 
Darrell,

Thanks for doing that. I created an account and copied the design. For some reason when I goto your link, it doesn't show as copied, but I do have it and will look at it.

Interesting to hear that the PNP circuit didn't work as planned. Seems nothing is as easy as you'd like:)

I might try replacing the transistors w/ Mosfets for fun, just to see how that changes the circuit. I did plan on breadboarding the circuit and will have the parts middle of the week. I also bought a couple mosfets to try as well, so I can compare.

Thanks again!
Mark
Mark,
If you login to systemvision.com, when you visit the design link that I posted, you can hit the button that lets you make a copy and edit the design. This will be your own copy of the design, so you can do whatever you want with it and it won't affect the original.

BTW, I work on the systemvision.com team, so feel free to ask anything about how it works.

Darrell
 
Top