How's my design. Critique please! :) - Page 1
Forum section: electronics / projects

author: Falcon69
author_rank: Super Contributor
timestamp: February 17, 2014, 04:46:02 pm
content: Anything wrong with my design? (PDF attachment) I'd like to know before I order up the components to build a prototype.The idea behind this circuit:Hall Effect Switch activated by MagnetSelectable Normally Open or Normally ClosedDual Led, Green when powered, Switching over to Red when trippedAnalog SPDT switch (not mechanical) for switching between normally open or normally closed.Do you see any problems with this circuit?Wire 1 (pin 6 on the SN74) would either be connected to the power source (+5 volts) or to the ground to select which output for the analog SPDT switch.Basically, the power (wire 2) and ground (wire 5) will be ran from an external supply. Then the wires 3 and 4 would connect to a Breakout board output. This circuit I'd like to act on the breakout board like I had installed a Normally Open or a Normally closed mechanical switch, based on the various ways of wiring. For example, I may have 3 switches tied in series that are normally closed. If one gets disconnected or cut by accident by the machine, the machine would see the normally closed switch as an open circuit now, telling the software to shut the machine down.The most the circuit will see as far as amperage is maybe 100mA max I am guessing.The components I have chosen were selected because I have VERY limited room on the small pcb board I am designing for it. The pcb board is about 22mm x 13mm. Very small for this amount of components. My traces will be .16mm wide at 1oz copper. I checked and it appears a trace of that size at 1inch length can carry about 316mA in an internal layer. These will be cast in resin to protect from debris. The Optocouplers were the smallest I can find. They have a 1.27mm footprint, whereas most others are 2.54mm. I don't have the room for the bigger kind. The two transistors (PNP/NPN) will actually be in a single case, SOT-363, BAT846BPDW1, I don't have that labeled on the schematic.Only the two wires coming from the Optocouplers would be going to a Breakout Board for CNC Control. Those would simulate plugging in a mechanical switch (which only have two wires). But, I want to do this because these switches are more accurate, faster, and have no moving parts that dust or debris would effect. A diode would need to be added for each switch that is connected in parallel to the Breakout Board if using the Normally Open option.I'd like ideas on suggestions/changes before I go blow money on components for testing. I'm a college student and funds are kinda low atm. Any help would be greatly appreciated.Thanks Guys in advance.Jason

author: Falcon69
author_rank: Super Contributor
timestamp: February 18, 2014, 05:20:43 am
content: Nobody has opinions on this?Any advice or help would be greatly appreciated.I was also thinking of putting a diode Between the Normally Open optocoupler and the + supply line for breakout board. (the second optocoupler in the schematic, from left to right. with the cathode facing the transistors Emitter. But the anode side would be on the connection before wire lead going to the first optocoupler's transistor. (just below that connection, between there and the second optocoupler's transistor). This would allow the switch to be connected in parallel with other switches when in the Normally Open option. But, There may be a problem with that, will it drop the voltage too much if the breakout board operates on a 74HC14? Or a direct connection to the printer port?Thanks In advance for any help you may provide.Jason

author: oldway
author_rank: Super Contributor
timestamp: February 18, 2014, 09:41:01 am
content: More or less the same as a reed switch...

author: denizcan
author_rank: Regular Contributor
timestamp: February 18, 2014, 11:16:46 am
content: you made it unnecessarly complicated.. what's the deal with normaly closed vs normally open? if I was designing this and want that as option, I would just a small -solder on- jumper to select the mode. thats it.. aside from unnecessary complexity if this product is connected to wires you have to put protection diodes on those pins to protect delicate semiconductors from esd hazards..

author: Falcon69
author_rank: Super Contributor
timestamp: February 18, 2014, 04:12:18 pm
content: it will be cast in resin, so there will be no access to the board to place a solder jumper.

author: electronupdate
author_rank: Regular Contributor
timestamp: February 18, 2014, 05:33:49 pm
content: Some thoughts....SCHEMATIC STYLE--------------------1) Missing title block, missing revision information (even on hobby schematics not a bad idea as it can prevent errors)2) Missing reference designators on components... makes it difficult to do a design review and comment on a specific part3) Text run through by nets (BAT54CWTIG,2N3904).4) Missing leading zero on 0.1Uf (upper left). bad practice... can lead to 1 uF being loaded by mistakeDESIGN---------------1)The SN74LVC1G3157 could use a power supply de-couping capacitor. Not clear on how it's powered but a bulk-supply capacitor could also be of use.2) Hysteresis? Desired?3) Hall effect switch driver appears rated for 20 mA of continuous sinking... but the red LED alone draws 27 mA? (5 V - 2V (for led) - 0.3V (for BAT54) ) / 5V = 27 mA4) BAT54 are Schottky diodes but you have drawn them as silicon diodes.

author: London Lad
author_rank: Regular Contributor
timestamp: February 18, 2014, 05:42:01 pm
content: Why not just use a reed switch?

author: Falcon69
author_rank: Super Contributor
timestamp: February 18, 2014, 05:47:29 pm
content: Reed switch is not what I am trying to do here.Yes, I know, I need some work on the schematic aspect of things.That RED LED is rated at 3.4volts at 20mA.So a 0.1uf capacitor needs to be placed between ground and Vcc & A of the SPDT analog switch?

author: London Lad
author_rank: Regular Contributor
timestamp: February 18, 2014, 05:55:05 pm
content: I'm not trying to be rude here, I'm genuinely interested in why not a reed switch. A lot of the circuit ideas I see on here seem to be extremely complex to perform a simple task ?

author: Falcon69
author_rank: Super Contributor
timestamp: February 18, 2014, 05:59:38 pm
content: A reed switch is normally closed. Unless a magnet is continually close to it, to make it normally open, it won't work. The idea is when the switch moves near the magnet, it activates the switch. Maybe I don;t understand in how you propose a Reed switch will accomplish what I am trying to do.

author: oldway
author_rank: Super Contributor
timestamp: February 18, 2014, 06:16:11 pm
content: Quote from: Falcon69 on February 18, 2014, 05:59:38 pmThat's wrong, there are normaly open and normally closed reed switches as well as both options in the same reed switch.

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 12:38:11 am
content: I just looked at Mouser for Magnetically Reed Switches.There are none available for SMD. From my very limit knowledge, I've heard reed switches are not very fast, and not very accurate. Sure, they are much easier to wire up then most anything out there. But, I need to include resistors, transistors, etc, to switch between red and green, so having a very small surface mount device is needed. Reed switches are too big and appears to not be available in a surface mount.If I am wrong, please point my in the right direction so I can reevaluate.I have redrawn the schematic using an NPN/PNP transistors instead of the Analog SPDT switch. Much CHeaper and should work.I am unsure on the resistor values though.On the schematic, I'm only concerned with what is in the blue box. They grey box is two types of breakout boards output for limit switches. One of which is the Gecko G540 which uses an optoisolator with a 2k2 pullup resistor.Is it okay to take wire 3, and just connect it to ground? Thus, eliminating 1 wire and leaving only 4 that need to go to the switch? I ask, because, from the breakout board, wire 4 goes through optocoupler, and then to ground anyway.Also, the RLED (before i placed the schottky diode there) was giving me a reverse voltage higher then 5 volts, which is the threshold of that LED. Will the schottky diode protect that LED from too much reverse voltage? Should I just make it a regular diode? If I do, then do I need to recalculate the resistor value for the LED? The Vfof the RLED is 3.4v and Ifis 20mA. So with 5 volts going in (actually, with length of wire and resistance of wire, probably more like 4.9v) that is 75ohm for resistor value. If I calculate in the .3v drop for the schottky, that's 60ohms for the resistor value to keep the brightness the same (I made the resistor 100 to keep it under the 20mA).So, how's this circuit look? Better? Are the values correct for resistors and capacitors?Thanks in advance.Jason

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 12:47:46 am
content: oh, just found some reed switches that are surface mount on Digikey, however, they are too big. 2.4mmx2.4mmx16mm. The 16mm won;t fit in my case in the direction i would need it to go.http://www.digikey.com/product-detail/en/CT10-1530-G1/306-1125-1-ND/388965

author: free_electron
author_rank: Super Contributor
timestamp: February 19, 2014, 12:59:53 am
content: waay too complex for hat it needs to do.Code:-----+----------+---------------------------------------------------|| ||| 330r|10k || | 1/2 _V_ led 1/2_|___ | 74v2g14 | 74v2g14 ------- control no/nchall |-+----|>0---+----------+--|>o--- |_____| | | | __|_| _V_ led | --| |--------330r---optoled-| | ----------|____| || 330r 74v1g66 || | |----------------+---------------------------------------------------i count 4 resistors , two led's one dual inverter (74v2g14) ins Sc70 or sot 323 body. on 74v1g66 in sot 323 body and a single optocoupler.saved you 2 resistors , two diodes and an optocoupler.your double transistor is replaced by the double inverter. your 4157 replaced by a 66

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 01:14:07 am
content: thanks free_electronHowever, both those chips are obsolete and discontinued.

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 01:41:28 am
content: These work?http://www.nxp.com/documents/data_sheet/74HC_HCT2G14.pdfandhttp://www.ti.com/lit/ds/sces386l/sces386l.pdf

author: dannyf
author_rank: Super Contributor
timestamp: February 19, 2014, 01:58:43 am
content: The two leds (GLED and RLED) can be put on both sides of the hall sensor's output pin;The same can be done with the opto couplers' leds too.I agree that this is more complicated than necessary.

author: free_electron
author_rank: Super Contributor
timestamp: February 19, 2014, 02:39:31 am
content: Quote from: Falcon69 on February 19, 2014, 01:14:07 amthere is tons of alternatives aroundSN74LVC2G14DBVR. digikey has 57000 in stock , factory has 549000 in stockSN74LVC1G66DCKR digikey has 46000 in stock , factory has 735000 in stock.these are made by both NXP and TI.there is a whole slew of singlegate families around dont pinpoint on the 74v1g series.go to digikey website and search for 'single gate'. then pick inverters (5003 different ones) pick number of circuits 1 and 'in stock'. 2712 results ….

author: free_electron
author_rank: Super Contributor
timestamp: February 19, 2014, 02:40:23 am
content: Quote from: dannyf on February 19, 2014, 01:58:43 amhall sensor is open collector output … driving bottom led doesn't work.that is why i put a pull up resistor and a single inverter. the inverter makes it push pull.

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 03:00:05 am
content: Thanks Free-ELectronI will redraw the schematic, based on your suggestions.No Capacitors for noise control? These switches will be having Spindle motors operating from a a 220volt or 380volt Variable Frequency Drive (VFD) and Stepper Motors operating on up to 80volts DC.Granted, the cable will be braided shield, but still, I'm expecting some noise, which could cause a false trigger with the circuit.

author: free_electron
author_rank: Super Contributor
timestamp: February 19, 2014, 03:03:10 am
content: one ceramic 4.7uf cap in 0805 will do fine for the entire circuit.the hall sensor is not sensitive for electrical noise. the schmitttriggers used do the rest ( that is why i picked the 14 and not the 04 )

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 03:19:18 am
content: so cap in the same place as c1 or c2 in the schematic?

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 05:55:30 am
content: free_electron,I don't quite understand your drawing. I think it is something like I have for the schematic I redrew (pdf attachment), but I don't understand 3 of the connections. They are in a red circle on the schematic.Also, I think I may have the inverter (SN74LVC2G14) backwards?Also, the LED's I will be using are:RLED 3mm diameter, If=20mA, Vf=3.2vGLED 3mm diameter, If=20mA, Vf=2.4vThe LED in the Optocoupler is If=50mA, Vf=1.3vI'll need to figure out the proper resistors for those in this circuit.In the original circuit that I have now (old style switches I had already made a year go), the Red LED had a 100ohm Resistor and the Green had a 270ohm resistor. That gave the light intensity to the eye about even. But, with this new circuit, I'm not quite sure what values I need now.I've never used inverters or the bilateral switch. SO, I am not sure how to even calculate the current and resistance draw through this whole circuit.I am guessing, that when the Hall Sensor is triggered, The ground flows through it. I don't know. I need some explanation.Thanks again, in advance for the helpJason

author: denizcan
author_rank: Regular Contributor
timestamp: February 19, 2014, 07:59:34 am
content: you do not need dual inverter.. just use single xor gate to drive the opto.. btw what's the deal with opto if you are suplying power to circuit.. to interface other circuit that does not have common ground with the supply of this?

author: Falcon69
author_rank: Super Contributor
timestamp: February 19, 2014, 10:54:55 pm
content: Quote from: denizcan on February 19, 2014, 07:59:34 amThe opto is to isolate the connection from the breakout board. I don't want anything interfering with the breakout boards output, except to switch to ground. It should be as if I just plugged in a mechanical switch.I don't understand what you mean Denizcan about the XOR gate.free_electron, can you elaborate on your schematic you drew up? I tried to redraw the schematic, based on how you described, but I'm confused on the proper inputs that I have marked in a red circle on the schematic I drew.Thanks in advance guys.Jason

author: daveatol
author_rank: Regular Contributor
timestamp: February 20, 2014, 07:01:12 am
content: This is a simple version; happens to use the XOR as someone mentioned above. Inverter can swapped out for your NPN/PNP device you selected, wired as emitter-follower (just swap LED colours), if you wanted.

author: Falcon69
author_rank: Super Contributor
timestamp: February 20, 2014, 08:22:49 am
content: That's what I thought. Thank you for clearing that upIs there an IC that has both a single XOR Gate and an Inverter in one? That would be nice.I am not sure that the placement of the Capacitor is correct.It looks like, from the simulation, that the total current draw is 20.4mA for Normally Closed operation, and 27.38mA for Normally Open operation. That, of course, does not take account for the Hall Effect switch, for which I have just substituted in a normal SPST switch for.I have a question though, in the simulation, when you click on the little lead going to the +5v, it shows current as 9.4A. That is too much, way too much. Do I need a resistor (R5) in there somewhere?EDIT: I just realized that the resistor in the pictures are labeled as R1 for both the 10k and the 560 ohm ones. the 560 is suppose to be R4.Thanks Guys. Your Help is greatly appreciated.Jason

author: daveatol
author_rank: Regular Contributor
timestamp: February 20, 2014, 08:32:15 am
content: Quote from: Falcon69 on February 20, 2014, 08:22:49 amA dual XOR IC can provide that, tie one input high for the inverter.

author: Falcon69
author_rank: Super Contributor
timestamp: February 21, 2014, 04:12:02 am
content: Thank You daveatolI have a question, when I look at this dual XOR Gate, I am confusedhttp://www.fairchildsemi.com/ds/NC/NC7WZ86.pdfThe current is -32mA for High and 32mA for Low, I don;t understand what that means.Would this chip work for my application?Also, Can someone explain why i was getting 9.4mA with the current going through the Cap. I noticed when I changed that Cap Value, that current went down, Kinda like if it was a resistor. So, should I run simulation again and find a cap value that puts the amperage really low? like under 1mA? Or keep the cap at 4.7uF and put a resistor in line?Thanks in advance guys for your help,Jason

author: daveatol
author_rank: Regular Contributor
timestamp: February 23, 2014, 01:27:41 am
content: Quote from: Falcon69 on February 21, 2014, 04:12:02 amIt means it can source or sink 32mA. -32mA means the  output is sourcing the current, (+)32mA means it (the low output) is sinking the current.Quote from: Falcon69 on February 21, 2014, 04:12:02 amYou said the current to drive the LEDs in under 30mA, so I guess this IC should be fine. It is the required dual XOR type.The cap between VCC/GND should not have current through it unless it is AC current (caused by an AC voltage on the VCC).

author: Falcon69
author_rank: Super Contributor
timestamp: February 23, 2014, 03:23:24 am
content: Thanks Dave, that cleared it up.I found out why I had current going through the capacitor when running the simulation. I am using this online simulator Applethttp://www.falstad.com/circuit/and when I clicked on the Capcitor to edit, it was default checked for Trapezoidal Approximation. Whatever that means. When I unchecked it, it stopped having current going through it.That program helped me understand Logic Gates.I was able to redesign the circuit for 8 total switches, a separate set of red and green LED's that I can place on the front of my control panel, and a separate red and green led for a rear panel mount. Plus, I figured out how to make it so when a reset button was pushed, All the LED's came on (for testing) and without effecting the Optocoupler LED. I also was able to make it so the switches could be normally open or normally closed if I wanted them to be.I'm excited I figured it out!Now, is there anything wrong with this circuit? Should I place any diodes anywhere? I was going to place a 0.1uF capacitor on the other end of each switch as well to help with noise issues, if any. That would go right before the switch on the rear panel plug in. One for each switch.With 8 switches, plus the front LED Panel, and the rear Panel....All those LED's on at same time, being tested, I estimate total amp draw is 680mA. Quite alot, but I think it will work.

author: electronupdate
author_rank: Regular Contributor
timestamp: February 24, 2014, 07:23:59 pm
content: I don't see a pull down on your "test LED" switch.... depending on the logic family you choose you may not be able to get a reliable '0' with out one. It also will not work for the 'blue' LED (marked Opto LED)... the state of the control switch will affect the forcing function of a test switch.The XOR gate driving the "opto LED" also probably needs a pull down.De-bouncing a switch with a capacitor across it is not a strong approach. A simple RC filter is more common.You have drawn a 4-way wire cross with a connection... not a good practice.

author: Falcon69
author_rank: Super Contributor
timestamp: February 24, 2014, 11:35:33 pm
content: Quote from: electronupdate on February 24, 2014, 07:23:59 pmI think I understand what you are saying.Do I have it drawn correctly now? I added a pulldown resistor for the opto and added the rc filter for the switches. I hope I understood you correctly and added them correctly.Ignore the 5 switches in the center. Those are simply there to simulate a connection. For example, I may have 20 ft between those points. Added the switches to see what would happen if the machine accidentally cut a wire or it came undone somehow. It performs as expected, turning the opto LED on or off (based on if it is normally open or normally closed) as if the switch was tripped.

author: electronupdate
author_rank: Regular Contributor
timestamp: February 25, 2014, 12:00:46 am
content: not quite.When the test switch is open what drives the inputs of the gates? If you trace through your circuit it appears to be what is termed a "floating input". Google that term to learn more.Switch closed... logic level set to a high voltage on inputs.Switch opened... floating input.

author: Falcon69
author_rank: Super Contributor
timestamp: February 25, 2014, 12:07:34 am
content: cant have floating inputs on the logic gates? I dont understand how to NOT make them floating.They have a GND and Power input on them (not shown in drawing). The simulation I have automatically makes them have a GND and Power input, though, it does not show it. That Power input is +5v.

author: Falcon69
author_rank: Super Contributor
timestamp: February 25, 2014, 12:20:37 am
content: Like this now?

author: jolshefsky
author_rank: Regular Contributor
timestamp: February 25, 2014, 12:28:30 am
content: Quote from: electronupdate on February 18, 2014, 05:33:49 pmI'm learning on my own designs to use a consistent unambiguous scheme. One thing is to use the unit as the decimal point:Capacitors:22P = 22 picofarads100N = 100 nanofarads (0.1µF)3U3 = 3.3 microfaradsResistors:0R15 = 0.15 ohms150R = 150 ohms2K2 = 2.2 kilohms3M = 3 megaohmsI'm working on a design with more-precise resistors, so I use 10K0 to indicate 10.0K implying 1% accuracy.I'll need to get further into the thread to see about the design as it goes, but "too complicated" does also come to mind.It looks like you are trying to make a general-purpose limit switch, but with sufficient limitations (e.g. 80V & 400mA isolated outputs) that a design specific to your immediate application would be more compact and more reliable. I don't understand the application that could supply nice clean 5V power but not be able to accept a simple open-drain / source-to-ground configured MOSFET to switch.

author: Falcon69
author_rank: Super Contributor
timestamp: February 25, 2014, 01:19:48 am
content: Ya, I am trying to get into that practice as well.The schematic shows a 2.2k resistor. The simulation program I am using (which is where the screen shot is from), doesn't display that 2.2k resistor as 2K2.As far as the switch, you have to imagine 8 total switches, with a plug in board that has a red and green(switches based on hall sensor state), and a LED board that will mount on the front of a control panel. That's why it looks as it does.the current design i have right now uses 3x ULN2803 chips, and i am having minor problems with it, plus, it is not selectable for NO or NC switches. I also want to completely isolate the switches from each other and the circuit.