Using a Hall Effect sensor to fade LEDs

Hi all, this is my first post here, so i'm real sorry if its in the wrong thread or anything. :slight_smile:

I was just wondering if anyone could help me with a little project idea i had. I'm trying to program an arduino to fade 10 LEDs on at the same time when i hover some magnets by a hall effect sensor. Like a touch-less button kinda thing.

Now i don't totally understand how hall effect sensors work, but from what i understand, a positive field from a magnet can turn it on, and a negative turn it off.

So what I'm asking is;

  1. Is what I'm trying to do possible?
  2. Could anyone give me a hand with the code?

Thanks all. :slight_smile:

  1. Is what I'm trying to do possible?

Yes

You need to find a hall effect sensor with a liner output. Then connect it up to the analogue input of the arduino.
test it by simply reading the value and printing it out. Then you will see the range you have to play with.
Next wire up one LED and a resistor to one of the PWM ports and using an analogWrite() function write various values to it to see the LED change.
Finally link the two up with the map function and put it in the endless void loop() function.

For 10 LEDs repeat with other output pins or drive the higher load with a transistor. Each LED must have it's own current limiting resistor.

Good Luck

That's a great help thanks. I'll have to give that a shot. The sensor i've got is this one here

I've just read over the datasheet and it does support linear output.

That sensor looks fine. As it has an open collector you will need a 10K pull up resistor (to +5V) on the output as well as connecting it to the arduino input.