I am using four 3144 Hall effect sensors and put them in a simple circuit with outputs at A1, A2, A3 and A4. The grounds of these sensors go to GND and the Voltage Inputs go to 5V. I am printing the output at half a second intervals. But I am getting a strange result. Without any magnet around the results are floating between 0 to 1023.
17:47:12.556 -> 1023, 1023, 1023, 1023
17:47:13.071 -> Current Pin values are
17:47:13.071 -> 1023, 1023, 1023, 1023
17:47:13.587 -> Current Pin values are
17:47:13.587 -> 627, 227, 200, 397
17:47:14.057 -> Current Pin values are
17:47:14.057 -> 100, 0, 0, 120
17:47:14.568 -> Current Pin values are
17:47:14.568 -> 25, 0, 0, 40
17:47:15.083 -> Current Pin values are
17:47:15.083 -> 0, 0, 0, 12
17:47:15.552 -> Current Pin values are
17:47:15.552 -> 0, 0, 0, 0
17:47:16.070 -> Current Pin values are
17:47:16.070 -> 6, 37, 57, 77
17:47:16.579 -> Current Pin values are
17:47:16.579 -> 423, 686, 665, 512
17:47:17.077 -> Current Pin values are
17:47:17.077 -> 865, 1023, 1023, 877
17:47:17.593 -> Current Pin values are
17:47:17.593 -> 1012, 1023, 1023, 1023
17:47:18.065 -> Current Pin values are
17:47:18.065 -> 1023, 1023, 1023, 1023
17:47:18.587 -> Current Pin values are
17:47:18.587 -> 826, 527, 471, 569
17:47:19.102 -> Current Pin values are
17:47:19.102 -> 143, 0, 0, 174
17:47:19.564 -> Current Pin values are
17:47:19.564 -> 35, 0, 0, 51
However if I put a South pole on any one of their faces, the value becomes a 1 or 2 . In this example below I have put the magnet on the face of the sensor at A1 for two seconds and released it. The value was shown as 2 over that period of time.
17:27:07.678 -> 1023, 1023, 1023, 1013
17:27:08.193 -> Current Pin values are
17:27:08.193 -> 325, 0, 0, 1013
17:27:08.668 -> Current Pin values are
17:27:08.668 -> 2, 0, 0, 1017
17:27:09.180 -> Current Pin values are
17:27:09.180 -> 2, 0, 0, 1010
17:27:09.682 -> Current Pin values are
17:27:09.682 -> 2, 0, 0, 1013
17:27:10.197 -> Current Pin values are
17:27:10.197 -> 2, 340, 529, 1013
17:27:10.666 -> Current Pin values are
17:27:10.666 -> 2, 668, 1005, 1016
17:27:11.176 -> Current Pin values are
17:27:11.176 -> 2, 666, 994, 1011
17:27:11.691 -> Current Pin values are
17:27:11.691 -> 1023, 1023, 1023, 1012
Where I am going wrong? Or isn't 3144 not the right sensor? But I have seen examples that people are using it. One interesting point to note that, I havent used any resistor with it and directly used the sensor as it is, (in TO-92 packaging) as the datasheet tells me I can use it that way.
If you want to look at my simple code, here it. (Many thanks for helping this greenhorn)
const int Pin1 = A1;
const int Pin2 = A2;
const int Pin3 = A3;
const int Pin4 = A4;
int Pin1Status = 0;
int Pin2Status = 0;
int Pin3Status = 0;
int Pin4Status = 0;
void setup() {
Serial.begin(115200);
Serial.print("\nStart of Program\n");
pinMode(Pin1,INPUT);
pinMode(Pin2,INPUT);
pinMode(Pin3,INPUT);
pinMode(Pin4,INPUT);
delay(3000);
}
void loop() {
Serial.print("\nCurrent Pin values are ");
Pin1Status = analogRead(Pin1);
Serial.print("\n");
Serial.print(Pin1Status);
Serial.print(", ");
Pin2Status = analogRead(Pin2);
Serial.print(Pin2Status);
Pin3Status = analogRead(Pin3);
Serial.print(", ");
Serial.print(Pin3Status);
Pin4Status = analogRead(Pin4);
Serial.print(", ");
Serial.print(Pin4Status);
delay(500);
}