Signal conditioning

Microcontroller : Arduino Uno R3.
Sensor : ADXL 335 accelerometer.

I am trying to use an accelerometer ADXL335 to give me snappy integrated velocity. It was working fine until I connected a switch to my microcontroller. I have enabled the internal pull-down resistor. And all it does is tell me if it's high or low and then interrupts to set a flag. And if it is set, calibration function is carried out to calculate the non-inertial acceleration to be corrected from the receiv d acceleration values.

When the switch is high, I'm getting an error of 0.07Gs which is significant for my application.

I'm using a DPDT switch, one side goes to ground, the middle goes to Arduino Uno with internal pull-down resistor.

Also of note is, I get similar error when I try to note voltage on the accelerometer using a DMM.

I am also trying to make a filter but I'm confused at one thing. What should be my cut off frequency? I want the sensor to give me accurate values for atleast 6 samples per second. And I want to remove drift and noise, so I reckon a bandpass filter would be the best bet. But, should I set the passing frequency according to the sampling frequency I need or the frequency at which the sensor sends data or the sampling rate of the ADC in the micro controller? The datasheet for the accelerometer only shows the bandwidth, how do I figure out the frequency of data relay from that? Or are they the same thing?

Shaurcasm:
I have enabled the internal pull-down resistor.

I don't think so.

I do think the problem is in the part you didn't post. Did you read the sticky already?

Yeah, I did... I set the pin for output and coded digitalWrite( pin, HIGH ). That's what 3 tutorials had done for internal pull-down resistors. The switch is working fine and dandy. But, its HIGH state adds 0.07 to G reading. I don't know if its a decoupling problem, Arduino problem or electronic circuit needing signal conditioning.

It is possible to set internal pull-UP resistors on INPUT pins. There are no internal pull-down resistors.

And writing HIGH to a digital OUTPUT pin just sets it HIGH, nothing to do with resistors pulling in any direction.

Steve

The Arduino has no pull-down resistors. Only pull-up.
Too bad that after reading the sticky you decided to ignore all instructions given in it. Not a good idea if you want help.