Magnet Sensor

This project has been developed in association with Lancaster University, England.

The objectives of this project are as follows:

  1. Detection                                                                                                                                                                                    The magnet sensors are used to detect whether a magnet is present or not. This can be achieved by letting a led light or even a small mono sound when the magnetic presence is detected.
  2. Left/Right Movement                                                                                                                                                             The magnet sensors should be used to detect whether a magnet was moved from left to right or vise versa. A phone application can then be used to show an arrow to represent this movement.
  3. Compass                                                                                                                                                                                    An improved motion detection based on objective 2.                                                                         

To this, sensors of type Hall Effect Sensors are used. There are 9 of these sensors on the Magnet Sensor board, which are aligned on a 3x3 grid numbering from 1 to 9.


The output from the magnet sensors are directed to the Opensensor Board via a connector cable, so sensor 1 (s1) is connected to RB0 (pin on the sensor board) and s2 to RB1 and so on.

The application on the Opensensor Board samples those 9 input pin every 200ms each and outputs the following values:





East (right) movement


North east movement


North movement


North west movement


West (left) movement


South west movement


South movement


South east movement








Each output value is terminated with newline \n. The two interfaces of the Opensensor board, Bluetooth and the RS232, can be used to view the output.





Department of Electronic Systems | Aalborg University | Niels Jernes Vej 12 | DK-9220 Aalborg | Denmark
Phone: (+45) 9635 8695 | Fax (+45) 9815 1583 | E-mail ies(at)
Copyright © 2006 Department of Electronic Systems

Last update:18-03-2009