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.
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.
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.
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?
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.
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?