Go Down

Topic: GP2D12 Problem (Read 440 times) previous topic - next topic

macius

Hi there,
The problem - after connecting Sharp's sensor to Arduino Uno AD converter returns maximum level of measured signal for distance < circa 0,5m. Everything's done just like in examples. I've connected red cable to 5V ARduino's output, black one to GND and sensor's output directly to analog input A5. I've checked the sensor with multimeter- works properly.

Here "my" code:
int irReader = A5;    // the analog input pin for the ir reader
float irVal = 0;       // stores value from Ir reader

void setup()
{
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  irVal = analogRead(irReader);  //[V]
  Serial.println(irVal);
  delay(500);
}

Is anything else required? Or maybe I should connect Vout through pull-down resistor?

robtillaart


Code is elementary but OK, have you tried the other analog ports ?

you did not use the digital port 5 by accident ? would not be the first ...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

macius

No, it's analog input for sure ;) No matter which channel I use the result is the same. Moreover, when I connect a channel to voltage divider's output (10k/10k), the voltage between GND and output equals 1V. It makes me think that there's something wrong with the hardware.

robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

macius

So I did. Converter returns values 0-1023 for voltage 0-0.6V. Maybe there's something wrong with ADC amplifier's gain?

Go Up