I'm using a hall effect sensor A1356 (linear application) to measure the amount of fluid in a container. The fluid is in constant use. My doubt is I'm placing the sensor and the magnet assembly in place, such that when it is exactly half filled, the magnet's center will align with the center of the sensor. In this condition I get 100% duty cycle output from the sensor.

Condition 1: If the fluid is filled then the magnet moves above the sensor and the duty cycle reduces say to 90%.

Condition 2: If the fluid is consumed then the magnet will move below the sensor and the duty cycle reduces to say 90%.

How do I differentiate between the rise and fall of the fluid? Or is there a better way of orienting the magnet and the sensor such that this problem could be avoided?

I'm interfacing it with an Arduino UNO

  • 1
    Two sensors? If the lower one activates then the level is low (and if it deactivates it is lower still). If the higher one activates then the level is high (and if it deactivates it is higher still). If both activate then the level is about right.
    – Nick Gammon
    Commented Feb 25, 2016 at 5:18
  • its is a one way of doing it but i am supposed to use only one sensor to reduce the cost
    – CjZ
    Commented Feb 25, 2016 at 6:35
  • Do you have a bipolar or unipolar device? If it's bipolar, and you position both the sensor and magnet correctly, you can see if it's above or below.
    – Gerben
    Commented Feb 25, 2016 at 10:52

1 Answer 1


According to the data sheet (see below) the no-field PWM output is mid-range; north poles reduce it & south increase.

So if you had an arrangement whereby the float had north down & south up, ie a vertical bar-magnet, this would presumably give a rise-before-0 or fall-before-0 at the float vanishes, or a fall-to-minimum an rise-to-maximum as the float centres? The bit in the middle could be interesting!

From the datasheet: "The presence of a south polarity magnetic field, perpendicular to the branded surface of the package face, increases the output duty cycle from its quiescent value toward the maximum duty cycle limit. The amount of the output duty cycle increase is proportional to the magnitude of the magnetic field applied. Conversely, the application of a north polarity field decreases the output duty cycle from its quiescent value."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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