Magnetic Switches?

Hi, I am new to Arduino and barely knew what a mirco controller was until recently. How could I create a micro controller, micro chip, etc. that has a magnetic switch and turns on (and leaves on) a light that passes through the magnet.

What it looks like: (Haven't made it, just describing it)

Magnetic ring
When light+Micro Controller or whatever, and batteries pass through magnetic ring, it turns on and stays on. How would I program a micro controller or whatever to do this?

Anything would help, cheers!

Try this, Google search term, "reed switch", "Hall Effect Sensor".

this should get you started. Come back if you have any questions.

I looked up both of them and a Reed Switch sounds close to what I am trying to accomplish however, I read that it turns off as it passes through the magnetic field. Is there a way to keep it on until the power source is drained?

use the timer function in the Arduino. or use a current/voltage sensor.

Freeze1234:
I looked up both of them and a Reed Switch sounds close to what I am trying to accomplish however, I read that it turns off as it passes through the magnetic field. Is there a way to keep it on until the power source is drained?

Yes the switch turns off but you make the code in the Arduino turn on the light when the switch turns on, and do nothing when the switch turns off.

Thank you both!

Now, how do I program that? You don't have to respond if that is too nooby of a question.

Hi Freeze1234,

As for being a Noob, everybody has to start somewhere.

I would suggest you put the magnet switch on hold and learn how to blink the LED on the Arduino. That seemingly simple task you will find encompasses a lot of tasks.

  • Setting up the Arduino IDE
  • Looking at the sample code to blink the LED
  • Setting up the Arduino inputs and outputs
  • Downloading the code / programming the Arduino.
  • Perhaps make small changes to the blink LED program to double blink then delay etc.

The above may sound trivial but I assure you it very worthwhile.

Good luck

Now, how do I program that?

The state change detection example in the IDE examples (File, Examples, Digital) shows how detect when the switch becomes pressed and becomes released (as opposed to is pressed or released). The traansititions are detected not the levels. So you can see when the reed switch closes and light the light, but ignore when the switch is released so the light stays on.

Thanks again! I will start with the blinking switch and trust me, I have no idea how to do that yet so you are correct, it will help tremendously!

Thanks to all!