PMS5003 in Particle Boron

Hello, I am using the dust sensor pms5003, I ran it first with a particle photon and everything was fine, it sent me correct data but later I connected it to the Boron particle and it no longer sent me any value, the connection I made in both particles is the same, yes someone could help me I would appreciate it, this is the code I am using:

long pm10 = 0;
long pm25 = 0;
long pm100 = 0;
long filter = 0;

uint8_t wake[] = { 0x42, 0x4D, 0xE4, 0x00, 0x01, 0x01, 0x74 };
uint8_t sleep1[] = { 0x42, 0x4D, 0xE4, 0x00, 0x00, 0x01, 0x73 };
//uint8_t sleep[] = { 0x42, 0x4D, 0xE4, 0x00, 0x00, 0x01, 0x73 };

void setup() {

void loop() {
  // digitalWrite(SLEEPLED, HIGH);
  Serial1.write(wake, sizeof(wake));
  int index = 0;
  char value;
  char previousValue;
  while (Serial1.available()) {
    value =;
    if ((index == 0 && value != 0x42) || (index == 1 && value != 0x4d)){
      Serial.println("Cannot find the data header.");
     if (index == 4 || index == 6 || index == 8 || index == 10 || index == 12 || index == 14) {
      previousValue = value;
    else if (index == 5){
      pm10 = 256 * previousValue + value;
      Serial.print("{ ");
      Serial.print("\"pm10\": ");
      Serial.print(pm10);// return pm10;
      Serial.print(", ");
    else if (index == 7){
      pm25 = 256 * previousValue + value;
      Serial.print("\"pm25\": ");
      Serial.print(pm25);//return pm25
      Serial.print(", ");
    else if (index == 9){
      pm100 = 256 * previousValue + value;
      Serial.print("\"pm100\": ");
    } else if (index > 15) {
  Serial.println(" }");
    // Publish data
    Particle.publish("pm25", String(pm25) + " ug/m3");
    Particle.publish("pm1", String(pm10) + " ug/m3");
    Particle.publish("pm10", String(pm100) + " ug/m3");
    if (pm25 > 15 && filter == 0) { 
        filter = 1;
        Particle.publish("filter", String(filter));}
    if (pm25 < 10 && filter == 1) {
            filter = 0;
        Particle.publish("filter", String(filter));

  uint8_t sleep[] = { 0x42, 0x4D, 0xE4, 0x00, 0x00, 0x01, 0x73 };

  Serial1.write(sleep, sizeof(sleep));
  // digitalWrite(SLEEPLED, LOW);

Can you elaborate on this a bit more? I'd also suggest breaking out the portion of the code that is not functioning rather than sharing all of it. For example, if the issue is with Particle.Publsih() and the data not getting to the cloud, try to simplify the code to only have what is necessary for Particle.Publish() even if it is Particle.Publish ("dumyy data"). If the issue is getting readings from the sensor, then start with a very basic code of just printing the value via Serial.print(). It can be difficult to provide guidance without knowing more detail of what your problem is and even more difficult by providing the entire code vs only the minimal amount of code that replicates the problem.

the problem is that it does not give me values ​​in serial.print and neither in the .publish and the strange thing is that in Photon if this same code works for me but in the boron I have not already tried with several codes and the same thing happens

@road97 I’d suggest breaking it down into manageable pieces. I’m still not clear if the device can print ANYTHING at all via serial or not? Can it publish anything via Particle.Publish(). For now, take your sensor completely out of it and start with the basics and build from there. Also, your status LED on if makes it to your loop to make sure it’s actually executing or made it to loop(). I’d suggest starting with the simplest of code and building up from there. To ease in troubleshooting, you may even want to be in manual mode with this at the top of your code: SYSTEM_MODE(MANUAL);

  1. Does the Particle Boron print anything at all over serial, even hello World?
void setup()
  Serial.begin(9600);   // open serial over USB

  // Wait for a USB serial connection for up to 30 seconds
  waitFor(Serial.isConnected, 30000);

  Serial1.begin(9600);  // open serial over TX and RX pins

  Serial.println("Hello Computer");
  Serial1.println("Hello Serial 1");

void loop() {}
  1. Does the Particle Boron Connect to the cloud at all (breathing Cyan LED)? I wonder if you are in Automatic mode, so the setup and loop function never gets executed because Particle never connects to the cloud. This is explained further here: Device OS API - Boron | Reference Documentation | Particle

This is the default behavior:


void setup() {
  // This won't be called until the device is connected to the cloud

void loop() {
  // Neither will this

I’d recommend the following approach one step at a time with the simplest of code possible.
Add SYSTEM_MODE(MANUAL) at the top of your code to put it into Manual

  1. Use the simpliest serial.print() and make sure you can print stuff
  2. Try and read the sensor values and print that to serial. Can you read values from the sensor
  3. Try and connect with Particle.Connect() in manual mode. Do you connect
  4. Try and publish a basic event with no data, Does it reach the particle cloud?

Are you working together with @jonamleonel on this?
There is a very similar thread here

If this is indeed a colaboration we'd like you to keep the discussion in one thread rather than scattering information and possible answers over multiple places.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.