Go Down

Topic: Circuit check for noob (Read 2 times) previous topic - next topic

point5

Hi,

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.

point5

#1
Nov 01, 2011, 10:34 am Last Edit: Nov 01, 2011, 10:36 am by point5 Reason: 1
Ahhh, perhaps the schematic below is better?

Pin 3 I have going straight to an Arduino digital pin.


Grumpy_Mike

Yes that is better.

Dust detector? I married one of those.  :)

point5

Quote
I married one of those.


Cool, does she on on 3.3V or 5V :-)

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?

Grumpy_Mike

Quote
Cool, does she on on 3.3V or 5V :-)

What?

Yes the first circuit essentially put a load of 22mA across the supply so not exactly shorting but did nothing about the decoupling.

Quote
The first circuit shown caused problems with the I2C sensor

Is it connected to a 5V arduino? if so then you have to disable the pull up resistors in the wire library and add your own 2K2 pull ups to 3V3.

point5

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?

Grumpy_Mike

Yes that should be fine. Good luck.

point5

Thanks again Mike, sounds like I won't need to worry about turning the internal pullups off if I'm using external 4K7 pullups?

point5

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:

Code: [Select]
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);
}

Grumpy_Mike

Code: [Select]
digitalWrite(ledPower,LOW); // power on the LED
Will actually turn OFF the LED, not on.

Why are you running it off 3v3? This will make the 150R cut down the LED current more than is anticipated.

Why all the talk about I2C earlier on?

point5

Hi Mike,

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.

Grumpy_Mike

Code: [Select]
The LED seems to use a PNP transistor
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.

Quote
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.

point5

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.

Code: [Select]

2
2
2
726
727
727
727
2
2
2
3
2

Grumpy_Mike

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. 

point5

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


Go Up