I'm currently doing a small Arduino project and I need your help. I have a signal source (mp3 player) that goes into one of the analogue input pins (AD0) on the Arduino, to be further analysed. The problem is, the program requires a 2 second period when it starts so that it can calibrate and compensate for noise. This is done by having the AD0 pin connected to ground for those 2 seconds and connecting it back to the signal source. My question is, is there anyway I can do this operation of switching back and forth automatically? It's a bit annoying having to switch the cables every time I run the program.
I don't quite understand the point of tying the analog input to ground - doesn't that just give you a solid zero on that input? Anyway ...
You could wire the analog input to a digital pin which is set to OUTPUT mode and driven LOW during the calibration and then set to INPUT (high impedance) mode subsequently. That wouldn't give you an absolute ground signal, but it would be held down to a very low value.
Does the input definitely need to be connected to ground, rather than 5V, during the calibration? You could use the internal-pullup resistor to pull it HIGH during calibration without involving any other pins or external wiring, if that's any use.
Try the suggestion about the digital output and compare to see if the noise is as low as the direct short. AND make sure you set that output pin to INPUT mode afterwards.