Need a magnetic key switch

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
Bah, lack of sleep this week is scrambling my brain. ;) This circuit is actually going to be the master switch for secondary controls which will control the motor, but I believe it's going to be one big V+ line with everything else chassis grounded. I'll try to get a schematic posted by later today.
 

AnalogKid

Joined Aug 1, 2013
10,987
The FET you have is N-channel. NPN is a bipolar term. However, in terms of their application in this circuit, they are generally equivalent. Both need a drive voltage that is greater than the "lower" terminal. For the FET, the gate must be at least 5 and should be 10 volts above the source. This is roughly equivalent to the base of a bipolar NPN transistor having to be higher than the emitter. As shown in my schematic, the source is connected to GND and the base is pulled up to 10 or 12 v.

What you were trying is called a source follower, a parallel to the emitter follower. Having the load in the source of an n-channel FET will work if you can get the gate up to +10 V above the source, which would be +22 V above GND when it is driving a 12 V load. There are gate driver circuits to do this, but that is way unnecessarily complex for your application.

ak
 

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
Thank you for the excellent explanation, now I understand exactly why it burned up when I had my load connected to the source. Vgs was close to 0, but really needed to be >=10.

If I switch to a p-channel MOSFET then I can put it on the V+ line and not need a voltage booster for the gate. Actually it will be "on" when the gate is grounded, and off when the gate has some voltage, is this correct? Then I could tie the output of the hall effect sensor directly to the gate, with a current limiting resistor, since the hall effect sensor outputs positive voltage in the absence of a magnet, and sinks to ground when a magnet is present. I have to double check the spec sheet to see if the output of the hall sensor is adequate (on my phone at the moment waiting for my wife to shop for shoes), but does it sound like I have the theory right? Thanks again!
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
The hall sensor is just open collector so you just need a 1k pull up resistor, (device = 50ma max current) the resistor is all the load the hall effect will virtually see.
Max.
 

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
You are correct, it is open collector, thanks for pointing that out. I just downloaded the data sheet and it will sink up to 25mA.

I was thinking of a current limiting resistor between the hall sensor and the gate because of the capacitance in the gate, I didn't know if there was enough stored energy there to reduce the life of the hall sensor by allowing a spike of current. Is the gate capacitance typically so tiny that a resistor is not necessary here?

I'll order some p-channel devices and see if I can make it work. Thank you again to everyone for your time and help, I appreciate it!

Hall sensor data sheet:
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwjeiKPqtvPJAhUKy2MKHcG6BRcQFggdMAA&url=http://www.allegromicro.com/~/media/Files/Datasheets/A3141-2-3-4-Datasheet.ashx?la=en&usg=AFQjCNEx847Z2Pp07jOLRSZAy0J6sU45eQ&sig2=yzI3pVNzyGQFAySum_Hsyg&cad=rja
 

AnalogKid

Joined Aug 1, 2013
10,987
No need for a series resistor; the gate capacitance is very small. But you do want a 10K resistor from gate to source. This is what turns off the FET when the hall sensor output changes state.

ak
 

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
Here's what I'm going to try to make. Please pardon my messy schematic and ignore the device model numbers, this is my first foray into Eagle and I was just trying to find the right symbols. I'm going to borrow the p-channel power MOSFET from an old audio amplifier I have sitting here, because that will give me "right now shipping". :cool: The hall effect sensor is open collector and will sink up to 25mA when a magnet is present, and will operate with source voltage from 4.5 to 24v.

p-channel_switch.JPG
 

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
OK I was wrong, my doner amplifier had BJT's in it, not MOSFETs. For the short term I added a mechanical relay so my n-channel device now controls the relay, giving me something to test. And I ordered some p-channel MOSFETs to make the better circuit, hopefully they'll be here in a couple days.
 

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
Diode D1 is no big enough. Its forward current rating If should be at least equal to the load current.

ak
The part numbers on the schematic are not accurate, Eagle didn't have the part numbers that I have so I just used whatever parts had good pictures to draw the schematic and I couldn't figure out how to get the part numbers off of the screen (new to Eagle).
 

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
I made the p-channel circuit in my schematic above, and the results are mixed. Functionally it works great; with the magnet near the circuit turns on, remove the magnet and it immediately turns off. Mission accomplished in that regard.

The down sides are, it takes a heck of a magnet to turn it on, and the magnet has to be oriented correctly for it to work. I'm sure both of these are due to my choice of hall effect sensor. Watching the voltage on the "output" pin of the hall effect sensor, as I get closer with the magnet it suddenly flips from off to on, so it's a binary output, not gradual. Is there a way to increase the magnetic sensitivity of this sensor, or do I just need to shop for a more sensitive sensor?
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
Did you check to see if there is a difference in the sensitivity either side of the sensor?
I found the SS400's were not oriented dependent.
How far is the magnet from the sensor?
I picked up a qty of small button magnets off ebay for cheap, they are VERY strong field.
Max.
 

cmartinez

Joined Jan 17, 2007
8,220
I made the p-channel circuit in my schematic above, and the results are mixed. Functionally it works great; with the magnet near the circuit turns on, remove the magnet and it immediately turns off. Mission accomplished in that regard.

The down sides are, it takes a heck of a magnet to turn it on, and the magnet has to be oriented correctly for it to work. I'm sure both of these are due to my choice of hall effect sensor. Watching the voltage on the "output" pin of the hall effect sensor, as I get closer with the magnet it suddenly flips from off to on, so it's a binary output, not gradual. Is there a way to increase the magnetic sensitivity of this sensor, or do I just need to shop for a more sensitive sensor?
Are you using the A1321 sensor, as shown in your schematic?

If that's so, then it explains a lot. That kind of sensor is ratiometric, that is, it will deliver a voltage proportional to the magnetic field being sensed. What you want is a digital type of sensor (also called switch sensors), such as the DRV5033AJELPGMQ1. That sort of sensor will deliver either an on or off signal, which is what you really need. It also has more sensitivity (it will switch at about half the magnetic field strength of what you're using), and it's of the omnipolar type. Its working voltage is well within your specs too, although it's of the open drain type (not open collector) and you'd have to tweak your circuit a little bit for it to work the way you want.
On the other hand, if you're using either the A3141, A3142, A3143, or A3144, as you mentioned, they are also less sensitive than the one I'm suggesting. Keep in mind too that if you installed the sensor on or against a ferro-metallic surface, the magnet's field density will weaken a bit since it will spread through the metal.
 

Thread Starter

MrSoftware

Joined Oct 29, 2013
2,188
I'm using the A3141 that I found on Amazon (free 2-day shipping, wanted it fast). Thanks for the tip on checking sensitivity on the sides; moving the magnet around, this one actually seems to be most sensitive directly on top, my big (relatively) magnet will operate it from about an inch away on top. The smaller magnet just won't turn it on from any position.

Also thanks for that data sheet, I'll dig around and find some more sensitive sensors to use going forward. This one might be good enough to install on a test rig to prove the concept, but I'll definitely need more sensitivity going forward.
 
Top