I am looking at trying the sharp dust sensor GP2Y1010AU0F - the data sheet shows the following cap and resistor arrangement and I was wondering if I have interpreted this right in the schematic below? Sorry, very basic stuff !!
The first image is my schematic.
The second image is from the data sheet.
Thanks for the confirmation Mike, appreciated. The first circuit shown caused problems with the I2C sensor I also have connected, I guess the second (correct) circuit should avoid this problem? I think the 150R resistor was effectively shorting the power?
The arduino is 3.3V, I have the SCL & SDA pulled high (3.3V) via two 4K7 resistors but have not disabled internal pullups through the wire library (how do I do that please?). The I2C bus and dust sensor would be powered by the same 3.3V line, hoping this will work out?
OK, so I have my circuit complete and code installed but I don't seem to be getting sensible output..... wondering if anyone can spot any obvious blunders?
My reference is here: http://sensorapp.net/?p=479 I have changed pin assignments as per the circuit below and the voltage used is 3V3 rather than 5V but the sensor can handle this I believe. I'm not sure what this line is doing: pinMode(4, OUTPUT);
Any clues or thoughts appreciated.
My code is:
int dustPin=1;
int dustVal=0;
int ledPower=6;
int delayTime=280;
int delayTime2=40;
float offTime=9680;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
pinMode(4, OUTPUT);
}
void loop(){
// ledPower is any digital pin on the arduino connected to Pin 3 on the sensor
digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(delayTime);
dustVal=analogRead(dustPin); // read the dust value via pin 5 on the sensor
delayMicroseconds(delayTime2);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(offTime);
delay(3000);
Serial.println(dustVal);
}
The LED seems to use a PNP transistor so to power on, the LED pin must actually recieve a lower voltage.
I'm running this off 3V3 as that is the native logic voltage of my board - perhaps I should change the resistor value... would this simply be 3.3/5 X 150 = 100?
The I2C talk was related to the I2C circuit which shares the VCC with this circuit.
Yes but when I looked at the circuit in the link you gave I saw a FET and thought it was part of the circuit. Sorry.
I have now looked at the data sheet and noticed that there is an amplifier in front of the detector. I also notice that it says recommended operating voltage 5V. That suggests to me that the amplifier needs 5V to work and that it won't work correctly on 3V3. There are a lot of op-amps that will work off 5V and not 3V3.
perhaps I should change the resistor value... would this simply be 3.3/5 X 150 = 100?
No not that simple because you have the forward volts drop of the diode and the saturation voltage of the transistor to consider.
I would try and get it to work on 5V first and cut the output down with a potential divider.
Well, better at 5V but still a bit odd in terms of output.... see below - all or nothing rather than the steady change that one might expect? That said - this setup: http://itp.nyu.edu/physcomp/sensors/Reports/GP2Y1010AU seems to be getting a similar result..... the datasheet shows a more steady ramp on the dust/mV graph.
Thinking about it that might be what you expect. The large numbers are when there is a response value of dust and when the dust wasn't there you would get a small value. Dust by it's nature is an intermittent phenomenon so maybe taking the maximum values would be more realistic.
OK, I'm going to try this setup over a longer period to see what gives
To convert the Anaolg pin output may I check the following with you....
Anolog pin input ranges from 0-1024
Sensor range is 0-0.6 mg/m3
This sensor seems to range from 500mV (no dust)
Every 0.1mg of dust = 500mV
So, voltage ranges from 500mV to 3500mV
So max output without remapping is 3500/5000 * 1024 = 717 (pretty much what I saw).
My output in mg/m3 is therefore = ((((dustVal/717)*3500)-500)/500) * 0.1
EG reading on Analog 1 = 412 = 0.3mg/m3
hello,
i’m experimenting too with GP2Y1010AU0F, but i’ve found a strange behaviour.
my sensor is conncted like datasheet explain, pin 3 direct to atmega (i’ve also try using a mosfet but it do not change)
if i run GP2Y1010AU0F with 5.330 voltage i read an output voltage between 0.800 and 0.850
if i run GP2Y1010AU0F with 5.080 voltage i read an output voltage between 0.770 and 0.830
if i run GP2Y1010AU0F with 4.670 voltage i read an output voltage between 0.700 to 0.770
so there’s a small drift when supply voltage change.
i suppose the fig 3 of datasheet, from which we can extract slope and offset to find dust sensity, it’s 5.0v supply voltage, so reading an “incorrect” voltage would bring to incorrect mg/m^3 conversion.
have you also find this behevior?
have you find a way to balance the supply voltage drift?
I think the best option is to run that detector (both the amplifier side and the LED side) from a regulated 5V supply. However, the readings you are getting appear to be roughly ratiometric with the supply voltage. Therefore, if you feed the output into in analog input of an Arduino that is powered from the same 5V supply, then the ADC will approximately compensate for supply voltage variation.
dc42:
I think the best option is to run that detector (both the amplifier side and the LED side) from a regulated 5V supply. However, the readings you are getting appear to be roughly ratiometric with the supply voltage. Therefore, if you feed the output into in analog input of an Arduino that is powered from the same 5V supply, then the ADC will approximately compensate for supply voltage variation.
thank for reply,
my readings are taken from arduino, and checked with multimeter, to get voltage i use bandgap for the adc ref voltage, so it does not compensate reading. to check adc i try the compensation why different voltage using other sensor, or using a simple resistor, and it works!, but this times not; i think is the output of this sensor that change with voltage supply changing, but datasheet unfortunately do not tell anything about sensitivity over voltage.
anyway, i suppose you are right, best option is to run it over regulated 5v power.
Hi, I'm working with an Arduino Uno and Sharp Dust Sensor GP2Y1010AU0F for a project. Is there any official example or test code I can upload while testing it? Any help would be greatly appreciated!