Sharp GP2Y1026AU0F Скачать руководство пользователя страница 8

Application Guide for Sharp GP2Y1026AU0F Dust Sensor 

 

 

 

 

http://www.socle-tech.com 

Source Code Listing – sharp_gp2y1026au0f_v2.ino – PART A 

 

/*************************************************************************************** 
 GP2Y1026AU0F Dust sensor sample code for Arduino – demo purposes only - 2018.07.07 
 
 Board Connection: 
   Arduino  GP2Y1026 
   10pin     TxD 
   GND       GND 
   5V        Vcc 
  
 Serial monitor setting: 9600 baud  
 
 Original code by Sharp Corporation with modifications by Socle Technology Corp. 
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY 
 EXPRESS  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 
 WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 ***************************************************************************************/

 

 
#

include 

<

SoftwareSerial

.h> 

 
#

define 

rxPin 10 

#

define 

txPin 11 

 

// Use software serial port for communicating with GP2Y1026. 

SoftwareSerial 

mySerial(rxPin, txPin); 

 

// Helper function to read data from software serial port. 

int 

getSerial() { 

  

while 

(!mySerial.

available

()) {} 

  

return 

mySerial.

read

(); 


 

void 

setup() { 

  

// Start the hardware serial port for the serial monitor.

 

  

Serial.begin

(9600); 

 
  

// Start the software serial port for receiving data from GP2Y1026.

 

  mySerial.

begin

(2400); 

 
  

// Wait a second for startup. 

  

delay

(1000); 


 

void 

loop() { 

  

static int 

frame[7]; 

  

static int 

dataStart, VoutH, VoutL, VrefH, VrefL, checksum, dataEnd; 

 
  

// Look for end of frame. 

  

if 

( getSerial() != 0xff ) { 

return

; } 

 
  

// Read in next frame. 

  

for

(int i = 0; i < 7; i++) { 

    frame[i] = getSerial(); 
  } 
 

Содержание GP2Y1026AU0F

Страница 1: ...Application Guide for Sharp GP2Y1026AU0F Dust Sensor Arduino Uno Mega 2018 07 07 v2 Socle Technology Corp Foxconn Technology Group Sharp Corporation ...

Страница 2: ...T SENSORS WORK 3 3 KEY CONCEPTS AND TERMINOLOGY 4 4 COMPARING GP2Y1010AU0F AND GP2Y1026AU0F 4 5 AIRFLOW DESIGN RECOMMENDATION 5 6 GP2Y1026AU0F CONNECTOR CABLE 5 7 USING GP2Y1026AU0F WITH ARDUINO 6 8 ARDUINO SKETCH EXAMPLE DEMO SOURCE CODE 7 9 EXAMPLE SERIAL MONITOR OUTPUT 10 10 LINEAR COEFFICIENT CALIBRATION 10 11 REFERENCES 11 ...

Страница 3: ...in microcomputer MCU which handles some of the processing you would normally need to provide yourself such as offset calibration temperature correction LED pulsing and averaging of data values to minimize noise 2 How do Sharp dust sensors work Sharp dust sensors operate on the principle of light scattering A photo detector and LED emitter oppose each other at an angle within the rectangular packag...

Страница 4: ...ensitivity is the change in output voltage when the dust density changes by 100 µg m3 4 Comparing GP2Y1010AU0F and GP2Y1026AU0F Specification Parameter GP2Y1010AU0F GP2Y1026AU0F Light emitting element LED LED Min detectable dust size 0 5μm 0 5μm Dust density sensing range 0 to 600 μg m 3 0 to 1000 μg m 3 Sensing time 1 second 1 second Sensitivity Accuracy 0 5V 0 15V per 100 µg m 3 change Accuracy ...

Страница 5: ...u can look at adding a mini 20x20mm or 25x25mm external fan It is also advisable to use a coarse mesh filter in your application design to prevent large dust particles from entering the Sharp sensor and accumulating inside While a light vacuum can be used to remove large dust pieces which may be attached inside the sensor your application design may preclude such kind of maintenance access to the ...

Страница 6: ... sensor directly to your Arduino board The pulse drive circuit also helps to extend the lifetime of the sensor under continuous operation Although the Sharp sensor has a RxD terminal you don t need to send it any commands in order to begin receiving serial UART data from the sensor s TxD terminal Simply connect the sensor to your Arduino board as shown in the figure below This example uses Arduino...

Страница 7: ... through its TxD terminal According to the specification it produces a 7 byte data frame as follows Thus it takes 70ms to output a data frame which is equivalent to 14 frames per second However the dust sensor MCU applies averaging to the data readings in order to reduce noise and so the output voltage values only change about once per second This means that you will see a lot of consecutive frame...

Страница 8: ...TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE include SoftwareSerial h define rxPin 10 define txPin 11 Use software seri...

Страница 9: ...rial print Serial print VoutL Serial print VoutL Serial print Serial print VrefH Serial print VrefH Serial print Serial print VrefL Serial print VrefL Serial print Serial print Checksum Serial print checksum Serial print Serial print dataEnd Serial print dataEnd Serial print Calculate Vout float Vout VoutH 256 VoutL 1024 0 5 0 Serial print Vout Serial print Vout 1000 0 Serial print mV Calculate a ...

Страница 10: ...riately before compiling or uploading the code The following screen capture shows example output from the GP2Y1026AU0F dust sensor as displayed on the Serial Monitor 10 Linear Coefficient Calibration The fixed a coefficient in the example code is used to convert output voltage from the sensor into a dust density value In the code the coefficient value is set to approximate the following graph from...

Страница 11: ...pdf datasheet gp2y1010au_appl_e pdf https pdfs semanticscholar org d641 19160b9effd57448b44d39d5ac5468ed0eff pdf http www teco edu budde publications MUM2013_budde pdf http eereview com article gp2y1014au0f pm25 optical dust density sensor http www iaarc org publications fulltext isarc2014_submission_50 pdf https www researchgate net figure Particulate matter sensors AES 1 a DSM501A b and GP2Y1010...

Отзывы: