Hall effect sensor only giving half of input voltage

the hall effect sensor I am using(MLX90364) is only giving me 2.5 volts when I supply it with 5 from my Arduino. It gives this output when the magnet is or isn't nearby. I am using a N35 magnet, and have created a holder that holds it exactly how far it needs to be(3.5mm), and perfectly aligned.

Here is the circuit diagram:

Here is a picture(I used 2 5kOhm resistors in series to get 10k):

Here is the code:

int analogPin = A2; // potentiometer wiper (middle terminal) connected to analog pin 3
                    // outside leads to ground and +5V
int val = 0;  // variable to store the value read

void setup() {
  Serial.begin(9600 );           //  setup serial

void loop() {
  val = analogRead(analogPin);  // read the input pin
         // debug value

Here is the data sheet: Error - Melexis

I would really appreciate any help as I have been experimenting with different wirings for days and have not gotten any output except the 2.5 volts

Not familiar with the Melexis part however the first thing I would verify is if the A/D input is working? Could try a 1.5 V battery to verify.

Also triple check your pinout is correct. Don't just look again. I've found if I make a wiring error each time I check it I'm sure its correct. I have to do something different to catch my mistake.

Perhaps print out the pinout from the data sheet and hold it next to your circuit.

here’s your photo…

And here’s the data sheet…

Here your second image…. much clearer.

As you move on, please try to provide as much info as possible in the post, because many users are unlikely to chase down links or poorly posted content.

Thanks for using code tags !
Now, to your question…
Do you have the chip configured for ratiometric (analog) output, or PWM ? That will muck things up a bit !

Your ‘circuit’ isn’t clear, is that using LEGO or some other assembly ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.