I have an Arduino based circuit that performs a mechanical job and I'd like the circuit to turn on when it detects a magnetic field. I want to use a magnet as a trigger for the circuit. When a magnet is attached to something like say a stick and put near the circuit board I'd like it to detect the magnetic field and turn on.

I have learnt that an operational amplifier can be used for this purpose but need guidance on how to do it as I am a novice in embedded systems & electronics.


One way or another, you need some kind of transducer that can make a electrical signal that is a function of magnetic field strength. No, a opamp can't do this. A opamp may be useful in tranforming the raw signal from such a transducer into something the microcontroller can read, but by itself a opamp is not a magnetic sensor.

Two possibilities come to mind:

  1. Reed switch. These are the bare switch parts of a relay, usually enclosed in a small glass envelope. The right magnetic field causes the switch to close. This will be the simplest solution if you have a strong enough magnetic field. This usually means a reasonable permanent magnet can be placed with a half inch or so of the reed switch.

  2. Hall effect sensor. The underlying physics of these sensors creates a small electrical signal proportional to the magnetic field in a particular direction. However, you rarely get bare Hall sensors directly. Usually they are integrated into a single package with something that either makes a reasonable size voltage proportional to magnetic field strength, or provides a digital output, usually with some hysteresis, to indicate presence or abscence of some level of magnetic field. Allegro is a supplier that makes a lot of these things with various options.

  • \$\begingroup\$ The supplier Olin mentioned is Allegro. (allegromicro.com) Another sensor manufacturer that I have used in the past is Melexis. (melexis.com) \$\endgroup\$ – Michael Karas May 28 '13 at 15:11
  • \$\begingroup\$ Note that if you use a reed switch, you can build a device that requires no standby power. On the other hand, a Hall-effect sensor needs to be powered all the time. \$\endgroup\$ – Dave Tweed May 28 '13 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.