Go Down

Topic: MOSFET or BJT for data lines? (Read 651 times) previous topic - next topic

sarah20

Oct 08, 2020, 12:39 am Last Edit: Oct 08, 2020, 12:47 am by sarah20
Hi, i have a very basic question but i cant make a decision as to which type of transistor to use.

im designing a circuit that allows a micro to connect to a stn2100 with Serial interface and i want to be able to "tap" into the data lines (TX and RX) to bypass the micro and directly talk to stn2100 with an ftdi board when needed. so i decided to put transistors in series with the data lines so that when saturated, my micro is connected to the stn2100, otherwise the connection between the two is disrupted and i can use the ftdi to connect to the data lines and talk directly to the stn2100. but when it comes to deciding the type of transistors, i just cant simply make my mind! should i use N MOSFET or NPN BJT for this purpose (i read in many websites that mosfet has a faster switching than bjt but its more expensive and it is more sensitive to ESD)?
im kinda bad bad at explaining so if you have a questions please let me know!
Thank you!

Semtex9

Mosfets virtually don't draw any current, but trickier to work with, they are very inexpensive just like bjt when we talk about signal level transistors (milions of them in a cpu).

Both mosfet and bjt will be sensitive to EM interference, and you will need to pulldown the base (or gate) to the ground with a pulldown resistor.

As for ESD, i never burned one by touching, and I was never very careful with them. But grounding yourself is recommended when handling.

If you need multiple, maybe a logic level cmos IC with logic gates on it would be nice like 74HC family? I don't know what voltages you are running the lines on, but i assume its under 6V.

sarah20

Thank you for your explanation it helped a lot! i only have wo data lines that i need to control and they both run between 5-5.5V.

Semtex9

#3
Oct 08, 2020, 06:19 am Last Edit: Oct 08, 2020, 06:41 am by Semtex9
Thank you for your explanation i
t helped a lot! i only have wo data lines that i need to control and they both run between 5-5.5V.
cool, then you can use either one, no worries, with cmos drawing the least current from your signal lines, and fastest. mosfets are trickier mainly because the gate is almost like a capacitor, and it stays on for some time after it is energized, even if the control signal went out, that's why you need to connect at least a resistor between the gate and ground so it can de-energize, it needs to be large enough not to bleed current from the line, and small enough to discharge the gate in time... bjt dosen't have that issue, but it bleeds some small current on its own. some cmos ic-s have internal pulldowns, but always check datasheets to be sure. The size of the resistors needed will become aparrent when you check gate capacitance in the datasheet, it is miniscule in a small signal mosfet, so you can use fairly large resistors, and still get blazing turnon/off.

both are probably much faster then your pwm dutycycle, but you need to be sure.

The difference becomes more aparrant when switching larger currents, where bjt will waste fairly large current to stay on, while the mosfet will still turn on just with voltage being present on the gate, largely outperforming the bjt, thus the price gap.

PerryBebbington

Hi Sarah,
I don't understand from your explanation what you are doing, please post a schematic.

These days use MOSFETs for everything. There has to be a really good reason to use a bjt.

6v6gt

#5
Oct 08, 2020, 08:47 am Last Edit: Oct 08, 2020, 08:55 am by 6v6gt
If you are re-routing the TX and RX lines between devices, you could also consider an analog multiplexer chip. say the CD74HC4052. These are very cheap and quite easy to use.

Edit
I've just noticed that @semtex9 had made a similar suggestion.

sarah20

Hi Sarah,
I don't understand from your explanation what you are doing, please post a schematic.

These days use MOSFETs for everything. There has to be a really good reason to use a bjt.
i have attached the draft schematic to this message, but it isnt complete yet and it has a looot of things i need to fix. Q9 is the MOSFET array im using so that when i ground the gates, i would have access to each individual ic's UART. i have another question tho, should i attach a pull up resistor to the uart lines? 


sarah20

If you are re-routing the TX and RX lines between devices, you could also consider an analog multiplexer chip. say the CD74HC4052. These are very cheap and quite easy to use.

Edit
I've just noticed that @semtex9 had made a similar suggestion.
thank you, im trying to keep the cost to absolute minimum (even though my ics are quite expensive!) so id rather incorporate mosfets instead of a dedicated chip.

PerryBebbington

Your MOSFETs seem to just join Rx to Tx, I don't see what they are supposed to do. If you want to switch serial data then 6v6gt's suggestion is best.

Serial does not require pull the up or pull down resistors.

This might just be a personal thing but I hate join the dots schematics, the whole point is to show connections with lines, not have to find where things go by searching all over the schematic.

6v6gt

You have another alternative of using dip switches to re-route Tx and Rx.
Here is an example of a somewhat similar design, actually it is connecting an Arduino Mega to an ESP8266 where the TX and RX have to swapped around to program the individual components.  Schematic

Paul__B

thank you, im trying to keep the cost to absolute minimum (even though my ics are quite expensive!) so id rather incorporate mosfets instead of a dedicated chip.
The inexpensive "dedicated chip" avoids a number of support components; so that would be false economy.  :smiley-roll:

sarah20

Your MOSFETs seem to just join Rx to Tx, I don't see what they are supposed to do. If you want to switch serial data then 6v6gt's suggestion is best.

Serial does not require pull the up or pull down resistors.

This might just be a personal thing but I hate join the dots schematics, the whole point is to show connections with lines, not have to find where things go by searching all over the schematic.
well the design consists of 4 schematic pages and the header im using for that purpose is in another page! but i have attached the STN_TX and STN_RX to that header. 
this is my first time ever designing a board and im still trying to learn how to use the easyeda website. sorry if i caused any confusion. 

sarah20

You have another alternative of using dip switches to re-route Tx and Rx.
Here is an example of a somewhat similar design, actually it is connecting an Arduino Mega to an ESP8266 where the TX and RX have to swapped around to program the individual components.  Schematic
i dint think of dip switches, it is a lot simpler solution thanks!

TomGeorge

Hi,
Have you prototyped any of this, before committing to PCB, like connecting the Tx/Rx to the controller to see if you can communicate with it.
It looks like you are trying to make a OBDII reader.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

PerryBebbington

well the design consists of 4 schematic pages and the header im using for that purpose is in another page! but i have attached the STN_TX and STN_RX to that header.
this is my first time ever designing a board and im still trying to learn how to use the easyeda website. sorry if i caused any confusion.
Not posting the whole schematic severely limits the help you will get, we are not telepathic (well, I'm not) and can only comment on what we can see. However, what I can see is the MOSFETs across Rx and Tx, regardless of whatever else I can or can't see, this won't do anything useful.

I see 6v6gt suggested DIP switches, if that does what you want then all good. I have zillions of 4052s and would be happy to send you some if you are in the UK.

Go Up