Author Topic: Circuit....DId I mess up here?  (Read 19382 times)

0 Members and 3 Guests are viewing this topic.

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Circuit....DId I mess up here?
« on: October 03, 2014, 06:21:39 am »
Okay, long story short.  I already ordered the boards, and just now, I realize I may have messed up.  The boards have already gone into production, and can't be stopped and fixed.

The circuit below, is there a resistor needed between the emitter of the transistor and the input of the inverter?  The whole circuit is 5volts.  The circuit works, although, kinda weird, but I think it's my bread board, been having problems with it.

The SS441A is a hall effect switch.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2100
  • Country: sk
Re: Circuit....DId I mess up here?
« Reply #1 on: October 03, 2014, 07:17:41 pm »
it's not needed - you can safely strap the input to VCC, so the resistor is not needed there.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 19513
  • Country: lv
Re: Circuit....DId I mess up here?
« Reply #2 on: October 03, 2014, 09:17:06 pm »
Try to short the first led. Especially if it is blue color, voltage drop on it can mess up everything. Even if it is red or green, voltage on emitter won't go below 1+V.  +1 about 1 ohm resistors (really weird) and 100k resistor to GND2.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #3 on: October 03, 2014, 10:18:51 pm »
I thought a resistor needed to be in series with a logic gate and it's input, whether it is supply or ground.  I guess as long as the supply voltage is between the rated limits it is okay not to have a resistor?

Again, I thought a resistor to ground is needed between the input of the inverter and the emitter of the transistor. If there wasn't a resistor there, then wouldn't the inverter input be floating when the transistor is turned off?  And from my understanding, floating inputs of logic gates/inverters is bad in a circuit.

In another thread, they said to put a 1 ohm resistor in series with the 0.1uF cap for decoupling.  If it is not needed, I guess I can thrown in a 0ohm (jumper) in it's place.

GND2 is simply a connection point.  If I want the switch to perform as normally open, then I ground that wire, otherwise, it receives a supply voltage through that 100k resistor and gives a "1" output to the gate of that mosFET.  Making the switch default as normally closed.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #4 on: October 03, 2014, 10:23:34 pm »
Try to short the first led. Especially if it is blue color, voltage drop on it can mess up everything. Even if it is red or green, voltage on emitter won't go below 1+V.  +1 about 1 ohm resistors (really weird) and 100k resistor to GND2.

What do you mean 'short the first LED'?  The First LED, with cathode going to the hall switch, is red, the other LED is green. The hall switch can sink 25mA, and that LED will only operate around 17mA or so.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #5 on: October 03, 2014, 10:45:30 pm »
Ya, I was in a hurry. I didn't display the references.

So just using the 0.1uF cap is good enough on all my logic gates and inverters on this circuit, and future circuit?  Currently, I am working on a similar one, but uses 8 switches (pretty much identical circuits), then allows from a front panel with led's to indicate which led's are active on the switches themselves.  So in that circuit, I can eliminate the 1 ohm resistors as well?

If I put the led above the transistor, i.e. cathode to collector, then I am not sure I would have the voltage swing needed to turn on and off the inverter.  I will check it on simulation, but I agree. I normally don;t like using NPN as a high side switch.

If the wires are cut, while they are connected, (unlikely, but could happen) then wouldn't that cause a quick burst of voltage which could validate the need for that resistor being between the emitter of the transistor and the inverter/logic gate? Or, since the original supply voltage is 5 volts, that won't happen, only the current would spike?
 

Offline wraper

  • Supporter
  • ****
  • Posts: 19513
  • Country: lv
Re: Circuit....DId I mess up here?
« Reply #6 on: October 03, 2014, 10:57:04 pm »
Try to short the first led. Especially if it is blue color, voltage drop on it can mess up everything. Even if it is red or green, voltage on emitter won't go below 1+V.  +1 about 1 ohm resistors (really weird) and 100k resistor to GND2.

What do you mean 'short the first LED'?  The First LED, with cathode going to the hall switch, is red, the other LED is green. The hall switch can sink 25mA, and that LED will only operate around 17mA or so.
I mean that minimum voltage on the base will be the same as voltage drop on the led + voltage on the hall sensor output. Assuming that hall sensor can sink voltage to ~0.2V (there is some voltage drop, likely a bit higher) and red LED voltage drop which is around 1.8V, minimum voltage on the base will be ~2V -> minimum voltage after emitter follower will be ~ 2-0.6 = 1.4V, nowhere near logic 0. Transistor is never off.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 19513
  • Country: lv
Re: Circuit....DId I mess up here?
« Reply #7 on: October 03, 2014, 11:04:34 pm »
Ya, I was in a hurry. I didn't display the references.

So just using the 0.1uF cap is good enough on all my logic gates and inverters on this circuit, and future circuit?  Currently, I am working on a similar one, but uses 8 switches (pretty much identical circuits), then allows from a front panel with led's to indicate which led's are active on the switches themselves.  So in that circuit, I can eliminate the 1 ohm resistors as well?
it is not about good enough without a resistor. But bad enough with a resistor to completely screw up the decoupling capacitor purpose. There must not be any resistor in series with  capacitor unless for some unusual reason.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #8 on: October 04, 2014, 01:12:50 am »
Okay, i redid it. Anything wrong with this set-up?

I tested it on the breadboard. everything seems to work much better now.  Though, the switches will be ran along machinery, and have in some cases 35feet of cable. the cable is double shielded (braided/foil) and 28awg wires.

The green LED with the 820 resistor seems to give off about the same brightness level as the red with the 154 resistor.  At least, to the human eye anyway, which is what I am after.  The green LED uses up about 2.5 mA, while the red is about 18.7 mA.

The input to the XOR Gate U2 is working much better then that transistor.  I am now getting 5 volt and about 135mV.  Good range for turn off and turn on I think.  The transistor before to the inverter was way too close. It was like 3.8v and 1.8v. 

So, if this circuit looks good to you guys, I'll redo the boards and send them off again.  Sucks though, wasted all that money to have the others made.  Learning experience I guess.  That's what counts.  Learned some things today. :)

FYI, the Logic Gates put out 32mA and the Inverter does ±50mA continuous current, according to the data sheets (if I read them correctly).

Thanks Guys.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #9 on: October 04, 2014, 02:03:40 am »
oops, forgot the decoupling cap above U2.  Will fix that.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Circuit....DId I mess up here?
« Reply #10 on: October 04, 2014, 02:06:23 am »
Okay, i redid it. Anything wrong with this set-up?

More complicated than need be. You haven't said what the output interfaces to. If you are trying to emulate a microswitch the MOSFET will only look like a switch under specific circumstances.

The CNTRL input left floating will be sensitive. If it runs down a cable capacitive coupling from IN or OUT (depending what the hell they are switching) could even turn the whole thing into an oscillator.

If you don't mind the LED colors swapping with the state of the CNTRL input you could do the whole thing with one XOR gate. You don't need two LEDs either unless you are also using them to indicate the presence of power.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #11 on: October 04, 2014, 02:17:07 am »
The red goes on when the switch is tripped (magnet is close), otherwise the green stays on steady (turns off and switches to red when tripped)

The source and drain of the mosfet would be connected to another circuit that would need to sink to ground when the switch is tripped.

Anyway to solve the CNTRL thing?  It will be floating by default, unless the switch needs to be normally open, then it will be connected to ground at the end of the cable.

Because I only have 4 wires in the cable, I will need to use the drain/shield wire for the CNTRL wire.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Circuit....DId I mess up here?
« Reply #12 on: October 04, 2014, 02:47:25 am »
The red goes on when the switch is tripped (magnet is close), otherwise the green stays on steady (turns off and switches to red when tripped)

The green turning off tells you the same thing as the red turning on. One or the other being on tells you the circuit has power. Red being driven by the sensor and green being driven from the supply would tell you just as much in a slightly different way.

The source and drain of the mosfet would be connected to another circuit that would need to sink to ground when the switch is tripped.

That will only work if the grounds of the two circuits are connected (or at least held close to the same voltage). If they are connected why isn't the MOSFET source just connected to ground instead of being wired separately?

Anyway to solve the CNTRL thing?  It will be floating by default, unless the switch needs to be normally open, then it will be connected to ground at the end of the cable.

Because I only have 4 wires in the cable, I will need to use the drain/shield wire for the CNTRL wire.

A screened cable isn't screened if you don't ground the screen, it isn't going to work. You might be able to use the screen for ground. It depends if whatever you are connecting it to minds noise picked up on the screen being injected into its supply/signal ground rather than a chassis ground if it has one. If you can free up a wire for the CNTRL signal some capacitance to ground could swamp the coupled capacitance in the cable.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #13 on: October 04, 2014, 03:02:13 am »
What if I change R5 to 4.7k, then connect a 100k resistor between GND and U4.A that way the ground wire won't be floating.  In Simulation, it still functions as intended, except now, when CNTRL is connected to ground, there's 1.5mA current flowing through the CNTRL wire (before was zero).  No big deal really.

Would that solve the problem you mentioned?

Also, I could make the drain/shield the ground, and make another wire the control.  If that works better. that way, the shield is always connected to ground/circuit.

The mosfet (source) is not always grounded.  If the circuit it is connected to normally would sink to ground, however, some circuits require +5 volt pull up.  Also, some switches will need to be in series with each other in some cases, so leaving the mosfet as is (not connected to ground) would allow a series connection instead of just a single or direct connection or parallel switch operation.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #14 on: October 04, 2014, 03:03:42 am »
oh, just tested it on the bread board.  With the source and drain of the mosfet connected to a 12volt power and ground. It operates just as intended.  I tried on simulation and connected 4 switches in series (via the mosfets) and it also works as intended. Anyone switch is tripped, it shuts of the other circuit (mainly just the LED in an Optocoupler).
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #15 on: October 04, 2014, 03:48:11 pm »
any thoughts on this circuit? thoughts on what i said in last two posts?

the new circuit works better, but i still have concerns on what Rufus said about the shielding and noise.  i thought that the decoupling caps on each ic would take away the noise.

I need to get these made VERY soon, so any input is greatly appreciated.

Would it be good to put another cap between supply and ground to help with any noise if I use the shielding as the ground?  Maybe a 4.7uF Cap?

Thanks in advance

(fixed schematic below)
« Last Edit: October 04, 2014, 06:32:39 pm by Falcon69 »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #16 on: October 04, 2014, 06:40:18 pm »
I've read on the capacitance and noise when using shielded wires. I've heard that in some cases, it is better to ground both ends of the braid (shield) which makes a Faraday Cage that helps isolate noise for the wires inside the cage.  Others say it's bad and only connect one end.

The problem is that these switches/cables will go through a cable carrier and will be close to stepper motors or servos. Being that these will only be hobby machines, I don't see the motors operating at voltages above 80vdc.  however, there will also be spindles that operate via a VFD and could see high frequencies and voltages to control those.

The wire I have is 4 conductor, dual shielded (braid and foil).  My plan was to use the shield as the ground , and the other wires for power, signal, and mosFET in/out (source/drain).  The length of cable will not be any longer then 50ft (realistically, probably 12 feet for the most part).

I have room on the tiny circuit board for the switches for more components if need be to combat any problems that could arise from noise or what not.

Any suggestions? Maybe another cap? Comparator?  Or it's fine the way it is?  On the breadboard, it works great!  But, when i apply length of wire, then install on machine, I don't want to encounter problems.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Circuit....DId I mess up here?
« Reply #17 on: October 04, 2014, 08:13:43 pm »
I was waiting for someone else to chip in with free consultancy but it doesn't look like you have any other takers.

R2 doesn't do anything replace it with a short.

If you connect D2 and R4 between +5v and U2 output you can get rid of U3.

If you connect the CNTRL input to U2 B you can get rid of U4. The LED color will swap with CNTRL input state. If you really don't want that then drive the red LED from U1 and put the green across the supply which provides just as much information from the LEDs.

Reducing the value of R5 the CNTRL input pull up makes it less sensitive to picked up noise on the cable. Adding the pull down R7 just makes it worse.

You still possibly have problems with the MOSFET. MOSFETs are turned on when the gate voltage exceeds the source voltage by a certain amount. If the source voltage is not defined (because it is connected to 'some other circuit') then the MOSFET being on or off is not defined.

Regardless of what +ve voltage you place on IN, OUT will never go above about 3.5v so it won't look like a closed switch to IN for any IN voltage above 3 or 4 volts.

Then you can start protecting the circuit so it doesn't get blown up by static or transients when handled or plugged in and out. A resistor in series with the gate input that takes the CNTRL signal will limit the current in the chip's protection diodes. A capacitor to ground on the input will also help and filter out noise picked up on the CNTRL wire. The MOSFET gate will get blown by static/transients on IN or OUT. It probably needs a couple of small TVS diodes to protect it but without knowing what IN and OUT can be connected to it is hard to know what to do.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #18 on: October 04, 2014, 09:21:52 pm »
the mosFETs source and drain are connected to an external optocoupler of another circuit.

The red and green LED's only switch depending on what the SS441A is doing. if a magnet gets close, the red led lights and the green turns off.

The CNTRL wire has nothing to do with the LED's coming on or off. The control wire is only there to make the switch act as normally open or normally closed.

I tried taking out U3 as you said and connecting the D2 and R4 like you said.  It doesn't work as intended.  Now the switch will operate as normally open (unless the cntrl wire is grounded, then it will act as normally closed).  I only want the cntrl wire connected to ground IF i want the switch to perform normally open.  Otherwise, leaving it unconnected (default) makes the switch perform as normally closed, or rather, turns mosfet on, allowing current to sink to ground through drain and source.

The mosFET I am using is a enhanced Logic one.  It will turn on with a 3.3v or 5v logic input. On the breadboard, I connected a 12 volt supply and ground on the source/drain of the mosfet. it switches just fine.

I am not sure what you mean by TVS diodes. I have not used those yet. I think the mosFET I am using has them built in?  http://www.mouser.com/ds/2/302/2N7002BK-353610.pdf

A capacitor to ground on the control wire input into U4? Will another 0.1uF work fine for that?

IF I leave R5 as 4k7, and put a 100 in series with the control wire, will that work okay?  Simulation shows 1.04mA flowing through the control wire when it is connected to ground, 104.17mV going to the input of U4. When the cntrl wire is NOT connected, simulation shows the full 5v going to U4 input.

"Reducing the value of R5 the CNTRL input pull up makes it less sensitive to picked up noise on the cable. Adding the pull down R7 just makes it worse. "
So I would want more mA flowing through the CNTRL wire to reduce noise? If I make R5 1k, then 4.55mA flows through the wire, instead of the 1.04mA when R5 is 4K7.


Will these TVS Diode work?  From a quick read, it looks like I need one with operating voltage of 5 volts, and for break down voltage of 10%-15% above that (5.7v). This one has a peak surge current of 1A.

http://www.onsemi.com/pub_link/Collateral/ESD9B-D.PDF

The TVS Diode just gets connected between the ground and supply of the circuit, correct?
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #19 on: October 04, 2014, 10:08:28 pm »
Here's the circuit, if I understood you correctly Rufus

 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #20 on: October 04, 2014, 10:44:48 pm »
I played around with it alittle more.  By supplying 5v to input B of U2 and eliminating the inverter, and switching the color of LED's, instead of how Rufus suggested, (all though basically exactly as he suggested  :-+ )  the circuit works as intended.  I did not know that D3 would ground out through U2. Interesting.

Is R2 even needed?

So, looks like the circuit should work fine, just abit confused as far as what Rufus was explaining, with the CNTRL input and Transient Voltages (i.e. TVS Diode). If someone could suggest a TVS diode to use, that would be great. the one I linked I think is way to small for my fingers/tweezers to try and place.  It's the size of about an 0402 case.  0603 is about as small as I can physically handle. Something about the size of an 0603 or 0805 package?

FYI, I really appreciate the help Guys, and especially Rufus. Your guys comments are helping me finish this circuit correctly, and Helping me to learn as well.
« Last Edit: October 04, 2014, 10:50:17 pm by Falcon69 »
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Circuit....DId I mess up here?
« Reply #21 on: October 04, 2014, 11:46:52 pm »
R2 can be a short circuit.

R5 needs to go to the other end of R6, C4 also needs to go to the other end of R6.

R6 needs to be 47k or something. It limits the current into the IC pin when there is a high voltage transient on the CNTRL line. The higher the better limited by leakage current of the IC pin, C4, and across the PCB if it gets dirty. The value of R5 can go up again if you care about the wasted supply current. R1 is also lower than it need be.

I still don't think you understand how MOSFETs work and so won't be able to understand if it will work with whatever connections you need to make to IN and OUT.

The MOSFET has an absolute maximum rating of +/- 20v on its gate with respect to its source. A 12v TVS diode between gate and source would protect the gate but passes the transient on to the IC output. Making R7 10k or something would probably be enough protection for the IC at the cost of slightly slower MOSFET switching.

A TVS diode across the supply doesn't hurt but doesn't do much good either.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #22 on: October 05, 2014, 01:20:48 am »
Okay, I think I understood you correctly.

Here is an Updated Schematic.

The CNTRL input will only be plugged in (or not plugged in) once.  Once it is connected to ground, it will stay that way.  I noticed on simulation that it takes nearly 5 micro seconds for the U3 to switch the mosfet on.  But, once the cap charges, it's pretty instant (well, to me nano seconds is instant). So, that is not a big deal because the CNTRL wire won't be plugged in and disconnected multiple times.

The circuit in the grey box..that is the external circuit.  The one the mosfet's drain/source connect too.

The mosfet i think already has the TVS diodes built in. am I wrong? (see picture of data sheet)

Again, thank you Rufus for all your help :)
« Last Edit: October 05, 2014, 01:33:53 am by Falcon69 »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Re: Circuit....DId I mess up here?
« Reply #23 on: October 05, 2014, 01:40:25 am »
hmm, i tried changing R1 to 100k and the circuit acted wierd.  Red LED still stayed lit, though dim, when the hall sensor was tripped. Just didn't switch well at all with the 100k.  I put in a 4K7, and that worked okay, lowering the mA of current it was sinking.  I can probably go abit higher, but I've already bought the 4K7 resistors. 
« Last Edit: October 05, 2014, 01:42:17 am by Falcon69 »
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Circuit....DId I mess up here?
« Reply #24 on: October 05, 2014, 02:09:49 am »
R5 needs to pull up not down.

Yes MOSFETs have gate protection diodes because the gates are so fragile just handling them would likely cause damage without. Most data sheets don't mention them or have any rating for them. The NXP data sheet does - 2kV and human body model but plugging two bits of equipment together isn't the same as a human body - there is no resistance and so more potential for damage even with less voltage.

The connection to the 'other circuit' will work as long as ground on the 'other circuit' is strapped to or held close to ground on 'this circuit'. If you wire +12v to IN and put the resistor and isolator between OUT and ground the isolator LED will get about 1/4 current and probably won't work.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->