ESP8266 and Dust Sensor - no communication?

Hi folks,

This project will be monitoring temp, humidity, particulates, and airflow. I’ve been able to get a Sanyo IR dust sensor running on this unit - but the values from the Sanyo don’t have the accuracy for the job.

I bought dfrobots SEN0177 laser dust sensor from Little Bird Electronics. I’m trying to read the sensor values from it and just simply display them in the serial window in the arduino IDE.

No luck.

I have the SEN0177 connected to its sensor adaptor board. The board is connected to 5v off the breadboard rail, TX and RX from there are connected to RX and TX on the GeekCreit ESP8266 board. It’s the bare minimum I think (although I’ve read I could leave the ESP8266’s TX pin disconnected). The ESP is connected to the same power rail on the breadboard (to VIN and GND).

The SEN0177 itself seems alive - the fan powers up and spins. The adaptor board has a green light on the RX light and a red light for the “ON” led.

But that is it.

The TX light on the adaptor board never really seems to do anything?

I have tried so many different code examples off the web - I just can’t seem to get any values out of this sensor.

I’m hoping I can get some guidance? I’m not a real coder, not a real Engineer - but I’m bloody determined!

Thanks folks,

PS - Code follows

 //*Abstract: Read value of PM1,PM2.5 and PM10 of air quality
 //*Product Link:
 //*The TX pin on the sensor connects to pin 10 on the Arduino
 //*The RX pin on the sensor connects to pin 11 on the Arduino
 //*Author:Zuyang @ HUST
#include <Arduino.h>
#include <SoftwareSerial.h>
#define LENG 31   //0x42 + 31 bytes equal to 32 bytes
unsigned char buf[LENG];

int PM01Value=0;          //define PM1.0 value of the air detector module
int PM2_5Value=0;         //define PM2.5 value of the air detector module
int PM10Value=0;         //define PM10 value of the air detector module

SoftwareSerial PMSerial(3, 1); // RX, TX - ESP specific pins

String data = "";

void setup()


void loop()
  Serial.println("Looking for val "); 
  if(PMSerial.available()>0 ){
    Serial.println("PMSerial avail");  

// try to debug if there is any content
    Serial.println((int)ch, HEX); 
      Serial.println("found 0x42");    
      if(buf[0] == 0x4d){
          PM01Value=transmitPM01(buf); //count PM1.0 value of the air detector module
          PM2_5Value=transmitPM2_5(buf);//count PM2.5 value of the air detector module
          PM10Value=transmitPM10(buf); //count PM10 value of the air detector module 

  static unsigned long OledTimer=millis();  
    if (millis() - OledTimer >=1000) 
      Serial.print("PM1.0: ");  
      Serial.println("  ug/m3");            
      Serial.print("PM2.5: ");  
      Serial.println("  ug/m3");     
      Serial.print("PM1 0: ");  
      Serial.println("  ug/m3");   
char checkValue(unsigned char *thebuf, char leng)
  char receiveflag=0;
  int receiveSum=0;

  for(int i=0; i<(leng-2); i++){
  receiveSum=receiveSum + 0x42;
  if(receiveSum == ((thebuf[leng-2]<<8)+thebuf[leng-1]))  //check the serial data 
    receiveSum = 0;
    receiveflag = 1;
  return receiveflag;

int transmitPM01(unsigned char *thebuf)
  int PM01Val;
  PM01Val=((thebuf[3]<<8) + thebuf[4]); //count PM1.0 value of the air detector module
  return PM01Val;

//transmit PM Value to PC
int transmitPM2_5(unsigned char *thebuf)
  int PM2_5Val;
  PM2_5Val=((thebuf[5]<<8) + thebuf[6]);//count PM2.5 value of the air detector module
  return PM2_5Val;

//transmit PM Value to PC
int transmitPM10(unsigned char *thebuf)
  int PM10Val;
  PM10Val=((thebuf[7]<<8) + thebuf[8]); //count PM10 value of the air detector module  
  return PM10Val;

One issue: the ESP8266 operates at 3.3V, and your device probably puts 5V on its Tx line. That's out of spec of the ESP8266, you need a level shifter here (or run the adapter board at 3.3V - if possible, that'd be the easier solution).

Another thing: why do you connect that breadboard power supply with jumper wires instead of simply sticking it on the breadboard?

(edit: corrected ESP voltage)

The ESP will take a 5v supply - but the IO are 3.3 - except for the single analogue pin which is around 1v. There is talk about some ESPs being 5v tolerant on the IO.

The sensor board outputs 3.3v - so it all checks out.

The reason for the people supply hanging off like that is because this pic was taken after u had stripped the project all the way down to nothing but the problem sensor. I had other sensors mounted and they were happy running of the supply from my USB. The 5v power supply came later as an attempt to feed the sensor what it needed as per it's spec sheet.



Sorry, mistyped that (corrected). The ESP8266 runs at 3.3V - some modules may take higher input voltage if they have a regulator on board.

It is not rated as 5V tolerant but in practice it seems to do OK at those voltages.