Solution for detecting a magnetic field

Hello all. Thanks for taking up your time to read my post.

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 for HMR3400 as the datasheet of . 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.

Can anyone help me ? I am very puzzled about this question. I do need your help.

thanks in advance.

Using a reed switch might be easier, since that acts as a button, is hardware based, and thus requires no code to be running to check for the field. Worthwhile looking into.

The HMR3400 is really overkill if your goal is to detect the presence of a magnet. You can much more simply use either a reed switch as @Moors7 suggested, or a Hall effect switch like the Allegro MicroSystems A3212.


thanks for your answers. I would like to listen to others’ ideas. Do you have better ideas ? thanks in advance

What do you mean by “better”. What need is not met by the above ideas? If you think you need better ideas, it would be helpful to be more specific about exactly what you’re trying to do. For instance, do you have limitations on the size of the magnet, or the distance between it and the sensor?


@maryzhu, a cheap(er) hall effect sensor should work just fine:


thanks for your heated discussions. I think your answers would be useful to me. thanks a lot.