Hi everyone,
I am developing an installation that requires LEDs to be turned on when they are sufficiently away from the Arduino.
In order to do so, I cannot connect the LEDs directly to the board (need them to be wireless), but having them connected via WiFi/Bluetooth would be too expensive.
The solution that came into my mind is to use relays, driven by a magnetic field:
when the LEDs are close enough to the magnetic field (e.g. generated by a magnet) the relay would open the circuit, turning the LED off.
When the LEDs are far away from the magnet, the relay would close the circuit and turn the LEDs on.
My questions are:
Is this physically possible?
If so, can someone post a link where I could buy the relays?
I hope my words make sense.
Thank you so much in advance for your time and help.
You might want to look up Hall Effect sensors and switches. They come in different configurations. The sensor will give you field strength along 1 axis of the chip. The switch is used for security work usually on windows and doors. They are cheap and the only moving parts are electrons.
With the reed switches I got a bit lost: I don't undertand if I can use them for turn the LEDs on when not affected by the magnetic field.
On the other side, the hall switches seem to be easier to use.
The magnet can be a small one (let's say a 0.25x0.25x0.25 inches).
As long as the toggle happens when the hall switch is 1.5-4 inches away from the magnet the job is done.
noidsign:
With the reed switches I got a bit lost: I don't undertand if I can use them for turn the LEDs on when not affected by the magnetic field.
You can. It's a switch; it can be used to switch things on. If necessary you can use a transistor to invert the signal or increase the current capability, but a standard small LED could probably be driven directly.
The range would be determined by how strong the magnet was (and how sensitive the switch was), but a neodymium magnet that size would be pretty strong.
If the Arduino is a necessary part and you can spare a pin then connect your switch to a pin you will use as digital INPUT HIGH (HIGH to activate the built-in pullup) and the other side of the switch, connect to ground. Then use the LOW or HIGH of that pin to tell when to light the led.
The switch can be either. I asked about magnet strength because the reed switch has to be moved to change state. Hall switches can detect small fields, there are security Hall switches that will switch on refrigerator magnets. I'd go with the linear Hall just because I could then set the distance by analog input value. Heck, you could make the led go from dim to bright just by distance away from the magnet.
I'd go with the linear Hall just because I could then set the distance by analog input value. Heck, you could make the led go from dim to bright just by distance away from the magnet.
That sounds pretty cool, but... the all thing about using halls/reeds is because the LEDs cannot be wired to the Arduino (meaning they are "wire-less"), and if I am not wrong both halls/reeds are on/off switches.
Or there would be a way to dim the light according to the distance to the magnet (without the LEDs being wired to the Arduino)?
Linear Hall sensor is analog, it lets more current through with stronger field strength.
Without the Arduino you might use a transistor, a resistor or 2 and power with led and Hall sensor.
OTOH a circuit of power --> resistor --> led --> ground that lights the led could have a Hall sensor added:
power --> resistor --> X --> led --> ground, and from X --> Hall device --> ground
Then as the Hall detects strengthening field (closer to magnet or coil) it bleeds more current to ground and the led dims until it is off. Or if a reed or Hall switch; click, led turns off.
There are Hall switches and you do have to be sure -which- Hall effect device you buy because there are different packages. The switches are usually called security switches but at Mouser I see terms like 'bipolar' and 'omnipolar' with 'latch' for the switch types and 'linear' for the analog sensing types. They just wrap the effect with parts to suit different applications.
noidsign:
the LEDs cannot be wired to the Arduino (meaning they are "wire-less")
Obviously you will need some power supply and control circuit wired to the LEDs. Any restrictions (size? cost?) on what those consist of?
The logic of a typical reed switch is the reverse of what you want, but you'd only need a transistor to invert it. So your remote unit would consist of LED, battery, reed switch, transistor and a couple of resistors. It's hard to see how you'd get a smaller or cheaper solution than that. It's not especially flexible though - it would only give you on-off control, and the only way to control the range would be to vary the strength of the magnet.
I managed to achieve the goal with a reed and a transistor!
For future reference here I attach the Frizing and a short demo video.
Happy holidays to everyone!