Linear Hall Sensor MLX90251

Greeting all,

I just got a couple of these sensors and for the life of me I cannot figure out why the output voltage will not change.

The actual model I have is the MLX90251EVA-3-TU

I tried wiring it up as indicated on page 15 (section 12.1) of the datasheet. With the pullup it'd always read 5v, with the pulldown it'd always read 0v.

Then I tried just hooking 5v to pin 1, grounded pins 2 and 3 and pin 4 to analog input on arduino, and it always shows 2.5v.

I've tried using a refrigerator magnet and a rare earth magnet, so the gamut from weak to strong and nothing is changing. I'm pretty new to this, but I've managed to get a bunch of other sensors working (SCP1000, HMC6352, HIH-3030, etc) but this one is throwing me a curve.

Any help is appreciated.

Cheers!

This is a link to the aforementioned datasheet

http://www.melexis.com/Assets/MLX90251_Rev009_Datasheet_4765.aspx

Picture of wiring
Post your code.

Picture of wiring
Post your code.

I can do that when I get home. One of their (Melexis) other documents mentions that if there is no magnetic flux detected it'll output 2.5v which is what I'm reading.

So, I'm wondering if the sensor I bought just doesn't work for small magnets, whether or not they are ceramic or rare earth.

What I was hoping to accomplish was using two of these to locate a magnet within a X/Y plane, the magnet I had intended using with it was one of those 0.25" cube neodymium magnets, if anyone has experience with alternative sensors in an application similar to this, I'd appreciate their input as well.

Cheers.

As promised, here is a link to a photo of how I have it wired at the moment: http://www.nicknoltewx.com/img/photo.JPG

Here is the code I'm using, nothing fancy:

int hallPin = A0;
unsigned long lastOut = millis();

void setup() {
  // put your setup code here, to run once:
    Serial.begin(9600);
    delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly: 
  if ((millis() - lastOut) > 100) {
    int hallRead = analogRead(hallPin);
    Serial.print(millis());
    Serial.print("-");
    Serial.println(hallRead);
    lastOut = millis();
  }
}

It's always outputting 537 or 538 whether or not there is a magnet in the vicinity.

int hallPin = A0;

One of the all-time dumbest things that the Arduino team came up with is these stupid aliases that they misused in a lot of tutorials.

The A0 alias is the value to use when using an analog pin as a digital pin.

That is NOT what you are doing. You're not even using analog pin 0.

Try setting hallPin to 1.

Yes, it is connected to A0. Perhaps the angle of my photo misrepresents that, but it is in the rightmost pin of the analog set.

Also, changing hallPin to 0 gave me the same result as before.

I've also used the alias (A0) for a couple of other analog sensors with the analogRead function with no issue, perhaps this is something resolved in the later releases?

From WProgram.h from Arduino 0021:

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
const static uint8_t A0 = 54;
const static uint8_t A1 = 55;
const static uint8_t A2 = 56;
const static uint8_t A3 = 57;
const static uint8_t A4 = 58;
const static uint8_t A5 = 59;
const static uint8_t A6 = 60;
const static uint8_t A7 = 61;
const static uint8_t A8 = 62;
const static uint8_t A9 = 63;
const static uint8_t A10 = 64;
const static uint8_t A11 = 65;
const static uint8_t A12 = 66;
const static uint8_t A13 = 67;
const static uint8_t A14 = 68;
const static uint8_t A15 = 69;
#else
const static uint8_t [glow]A0 = 14[/glow];
const static uint8_t A1 = 15;
const static uint8_t A2 = 16;
const static uint8_t A3 = 17;
const static uint8_t A4 = 18;
const static uint8_t A5 = 19;
const static uint8_t A6 = 20;
const static uint8_t A7 = 21;
#endif

The only other thing I can suggest is that the hall-effect sensor is in the breadboard backwards. It isn't all that clear from the picture OR the crappy illustration in the data sheet which is the chopped off corner.

Thanks for your input.

The diagrams in section 12.1 seem to indicate the pin directly under the notch is pin 1 (Vdd), which is how it's connected, currently.

I'm also led to believe that I have it wired correctly as in section 10.1 it tells that the default Output Voltage with no magnetic flux applied is approx 50% Vdd, which is the 2.5v I'm getting.

The only thing I can think of is I'm either using a magnet of inappropriate strength or size for this sensor. The maximum ratings in section 4 indicate that the highest magnetic flux it can handle is infinity, so I don't think a too strong of a magnet would ruin the sensor, but that could be what has happened.

In light of that, if no one has any other ideas, could someone suggest a different sensor I could pick up that does what I wish to accomplish, as stated in my third post on this thread?

Thanks!