Pages: [1] 2   Go Down
Author Topic: Circuit check for noob  (Read 2659 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* Capture.JPG (41.79 KB, 733x561 - viewed 65 times.)

* Capture1.JPG (31.16 KB, 689x392 - viewed 58 times.)
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ahhh, perhaps the schematic below is better?

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



* Capture2.JPG (61.27 KB, 961x749 - viewed 73 times.)
« Last Edit: November 01, 2011, 04:36:48 am by point5 » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34220
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes that is better.

Dust detector? I married one of those.  smiley
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34220
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34220
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes that should be fine. Good luck.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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);
}


* Dust.JPG (54.41 KB, 689x545 - viewed 44 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34220
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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?
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34220
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
2
2
2
726
727
727
727
2
2
2
3
2
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34220
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 278
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1] 2   Go Up
Jump to: