Hi, everyone.
I have a problem with the sensor sharp GP2Y0A21 (4cm to 80cm). When i read the analog value with the adc in the arduino nano it brings me weird values, it seems like "floating".I Also tried with a arduino UNO and the result is the same.
When nothing is in front of the sensor it brings me values about 250 and also a very large noise, but when a object comes in front of the sensor the lecture gets estabilized, it has a good response in the range of 70 cm to 5 cm, except when nothing is in front of it.
I thought that was normal, but i recently made a custom board based in arduino with the atmega328p and made the same tests, and the result is very different. The response is exactly what the datasheet of the sensor says.
The atmega328p that i have used is an original ic from microchip, and the arduino nano and UNO are a chinese copie. Is there any chance that the ic of the chinese arduinos are counterfeit? They run very good in other aplications.
What other factors could affect the reading? The custom board that i made have the barely minimun circuit, only have a bypass capacitor in the Aref pin, and a 10 uf capacitor in the 5v line. In addition to the resonator and other circuits that the only thing they could do would worsen the operation of the ic, not improve it.
I already did the same test with anothers sensors and the result is the same.