I wired it up with a 10K pull up resistor connected between Vin and the output from the sensor..
However, placing a magnet near the sensor has no effect what soever.
I bought two of these sensors and they both behave the same way.. is it possible that they are both broken? or am I doing something wrong?
Hi,
Perhaps you could let us see a schematic or you code! I have used similar Allegro chips with no problems at all, but they were an analogue version! Were the South pole of a magnet gave a swing to below 1/2 VCC and a North to above 1/2 VCC, varing with distance.
The ones you're using are in effect digital switches? and should be easy to check with a digitalRead of the pin it's connected to.
These devices are hall switches, unipolar, so they need the magnet the right way
round to operate. Check with a multimeter that the device is getting its
supply voltage across pins 1 & 2 with the correct polarity, ensure it has 0.1uF
decoupling capacitor on the supply close to the device, and try again.
Decoupling capacitors are never optional with digital logic chips like this one.
This is my code: I'm using the arduino digitalRead example :
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// make the pushbutton's pin an input:
pinMode(pushButton, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int buttonState = digitalRead(pushButton);
// print out the state of the button:
Serial.println(buttonState);
delay(1); // delay in between reads for stability
}
How should I connect the decoupling capacitor?.. and what does it do?
My circuit looks like this , without the capacitors.
Basically, I "Supply" is connected to the 5V out from the arduino, Ground is connected to ground and "output" is connected to digital pin 2.
There's a 10k resistor between Vin and output. That's the pullup. Those are the only components in the circuit.
(I must admit, I'm not sure which pin is Vin and which is the ouput, because the datasheet doesn't allow me to identify which side of the device I'm looking at but I tried both polarities... it still didnt' work)
Hi,
If you take a look at the datasheet! It says the pinout is shown from the branded side of the device, that it the side with the device number/code etc.
By the way I have just won 10 of these on eBay for 99p!! (http://www.ebay.co.uk/itm/191211951807) So I too will be playing with them soon, perhaps speed control on my buggy-bot? it’s not easy to get a buggy to turn a proper 90 degs, (I have thought about using some thing like the HMC5833?) as the battery power goes down the motors turn slower, so about 90 degs, becomes 70, etc…
Hi mahela007,
Mine will take a time to come from China, so I hope you get an answer by then, but soon as I do a test, I'll let you know the result. I have some small rare earth magnets. which I hope will do the trick!!
But I'm sure someone else on this forum must have used them also! Let's hear from you.
Hi, have you measured the voltages on the pins of the device.
Voltage, Vcc to Gnd
Voltage Vout to Gnd, with and without the magnet in place, (check twice with magnet, once with each pole.)
Do this without arduino input connected but 10K used, then try a 1K., use DMM.
Hi mahela007,
today I received my 10 x A3144 Allegro hall-effect sensors and within 5-10 minutes I had a bit of simple code running and reading these.
But they are only sensitive on the branded side (with the writing on) and to only one magnetic pole (don’t ask which?) so if the magnet don’t work one way try it the other. I did use a 10K pullup as the output is open. The output is HIGH for no magnet or one pole? and LOW for the other pole.
The Allegro A110X series, which I have used before switches HIGH or LOW depending on the magnetic pole as follows: Magnetic flux density, B, is indicated as a negative value for north-polarity magnetic fields, and as a positive value for south-polarity magnetic fields. This so-called algebraic convention supports arithmetic comparison of north and south polarity values, where the relative strength of the field is indicated (That’s Allegro not me)…
My small RE magnet triggered the device at about 12-15mm distance.
No point in showing you the schematic, it’s so simple, I did’ent even use a 0.1uF cap, the code’s very simple but here it is!!
Regards
Mel.
// MAS 23/08/2014
// Pin 13 has a on-board LED.
int led = 13,in1=3,A;
void setup()
{
pinMode(led, OUTPUT);
digitalWrite(led,LOW);
Serial.begin(9600);
}
void loop()
{
A=digitalRead(in1);
Serial.println(A);
if(A==1)
{
digitalWrite(led,HIGH);
delay(200);
}
else
{digitalWrite(led,LOW);
delay(200);
}
}