Go Down

Topic: ESP Easy PMS3003 Value zero ??? (Read 129 times) previous topic - next topic

Anakreont

Aug 25, 2019, 12:24 pm Last Edit: Aug 25, 2019, 12:30 pm by Anakreont
Hi

I connected pms3003 to the vemos board
vcc - to vemos 5v
gnd - vemos gnd
rx - vemos tx GPIO1
tx - vemos rx GPIO3
unfortunately zero value was obtained in esp easy where the problem lies, please help

Idahowalker

#1
Aug 25, 2019, 02:15 pm Last Edit: Aug 25, 2019, 08:55 pm by Idahowalker
Could you post your formatted code in code tags?

On the ESP GPIO1 and GPIO3 are used for serial monitor.

There are several hardware serial ports on the ESP, GPIO1 and GPIO3, Serial, should NOT be used for your projects.

The ESP does not use Serial2, Serial3, or SerialX, instead you, the programmer, can use Serial (0), Serial (1), and Serial (2).

Serial (2) is the easiest to use as it does not require Matrix re-definition. Serial (1), normally, requires an extra line of code.

To use Serial (2) on an ESP you will need to include the ESP32 serial hardware API:
Code: [Select]
#include <HardwareSerial.h>
You will then need to define your serial device like so:
Code: [Select]
HardwareSerial SerialBrain( 2 );
//serial (2) = pin16=RXgreen , pin17=TX white

Note the pins used for serial (2) are the natural pins for serial (2) on the ESP.
In setup() initialize your defined serial port
Code: [Select]
SerialBrain.begin( SerialDataBits );
and then use the serial port:
Code: [Select]

void fSendSerialToBrain( void *pvParameters )
{
  struct stu_LIDAR_INFO pxLIDAR_INFO;
  xSemaphoreGive ( sema_SendSerialToBrain );
  String sSerial;
  sSerial.reserve ( 300 );
  for (;;)
  {
    xEventGroupWaitBits (eg, evtSendSerialToBrain, pdTRUE, pdTRUE, portMAX_DELAY);
    if ( xSemaphoreTake( sema_SendSerialToBrain, xZeroTicksToWait ) == pdTRUE ) // grab semaphore, no wait
    {
      int CellCount = 1;
      xSemaphoreTake( sema_LIDAR_INFO, xSemaphoreTicksToWait );
      xQueueReceive ( xQ_LIDAR_INFO, &pxLIDAR_INFO, QueueReceiveDelayTime );
      xSemaphoreGive( sema_LIDAR_INFO );
      sSerial.concat( "<!," ); //sentence begin
      sSerial.concat( String(ScanPoints) + "," );
      for ( CellCount; CellCount <= ScanPoints; CellCount++ )
      {
        sSerial.concat( String(pxLIDAR_INFO.Range[CellCount]) + "," );
      }
      sSerial.concat( ">" ); //sentence end
      SerialBrain.println ( sSerial );
      sSerial = "";
    }
  }
  vTaskDelete( NULL );
} // void fSendSerialToBrain( void *pvParameters )

Anakreont

I use EASY ESP
this is from log
12: PMSx003 : invalid framelength - 20
761413: PMSx003 : invalid framelength - 20
762213: PMSx003 : invalid framelength - 20
763012: PMSx003 : invalid framelength - 20
763813: PMSx003 : invalid framelength - 20

i used also oryginal monitor and it working on monitor but not working in esp 8266...

Go Up