I have a Sharp GP2D12 and I've been using it with my Arduino just fine. I have however had some experience in the past where this sensor (which is analog) was fed into an ADC (like ADC0831) to go to a Basic Stamp. I was wondering what the purpose of this is given that both the Arduino and the Basic Stamp support analog inputs if I am not mistaken, thus it seems weird having an extra and necessary link in the chain. Does the ADC provide more resolution? What is the point of it in this circumstance?
1 Answer
The Basic stamp does not have an analog input. It has a method that can be used to attempt to measure voltage, but the output won't be as good as a proper ADC.
Briefly, the Basic Stamp uses an internal RC circuit and a timer to "count" how long it takes to charge the pin, then converts that time constant to a voltage. Here is an application note that describes the process in greater detail.
The method is prone to errors with noise and temperature drift, and also appears to be poor at handling slow changes in input voltage.
So, the point of the ADC is to get a stable reading of the Sharp sensor's output. The Arduino does have an analog input pin, the Basic Stamp does not.