Author Topic: Hall Effect to Trigger Light Switch  (Read 20738 times)

0 Members and 1 Guest are viewing this topic.

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Hall Effect to Trigger Light Switch
« on: September 09, 2014, 12:23:00 pm »
Goal:  Turn on the light in my entryway when the door is open.  I am trying to add Hall Effect sensors to my repertoire, so including that would be nice.

My electronics skills are beginner at best, so I am trying to do this project simply and without a microcontroller if possible.


My idea:
A magnet pulls my 3144 Hall Sensor from 5v to ground, so I figured that I could use that 5v to trigger 5vDC relay, 87 and 30 of which would go to the 2 points at the light switch.  It is just powering one bulb, so I figured that would be well within the current limits of the relay.

Problem:  I pulled the Hall up with a 10K resistor, and that does not provide enough current to trip the relay.
I added a 2n3904 transistor to step it up, but that had the same result.  I added another with no apparent effect.

From there, I tried posting on an electronics forum, but the light is still off.  Any suggestions would be appreciated.



Pretty much everything I know about this stuff comes from working on cars, wiring houses, and the minimal time spent on my arduino (aversion to programming).  So I am struggling with some of the nuances.
 

Offline PepeK

  • Regular Contributor
  • *
  • Posts: 62
  • Country: sk
Re: Hall Effect to Trigger Light Switch
« Reply #1 on: September 09, 2014, 12:49:04 pm »
What about a sensor used for security purposes to detect open doors, windows etc ? This consists of two pieces, the first one is mounted on the door (magnet in plastic), the second one contains contacts switched by the magnet. Use 5 or 12 DC adapter for safety and connect this in series with a solid state relay switching a bulb.

See link :  http://www.homesecuritystore.com/honeywell-943wg-wh
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #2 on: September 09, 2014, 01:35:40 pm »
That seems like a reasonable price.  I just figured that with a hall effect sensor, it should be fairly simple to make my own, as these store bought ones, I assumed, were just a Hall or Reed.

Why do you suggest a solid state relay, and do you know where to get them cheaply?
 

Offline WarSim

  • Frequent Contributor
  • **
  • Posts: 514
Re: Hall Effect to Trigger Light Switch
« Reply #3 on: September 09, 2014, 02:09:04 pm »

Goal:  Turn on the light in my entryway when the door is open.  I am trying to add Hall Effect sensors to my repertoire, so including that would be nice.

My electronics skills are beginner at best, so I am trying to do this project simply and without a microcontroller if possible.


My idea:
A magnet pulls my 3144 Hall Sensor from 5v to ground, so I figured that I could use that 5v to trigger 5vDC relay, 87 and 30 of which would go to the 2 points at the light switch.  It is just powering one bulb, so I figured that would be well within the current limits of the relay.

Problem:  I pulled the Hall up with a 10K resistor, and that does not provide enough current to trip the relay.
I added a 2n3904 transistor to step it up, but that had the same result.  I added another with no apparent effect.

From there, I tried posting on an electronics forum, but the light is still off.  Any suggestions would be appreciated.



Pretty much everything I know about this stuff comes from working on cars, wiring houses, and the minimal time spent on my arduino (aversion to programming).  So I am struggling with some of the nuances.
Not enough current for a cheep BJT.  Use a TTL MOSFET.  If I guessed at your cct correctly be sure to use a gate discharge resistor and a suppression diode.  Few body diodes do well with inductive loads. 


Sent from my iPad using Tapatalk
 

Offline PepeK

  • Regular Contributor
  • *
  • Posts: 62
  • Country: sk
Re: Hall Effect to Trigger Light Switch
« Reply #4 on: September 09, 2014, 02:29:14 pm »
That seems like a reasonable price.  I just figured that with a hall effect sensor, it should be fairly simple to make my own, as these store bought ones, I assumed, were just a Hall or Reed.

Why do you suggest a solid state relay, and do you know where to get them cheaply?

As you mentioned you are a beginner, my suggestion is to focus on a safety and do not use anything 120 V (American) or 230 V  (Europe) close to the doors. Especially if the door's frame is made from metal ... Create a safe circuit (powered by a double insulated adapter / transformer like 5 V / 9V / 12V) on the "switch" side and hide the SSR or other power relay into a double insulated case.

Regarding your SSR question : try to look for SSR 10 A, zero crossing switching on eBay (price approx 3 - 5 USD). 10A is enough for any bulb, some problems could occur if you use a transformer for halogen lamps or energy saving LED / fluorescent "bulbs".
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #5 on: September 09, 2014, 04:30:43 pm »
That seems like a reasonable price.  I just figured that with a hall effect sensor, it should be fairly simple to make my own, as these store bought ones, I assumed, were just a Hall or Reed.

Why do you suggest a solid state relay, and do you know where to get them cheaply?

As you mentioned you are a beginner, my suggestion is to focus on a safety and do not use anything 120 V (American) or 230 V  (Europe) close to the doors. Especially if the door's frame is made from metal ... Create a safe circuit (powered by a double insulated adapter / transformer like 5 V / 9V / 12V) on the "switch" side and hide the SSR or other power relay into a double insulated case.


I was not intending on running 120AC to the wooden door.  I was going to run 5vDC to the door to trip a 5vDC relay next to the light switch, with only pins 87 and 30 connected to 120.

Nor am I using current to open the door.  I was just going to use current to trip the relay to the lights.  The rest, I thought, would be low current 5v or ground from the Hall sensor.


I will look into the diodes and mosfet.  I was under the impression that those transistors could supply the 100mA
 

Offline cybertronicify

  • Regular Contributor
  • *
  • Posts: 70
  • Country: us
  • Electrical Engineering Student
Re: Hall Effect to Trigger Light Switch
« Reply #6 on: September 10, 2014, 11:40:37 am »
Try to use a reed switch. Its just a glass tube/plastic with 2 contacts. When a magnet is close enough it will close and allow current to pass. Assuming the light bulb is not something ridiculous like 1000 watts, you should be fine with a simple reed switch.
 

Offline cybertronicify

  • Regular Contributor
  • *
  • Posts: 70
  • Country: us
  • Electrical Engineering Student
Re: Hall Effect to Trigger Light Switch
« Reply #7 on: September 10, 2014, 11:43:32 am »
If you are controlling an AC voltage. You can use a Triac instead of a relay, its just 2 scr's back-to-back. It can handle lots of current with minimal cooling, i mean lots of current. 600v 40amps. You can also make a variable one where it just cuts and changes the waveform of the AC. (good on resistive loads, NOT good on inductive loads.)

http://datasheet.octopart.com/BTA40-600B-STMicroelectronics-datasheet-8193631.pdf
« Last Edit: September 10, 2014, 11:46:00 am by cybertronicify »
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Hall Effect to Trigger Light Switch
« Reply #8 on: September 10, 2014, 12:53:21 pm »
Ceamiclover, just throwing it out there; but your original concept is perfectly valid. (All these other suggestions work fine too, but you wanted to use a hall effect sensor for learning purposes, so I think that should be encouraged rather than just ignoring your original idea and suggesting boring, easy solutions like a reed switches [which are the standard way to do this sort of thing, to be fair])

A normal (not solid-state) relay works fine, and it comes with safety and isolation built-in. And using transistors as a way to boost the weak signal from the hall effect sensor is totally the right thing to do. I suspect that you just didn't connect the transistors correctly. Can you provide a diagram of the circuit you tried?
 

Offline PepeK

  • Regular Contributor
  • *
  • Posts: 62
  • Country: sk
Re: Hall Effect to Trigger Light Switch
« Reply #9 on: September 10, 2014, 12:54:10 pm »
Try to use a reed switch. Its just a glass tube/plastic with 2 contacts. When a magnet is close enough it will close and allow current to pass. Assuming the light bulb is not something ridiculous like 1000 watts, you should be fine with a simple reed switch.

Any mains powered bulb has so high "starting" current (10x more than nominal) which will solder reed contacts together for eternity :-)
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #10 on: September 10, 2014, 01:54:47 pm »
Try to use a reed switch. Its just a glass tube/plastic with 2 contacts. When a magnet is close enough it will close and allow current to pass. Assuming the light bulb is not something ridiculous like 1000 watts, you should be fine with a simple reed switch.

Any mains powered bulb has so high "starting" current (10x more than nominal) which will solder reed contacts together for eternity :-)

The relay would transmit power from constant Hot to switch lead at light.  All the reed or hall would do would be to trip the relay.
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #11 on: September 10, 2014, 02:00:39 pm »
If you are controlling an AC voltage. You can use a Triac instead of a relay, its just 2 scr's back-to-back. It can handle lots of current with minimal cooling, i mean lots of current. 600v 40amps. You can also make a variable one where it just cuts and changes the waveform of the AC. (good on resistive loads, NOT good on inductive loads.)

http://datasheet.octopart.com/BTA40-600B-STMicroelectronics-datasheet-8193631.pdf

I am unfamiliar with inductive load problems.  Is the relay the limiting factor because it is an inductive load, or the light bulb?
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #12 on: September 10, 2014, 02:05:03 pm »
Ceamiclover, just throwing it out there; but your original concept is perfectly valid. (All these other suggestions work fine too, but you wanted to use a hall effect sensor for learning purposes, so I think that should be encouraged rather than just ignoring your original idea and suggesting boring, easy solutions like a reed switches [which are the standard way to do this sort of thing, to be fair])

A normal (not solid-state) relay works fine, and it comes with safety and isolation built-in. And using transistors as a way to boost the weak signal from the hall effect sensor is totally the right thing to do. I suspect that you just didn't connect the transistors correctly. Can you provide a diagram of the circuit you tried?

I haven't learned fritzing yet, so let me know if this diagram is useless.  Also, I am open to using a Reed switch if that is more appropriate.  I guess I am just trying to gain a functional knowledge of all of these and where they are best applied.
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #13 on: September 10, 2014, 05:25:10 pm »
Apparently, the Hall sensor can send enough current to trip the relay when the magnet pulls to ground.  I could use pins 87a and 30 to hold the light off.

This seems much less ideal, however, as it involves constantly powering the relay and defaulting to the light being on if the magnet fails to trip sensor.

I am unsure how sending the 10k ohms to 5v to the base of the transistor failed to step up the current available.  instead, the voltage at the emitter appears to drop with each transistor I added in line.  Adding the relay load pulls the voltage down from 5 to 2 at the output of the hall.

Sorry for not being particularly versed in the vocabulary.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Hall Effect to Trigger Light Switch
« Reply #14 on: September 11, 2014, 12:37:17 am »
OK, I think I see the (a) problem with the transistor circuit. You have your transistor on the high side -- if you have an NPN transistor, or an N-channel MOSFET, you want your switching to be low-side. That is, the emitter or source of the transistor is connected to ground, the collector or drain connected to one side of the relay coil, and the other side of the relay coil connected straight to the positive supply. Also, it'd be great if you could say which hall sensor part number, and which transistor part number, and which relay (or at least what the voltage of the relay coil is, and what resistance the coil is). This way we can be sure that the parts are suitable for each other.
 

Offline cybertronicify

  • Regular Contributor
  • *
  • Posts: 70
  • Country: us
  • Electrical Engineering Student
Re: Hall Effect to Trigger Light Switch
« Reply #15 on: September 11, 2014, 04:13:27 am »
The easiest way to complete this project is to use a reed switch in line with the mains. But like you said you don't want mains going into a wooden door, so you can use the reed switch in place of the Hall sensors as not all Hall effect sensors have enough current to drive the coils of the relay. you can solve that by pairing the Hall effect sensor with a triac, which on the BTA-400 only requires 50ma. From that you will learn about Hall sensors, silicon controlled rectifiers, and driving triacs. As a bonus you can use the triac as a dimmer too.
 

Offline cybertronicify

  • Regular Contributor
  • *
  • Posts: 70
  • Country: us
  • Electrical Engineering Student
Re: Hall Effect to Trigger Light Switch
« Reply #16 on: September 11, 2014, 04:25:51 am »
The lightbulb you are trying to
Power is a resistive load.

Resistive load means that when turned on. The current will rise instantly to a current value and stay.

An inductive load is when the device (I.e. motor, compressor) Pulls a peak amount of current for a couple of cycles then settles down to a "run" state.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Hall Effect to Trigger Light Switch
« Reply #17 on: September 11, 2014, 11:18:27 am »
The lightbulb you are trying to
Power is a resistive load.

Resistive load means that when turned on. The current will rise instantly to a current value and stay.

An inductive load is when the device (I.e. motor, compressor) Pulls a peak amount of current for a couple of cycles then settles down to a "run" state.

Not to be too pedantic, but this is grossly oversimplified to the point of being practically completely wrong.

Inductive loads have a current waveform that lags voltage. Ideal inductive loads (approximate real world example: transformers) do not draw current surges when turned on.

Motors are the most commonly encountered/discussed inductive load, and motors do indeed draw current surges when first turned on. This is because the motor is stopped when first turned on, so the initial current is the stall current, which is much higher than the steady state current once running. This is nothing to do with it being inductive.

Resistive loads have a current waveform that is in phase with voltage. As you say, ideal resistive loads (approximated by bar heaters and such) do not draw current surges when turned on.

Incandescent light bulbs are resistive, but they do draw a current surge when turned on because the filament is cold and therefore lower resistance when first turned on. I = V/R, more current.

My point is, whether the load is inductive, and whether it is surgey are completely orthogonal things, as illustrated by the four permutations shown above. I therefore think other people on this thread saying that light bulbs are bad news for reed relays are probably right. (Even ideal inductive loads are bad news for relays, because the inductor tends to cause huge voltages and arcing when the relay tries to turn off and interrupt the inductor's current, but that's a whole other story.)
« Last Edit: September 11, 2014, 11:20:13 am by rs20 »
 

Offline cybertronicify

  • Regular Contributor
  • *
  • Posts: 70
  • Country: us
  • Electrical Engineering Student
Re: Hall Effect to Trigger Light Switch
« Reply #18 on: September 11, 2014, 02:10:07 pm »
The lightbulb you are trying to
Power is a resistive load.

Resistive load means that when turned on. The current will rise instantly to a current value and stay.

An inductive load is when the device (I.e. motor, compressor) Pulls a peak amount of current for a couple of cycles then settles down to a "run" state.

Not to be too pedantic, but this is grossly oversimplified to the point of being practically completely wrong.

Inductive loads have a current waveform that lags voltage. Ideal inductive loads (approximate real world example: transformers) do not draw current surges when turned on.

Motors are the most commonly encountered/discussed inductive load, and motors do indeed draw current surges when first turned on. This is because the motor is stopped when first turned on, so the initial current is the stall current, which is much higher than the steady state current once running. This is nothing to do with it being inductive.

Resistive loads have a current waveform that is in phase with voltage. As you say, ideal resistive loads (approximated by bar heaters and such) do not draw current surges when turned on.

Incandescent light bulbs are resistive, but they do draw a current surge when turned on because the filament is cold and therefore lower resistance when first turned on. I = V/R, more current.

My point is, whether the load is inductive, and whether it is surgey are completely orthogonal things, as illustrated by the four permutations shown above. I therefore think other people on this thread saying that light bulbs are bad news for reed relays are probably right. (Even ideal inductive loads are bad news for relays, because the inductor tends to cause huge voltages and arcing when the relay tries to turn off and interrupt the inductor's current, but that's a whole other story.)

I'm quite sure the bulb he/she is trying to power is not a 5000w bulb. Its more like a 100w or 250w max. That will NOT cause a relay to arc over and weld the contacts, of course if he/she parallels like 10 of them up then thats a whole other story.

The current surge in a 100w light bulb when turn ON is pretty much nothing. Yes the resistance is lower when cool and gets higher when hot, but it is nothing like the "stall" current of a motor.

About the transformer, it actually pulls a lot of current when powered on. (at least for a few cycles) If the transformer is a toroidal type, then prepare for even more current drawn on startup. The reason is because the transformer has to build its magnetic field since it loses it when the primary coil is not energized.
« Last Edit: September 11, 2014, 02:15:51 pm by cybertronicify »
 

Offline WarSim

  • Frequent Contributor
  • **
  • Posts: 514
Re: Hall Effect to Trigger Light Switch
« Reply #19 on: September 11, 2014, 02:41:59 pm »

Try to use a reed switch. Its just a glass tube/plastic with 2 contacts. When a magnet is close enough it will close and allow current to pass. Assuming the light bulb is not something ridiculous like 1000 watts, you should be fine with a simple reed switch.

Any mains powered bulb has so high "starting" current (10x more than nominal) which will solder reed contacts together for eternity :-)
Reed relays are made in a vast range of sizes.  Largest I have personally seen was 5.6kv 30A.  Yes it was very expensive. 
Just saying your assumption is very practical but not imperially true.  :)


Sent from my iPad using Tapatalk
 

Offline cybertronicify

  • Regular Contributor
  • *
  • Posts: 70
  • Country: us
  • Electrical Engineering Student
Re: Hall Effect to Trigger Light Switch
« Reply #20 on: September 11, 2014, 02:51:56 pm »
woah 5.6kv 30 amps? thats a whopping 168,000 watts. What's it paired with? A 20 ton magnet?  :-DD
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #21 on: September 11, 2014, 03:07:11 pm »


My point is, whether the load is inductive, and whether it is surgey are completely orthogonal things, as illustrated by the four permutations shown above. I therefore think other people on this thread saying that light bulbs are bad news for reed relays are probably right. (Even ideal inductive loads are bad news for relays, because the inductor tends to cause huge voltages and arcing when the relay tries to turn off and interrupt the inductor's current, but that's a whole other story.)

Do I need to alleviate this concern with a quenching diode?


Also, I was intending on hooking up to the light switch with 16awg speaker wire.  I know that this is not NEC, but it seemed overkill to try and connect 14/2 to my PCB.  It will be about a 1 foot run, and I am driving a 60W bulb, or I could even drop it to a 13w CFL.

If there are any problems with this, I am open to hearing them.
 

Offline WarSim

  • Frequent Contributor
  • **
  • Posts: 514
Re: Hall Effect to Trigger Light Switch
« Reply #22 on: September 11, 2014, 03:31:33 pm »

woah 5.6kv 30 amps? thats a whopping 168,000 watts. What's it paired with? A 20 ton magnet?  :-DD
It was a TWT safety switch.  :).  No shortage of magnetism. 


Sent from my iPad using Tapatalk
 

Offline ceamicloverTopic starter

  • Contributor
  • Posts: 37
Re: Hall Effect to Trigger Light Switch
« Reply #23 on: September 11, 2014, 03:51:53 pm »
OK, I think I see the (a) problem with the transistor circuit. You have your transistor on the high side -- if you have an NPN transistor, or an N-channel MOSFET, you want your switching to be low-side. That is, the emitter or source of the transistor is connected to ground, the collector or drain connected to one side of the relay coil, and the other side of the relay coil connected straight to the positive supply. Also, it'd be great if you could say which hall sensor part number, and which transistor part number, and which relay (or at least what the voltage of the relay coil is, and what resistance the coil is). This way we can be sure that the parts are suitable for each other.

Hall 3144
Transistor 2n3904
5vDC relay SRD-05vdc-sl-c

That works perfectly.  Thank you for your help.  I come from automotive aftermarket, and we never do anything with transistors, so this is challenging.

Do I need a quenching diode to protect against the spike when the relay opens?
And do I just connect it between 85 and 86, or am I supposed to diode each leg in the appropriate direction?


With regard to other helpful suggestions:  I ordered some reed switches and will probably pick up some triacs, as they seem like a good solid state alternative to using relays for everything.
« Last Edit: September 11, 2014, 04:13:10 pm by ceamiclover »
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Hall Effect to Trigger Light Switch
« Reply #24 on: September 12, 2014, 02:13:20 am »
OK, I think I see the (a) problem with the transistor circuit. You have your transistor on the high side -- if you have an NPN transistor, or an N-channel MOSFET, you want your switching to be low-side. That is, the emitter or source of the transistor is connected to ground, the collector or drain connected to one side of the relay coil, and the other side of the relay coil connected straight to the positive supply. Also, it'd be great if you could say which hall sensor part number, and which transistor part number, and which relay (or at least what the voltage of the relay coil is, and what resistance the coil is). This way we can be sure that the parts are suitable for each other.

Hall 3144
Transistor 2n3904
5vDC relay SRD-05vdc-sl-c

That works perfectly.  Thank you for your help.  I come from automotive aftermarket, and we never do anything with transistors, so this is challenging.

Do I need a quenching diode to protect against the spike when the relay opens?
And do I just connect it between 85 and 86, or am I supposed to diode each leg in the appropriate direction?

You get spikes when opening circuits to an inductive load, because inductive loads "want" to maintain a constant current -- if you open a switch that's supplying that current, the inductor will spike with a huge voltage when its current is cut off suddenly. In the case of a relay, it's the coil that's inductive, not the switch side. So you may* want to connect a diode across the coil terminals "pointing away from the transistor".

* I don't know whether your relay coil has enough inductance for this to be an actual necessity -- other people might have nice general rules.

EDIT: Sorry, didn't read your earlier messages before. A diode doesn't help at all with the surge from an incandescent bulb turning on. It only helps with inductive loads, which a light bulb certainly is not. If you're using this relay, you don't need to worry because your relay is rated for 7A; a 100W light bulb only consumes 1A steady (0.5A in countries with a proper mains voltage :P) and nowhere near 7A surge. The only place you might need any attention is on the coil side, as I mention above.

Also, the relay requires 71.4 mA. This is fine for the 2n3904 to handle, but you do need to provide enough base current (which is controlled by your 10k resistor) for it to work well. From the datasheet, the current gain of the 2n3904 is only guaranteed to be at least 30 when collector current is upwards of 50 mA, so you want 71.4 mA / 30 = 2.38 mA base current. That means the resistor should be at most (5 - 0.7)V / 2.38 mA, so at most 1.8k (anything down to 1k is fine if you don't have a big selection to work with). You could use a N-channel mosfet instead of the transistor, in which case at 10k (or more) resistor would be fine, so your circuit would consume less standby power (for zero standby power, use a reed relay).
« Last Edit: September 12, 2014, 06:44:44 am by rs20 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf