Program Linker Hall Sensor on PcDuino With Python




Linker Hall Sensor Module is a Hall sensor.

A Hall effect sensor is a transducer that varies its output voltage in response to a magnetic field. Hall effect sensors are used for proximity switching, positioning, speed detection, and current sensing applications.

In its simplest form, the sensor operates as an analog transducer, directly returning a voltage. With a known magnetic field, its distance from the Hall plate can be determined. Using groups of sensors, the relative position of the magnet can be deduced.

Electricity carried through a conductor will produce a magnetic field that varies with current, and a Hall sensor can be used to measure the current without interrupting the circuit. Typically, the sensor is integrated with a wound core or permanent magnet that surrounds the conductor to be measured.

Frequently, a Hall sensor is combined with circuitry that allows the device to act in a digital (on/off) mode, and may be called aswitch in this configuration. Commonly seen in industrial applications such as the pictured pneumatic cylinder, they are also used in consumer equipment; for example some computer printers use them to detect missing paper and open covers. When high reliability is required, they are used in keyboards.

When no magnet near the Linker Hall Senso , the RX side will continue to output a high level (logic 1), if the magnet near it, the RX terminal will output a low level (logic 0) .So we can use pcDuino GPIO read the RX level to determine whether there is a magnet near the Hall Sensor, the following is a magnetic switch routine.

Step 1: Part List

1. pcDuino V2 x1

2. Linker Hall Sensor x1

3. Linker LED x1

4. Linker Base x1

5. Linker cable x2

6. Magnet x1

Step 2: Wiring Diagram

Step 3: Test Code

import gpio

from time import sleep

led_pin = "gpio2" sensor_pin = "gpio4"

def delay(ms):


def setup():

gpio.pinMode(led_pin, gpio.OUTPUT)

gpio.pinMode(sensor_pin, gpio.INPUT)

print " Linker LED Pin : D2 \n Hall Sensor Pin : D4" def loop():



gpio.digitalWrite(led_pin, gpio.HIGH)

else :

gpio.digitalWrite(led_pin, gpio.LOW) setup() loop()

Step 4: Test Result

(1) Place Magnet far from Hall Sensor, RX outputs high level, the Linker LED is on:

2. A magnet near Hall Sensor, RX output low level, the red LED lights on Hall Sensor is on,Linker LED is off:

Following my twitter @pcDuino_NO1



    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure