با درود خسته نباشید
من سنسور GP2Y1010 خریدم
مطابق دیتاشیت یه پالس با طول 10 ملی ثانیه درست کردم که مدت 3 میلی ثانیه 1 و 7 میلی ثانیه 0
ولی خروجی خیلی پرش داره
کسی با این سنسور کار کرده ؟؟؟
نمونه کد هم پیدا کردم ولی همش با ardion هست که من اصلا ازش سر در نمیارم
[code=c]
/*
Standalone Sketch to use with a Arduino Fio and a
Sharp Optical Dust Sensor GP2Y1010AU0F
Blog: http://arduinodev.woofex.net/2012/12/01/standalone-sharp-dust-sensor/
Code: https://github.com/Trefex/arduino-airquality/
For Pin connections, please check the Blog or the github project page
Authors: Cyrille Médard de Chardon (serialC), Christophe Trefois (Trefex)
Changelog:
2012-Dec-01: Cleaned up code
This work is licensed under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
or send a letter to Creative Commons, 444 Castro Street, Suite 900,
Mountain View, California, 94041, USA.
*/
int measurePin = 6;
int ledPower = 12;
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
}
void loop(){
digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(samplingTime);
voMeasured = analogRead(measurePin); // read the dust value
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(sleepTime);
// 0 - 3.3V mapped to 0 - 1023 integer values
// recover voltage
calcVoltage = voMeasured * (3.3 / 1024);
// linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/
// Chris Nafis (c) 2012
dustDensity = 0.17 * calcVoltage - 0.1;
Serial.print("Raw Signal Value (0-1023): "
;
Serial.print(voMeasured);
Serial.print(" - Voltage: "
;
Serial.print(calcVoltage);
Serial.print(" - Dust Density: "
;
Serial.println(dustDensity);
delay(1000);
}
[/code]
لینک اصلی
http://arduinodev.woofex.net/2012/12...p-dust-sensor/


کسی هست آردیون کار کرده باشه بگه چکار کرده ؟؟؟
من سنسور GP2Y1010 خریدم
مطابق دیتاشیت یه پالس با طول 10 ملی ثانیه درست کردم که مدت 3 میلی ثانیه 1 و 7 میلی ثانیه 0
ولی خروجی خیلی پرش داره
کسی با این سنسور کار کرده ؟؟؟
نمونه کد هم پیدا کردم ولی همش با ardion هست که من اصلا ازش سر در نمیارم
[code=c]
/*
Standalone Sketch to use with a Arduino Fio and a
Sharp Optical Dust Sensor GP2Y1010AU0F
Blog: http://arduinodev.woofex.net/2012/12/01/standalone-sharp-dust-sensor/
Code: https://github.com/Trefex/arduino-airquality/
For Pin connections, please check the Blog or the github project page
Authors: Cyrille Médard de Chardon (serialC), Christophe Trefois (Trefex)
Changelog:
2012-Dec-01: Cleaned up code
This work is licensed under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
or send a letter to Creative Commons, 444 Castro Street, Suite 900,
Mountain View, California, 94041, USA.
*/
int measurePin = 6;
int ledPower = 12;
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
}
void loop(){
digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(samplingTime);
voMeasured = analogRead(measurePin); // read the dust value
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(sleepTime);
// 0 - 3.3V mapped to 0 - 1023 integer values
// recover voltage
calcVoltage = voMeasured * (3.3 / 1024);
// linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/
// Chris Nafis (c) 2012
dustDensity = 0.17 * calcVoltage - 0.1;
Serial.print("Raw Signal Value (0-1023): "

Serial.print(voMeasured);
Serial.print(" - Voltage: "

Serial.print(calcVoltage);
Serial.print(" - Dust Density: "

Serial.println(dustDensity);
delay(1000);
}
[/code]
لینک اصلی
http://arduinodev.woofex.net/2012/12...p-dust-sensor/


کسی هست آردیون کار کرده باشه بگه چکار کرده ؟؟؟
دیدگاه