Analog Input to Digital Serial occasionally quits (Uno)

I have a project where I feed a voltage supplying sensor to A0. The Uno converts it to a digital value and transmits it via serial cable to my PC and I graph the result on my PC. It works real well most of the time, but occasionally for some reason it just stops converting the input to digital and always delivers 0 to the PC.

The first time it happened, I removed the sensor input and put in a simple potentiometer to supply a variable voltage using the Uno's 5V as the source. This worked fine. I hooked the senor back up again and it was all working fine again, converting the voltage to digital just as it should be.

I thought maybe I was getting >5V from the sensor occasionally. I bought a 5V zener diode to put across the output of the sensor to prevent against possible over voltages. The system seemed to work just fine again in this scenario, until it happened again, and it is reading all zeroes again. I know that there sensor is delivering more than 0V because I can measure it. The ADC should be converting the voltage but it is not. Pressing the Arduino reset, or removing power has no affect. It is still reading zero after reset.

I'm new to Arduino, I was wondering if anyone knows what is going on. Is there something other than reset I can use to make sure the Arduino is properly initialized at start-up?

A input of +5vdc or greater will return a 1023 count value, if it doesn't destroy the input pin as it has a Vcc +.5vdc limit.

The best course of action to troubleshoot this problem is to run the sketch with the sensor connected and when and if you see it reading zero again, just measure the voltage at the input pin with your Digital Multimeter. That will 'half-split' the problem from being a sensor problem or a arduino problem. If you don't own one, go on-line and order one, they are cheap these days and no one should be wiring up arduino projects without having and learning to utilize a DMM.

Lefty

cmh2001:
I have a project where I feed a voltage supplying sensor to A0. The Uno converts it to a digital value and transmits it via serial cable to my PC and I graph the result on my PC. It works real well most of the time, but occasionally for some reason it just stops converting the input to digital and always delivers 0 to the PC.

Can't say whether it's a hardware or software problem at this stage. I suggest you post your code, and hopefully we can then rule out software as the cause.

Also post your schematic, and a link to the datasheet for the sensor.

PS - if you suspect that the output from the sensor may be a little out of range sometimes, connect a 10K resistor between the sensor output and the Arduino input pin, and let the internal pin protection diodes do the rest.

I'm actually trying to digitize an audio signal. I have a sensor (Geophone) that produces a signal, is goes through a pre-amp, then to an LM386 amplifier. The output produces a mono audio signal. I'm trying to condition that signal such that it is suitable to put to an analog pin on the Arduino. I am thinking that it needs to be rectified, and limited so that it can't produce more than 5V. In the hyperlinked schematic, the lower right corner shows the Arduino interface, which in parallel with the speaker audio output. It uses a 5.1 V zener to limit the voltage seen at A0 on the Uno. I'm not sure that it is doing the job well enough though.

Imgur

Hopefully the link I attached shows the schematic. If someone might be able to suggest a more effective way to condition the signal for the Arduino, I would appreciate it.

The circuit is a bit hard for me to understand. If you have access to an oscilloscope, check if the signal is within range and stays positive.

It seems that you are feeding an AC signal into the Arduino, which wont produce any kind of sensible result.
You need some kind of peak rectifier to convert the signal into DC between 0 and 5V, and also possibly some smoothing.

I modified the interface portion of the circuit by adding a diode (D2) that will rectify the audio signal, so that it is all positive. I think the reason it stopped working in the past was because I was getting some negative voltages.

I also made a dramatically better schematic:

Imgur

Its working very well now. I get a beautiful display on my PC screen:

Imgur