hall sensor output problem

I bought a hall sensor for arduino on ebay, this one: http://www.ebay.com/itm/370720689488?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

& the ad was saying that i can connect it right to arduino but sensor only puts out 2V & it triggers interrupts erratically. is there a way to fix it? or somehow amplify signaling voltage?

i tried to configure interrupt leg as output with pullup:

pinMode(2, OUTPUT);
digitalWrite(2,HIGH);

& trigger the interrupts on falling edge but it didnt work either.

There is a potentiometer that the link states can be used to adjust sensitivity. There is the Hall Sensor itself, but what's that IC (can't tell from the picture)? There isn't a clear shot of the silkscreen/labels, I assume they're Gnd, +V and Signal. What are the results of connecting the "sensor" to Arduino +5 and Gnd and with a voltmeter to Signal(output) and Ground?

partially solved the problem by setting input like this:

pinMode(2, INPUT_PULLUP);

now it seems to be counting pulses fine while rotor is running, i cant check it but the number seems to match with a tachometer.
however when rotor stops in “ON” position(voltmeter connected to output of the sensor shows 2.2V) it starts to call interrupt every so often.
i set up debouncer inside the interrupt to a minimum of 400 micros between & it fixed it. but its too high for the application. my pulses can be somewhere 150-200micros apart.

Hard to say without a schematic of at least the output portion of the module. I've made it a practice for some time now to not buy Asian sensor modules unless the ad or has a link provided showing a schematic drawing of the module.

Lefty

I connected scope to my output leg of the sensor & found a lot of interference. so i filtered it all with different values ceramic capacitors. now when i have pure 2.119V from sensor arduino calls interrupt like crazy.like 50000 times per 2 second cycle. & it seems to happend only when my motors unplugged. when i plug them back in I'm getting good readings.

however if it stops with negative output (around 0.035V) I'm getting zeros like i suppose to.

is it some kind of internal arduino interference? but then why it is only happends when i have 2 volts on interrupt leg?

I just noticed it also started to give me higher interrupt count after i filtered the interference & got close to square wave signal. How is this possible? I was expecting lower number due to less bounces.

I don’t know why you see interference. Maybe to be sure that the output is set up properly you could use an external pull-up of about 4.7K. In my messing around, my device was very insensitive to both the resistor value and the capacitor value. Resistors I used ranged from 1K to 22K and capacitors from 0.001 to 0.1 uFad with no significant impact on performance.

In your program, are you looking for a high signal from the Hall Effect sensor or a transition? In your original post you imply that you’ve looked for both falling edges and something else. I only have experience with one device (an obsolete part I bought on eBay) but when the magnet is nearby, the output stays high. As Lefty said, it’s hard to tell what your circuit is doing. I just use the Hall Effect senor by itself. My program is designed for relatively low RPMs (600 or so) and uses an LCD for the output. I’m still improving it but the counting has been reliable and repeatable. For my applications, the Hall Effect sensor is hand held. To give feedback to the operator, I flash an LED on pin 11 to show that the sensor is being pulsed.

What Hall Effect sensor is on your board? Have you considered desoldering it and using it directly?

//This one can take a long time to read rpm for slower turning items.
//maybe need more than one scale

/* LCD Connections
 * LCD RS pin to digital pin 8
 * LCD Enable pin to digital pin 9
 * LCD D4 pin to digital pin 4
 * LCD D5 pin to digital pin 5
 * LCD D6 pin to digital pin 6
 * LCD D7 pin to digital pin 7
 * LCD R/W pin to ground

Hall Effect output goes to digital pin 2
Digital pin 11 is for the status indicator (Blue LED)
 */
#include <LiquidCrystal.h>
#include <TimerOne.h>
 

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);            //create lcd as a LiquidCrystal
volatile byte rpmcount;                         //variable for Hall Effect sensor count
float rpm;                                      //variable for calculated rpm
float timeold;                                  //variable for start time of measurement
int samples=100;                                //initially, require 100 Hall Effect counts for rpm calculation

byte  pin =11;                                  //digital pin 11 used for status indicator
float intermediate;

//variables for switch debouncing
long debounceDelay = 150;                         // switch debounce time 

const int buttonPinD = 12;                          //push button attached to this pin
int buttonStateD = LOW;                             //this variable tracks the state of the button
int stateD = -1;                                   //this variable tracks the state of the LED, negative if off, positive if on
long lastDebounceTimeD = 0;                         // the last time the output pin was toggled

const int buttonPinU = 13;                         //push button attached to this pin
int buttonStateU = LOW;                            //this variable tracks the state of the button
int stateU = -1;                                //this variable tracks the state of the LED, negative if off, positive if on
long lastDebounceTimeU = 0;                        // the last time the output pin was toggled

void rpm_fun()                                      //get here when Hall Effect sensor is triggered
 {    rpmcount++;                                   //Update Hall Effect count
      digitalWrite(pin, !digitalRead(pin));         //change blue LED state
      if(rpmcount>= samples)                        //if the Hall Effect sensor has been triggered enough times
      {  intermediate = float(rpmcount);            //
        rpm = (60000*intermediate)/(millis() - timeold); //determine rpm
         rpmcount =0;                               //reset Hall Effect count
         timeold=millis();                          //reset the measurement time
         lcd.clear();                               //clear the LCD display
         lcd.setCursor(0,0);                        //set cursor to first character/first line
         lcd.print("RPM =             ");
         lcd.setCursor(7,0);                        //set cursor for rpm output
         lcd.print(rpm);        

         lcd.setCursor(0,1);                        //set cursor at first character of second line
         lcd.print("Samples=");                 
         lcd.print(samples);                    
      }  
 }

void setup()
 {   // Serial.begin(9600);                        //used for diagnostic purposes
      attachInterrupt(0, rpm_fun, FALLING);        //the interrupt is triggered by a falling edge from
                                                   //the Hall effect sensor
      lcd.begin(16, 2);                            // set up the LCD's number of columns and rows: 
      lcd.print("Tachometer");                     // Print initial message to the LCD.
      pinMode(pin, OUTPUT);                        // set pin 11 to output mode
      digitalWrite(pin, HIGH); 
      pinMode(2, INPUT);                           // set Hall Effect sensor pin to input
      digitalWrite(2, HIGH);                       // turn on pullup resistor for Hall Effect sensor    .
      pinMode(buttonPinD, INPUT);                  //input switch Down pulse
      pinMode(buttonPinU, INPUT);                  //input switch Up pulse         

 }

void loop()
{   buttonStateD = digitalRead(buttonPinD);
    if( (millis() -lastDebounceTimeD) > debounceDelay)   //if samples down switch is true
    {   if( (buttonStateD == HIGH) && (stateD < 0) )
        { stateD = -stateD;                        //if switch and state differ, change state
          samples = samples -10;                   //valid switch, decrease samples
          if (samples <= 19) samples =20;          //don't let sample size get too small
          lastDebounceTimeD = millis();            //set the current time
        }
 
       else if( (buttonStateD == HIGH) && (stateD > 0) )
        {   stateD = -stateD;                       //now the LED is off, we need to change the state
            lastDebounceTimeD = millis();           //set the current time
        } 

    }
    buttonStateU = digitalRead(buttonPinU);              //if samples up switch is true
    if( (millis() -lastDebounceTimeU) > debounceDelay)
    {   if( (buttonStateU == HIGH) && (stateU < 0) )
        { stateU = -stateU;                  //now the LED is on, we need to change the state
          samples = samples + 10;
          lastDebounceTimeU = millis();            //set the current time
        }
 
       else if( (buttonStateU == HIGH) && (stateU > 0) )
        {   stateU = -stateU;                     //we need to change the state
            lastDebounceTimeU = millis();         //set the current time
        } 

    }    
}

This morning I set up a minimal Hall Effect circuit. The circuit consisted of the Hall Effect sensor, a pull up resistor and a capacitor between the output and ground. I'm using a 3144 sensor I got from eBay @ 10 for $2.15. I used a 4.7K resistor and a 27 pF capacitor because they were the first components I found in my desk drawer. The 27 pF is smaller than recommended but I got good results with it.

By hand, I held a small DC motor close to the sensor to make a measurement. On the shaft of the motor was a ring magnet. The magnet was skewed on the motor shaft. When it was centered, I think the magnetic field was so uniform that the Hall Effect wasn't triggering. When the magnet is close to the Hall Effect sensor, the output goes low. When it wobbles away, the resistor pulls the output high.

On my oscilloscope, I observed a nice clean 5 volt square wave. Period on the square wave was 32.8 mSec. Just about 60 Hz (1800 RPM). The output was pretty close to the 5V rail. When the magnet was not influencing the Hall Effect sensor, the output was also near the 5V rail.

I think putting your scope on the Hall Effect sensor output (rather than on the assembled device's output) should give you some clues as to what's going on.