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
}
}
}