Plantower PMS3003 on GrovePi serial port

Hello,

I have a RPI3 with grovePi and grove DHT 11 sensor working perfect.

I whish to know if I could attach and read data from a dust sensor PMS3003 in the gropvePi serial port.

I already have cable adapters for matching the dust sensor into grovePi connector.

Thank you.
Regards
Fabian

Hi @fabian.techera,

Well, if this PMS3003 sensor uses the serial line and you haven’t used the RPI_SER port of the GrovePi yet, then yes, it’s going to work provided you have the right libraries on your Raspberry Pi.

Just out of curiosity, what firmware version is on the GrovePi at the moment of speaking?

Thank you!

EDIT: By using this RPI_SER port (and not the other one) you are essentially bypassing the GrovePi completely: it would be just as if you interface with the sensor directly on the Raspberry Pi.

Hello @RobertLucian ,
Thanks for the answer. I’m using Raspian for robots V9. I made a full update firmware and Libraries last friday.

When you say right libraries, which one do you mean?
Just for example, this is an extract of the code related with the connection contributed by Thomas-Tsai for a normal connection of this sensor.
Do you think this should work?
Sensor arrives today, I haven’t tried yet
Thank you

#!/bin/python
import serial
import time
import sys
from struct import *
debug=0

class g3sensor():
    def __init__(self):
        if debug: print "init"
	self.endian = sys.byteorder
    
    def conn_serial_port(self, device):
        if debug: print device
        self.serial = serial.Serial(device, baudrate=9600)
        if debug: print "conn ok"

    def read(self, argv):
        tty=argv[0:]
        self.conn_serial_port(tty)
        if self.check_keyword() == True:
            self.data = self.read_data()
            if debug: print self.data
            return self.data

    if __name__ == '__main__': 
    air=g3sensor()
    while True:
        pmdata=0
        try:
            pmdata=air.read("/dev/ttyAMA0")
        except: 
            next
        if pmdata != 0:
            print pmdata
            break

Hi @fabian.techera,

When you say right libraries, which one do you mean?

Whatever it’s necessary for the PMS3003 sensor to run - we couldn’t possibly know what’s required for it since we don’t have one. So that’s why I said right libraries.

Secondly, I don’t see anything wrong with that code you’ve shown me - there could be a problem with the serial port though. By default, the serial port you want is found at /dev/ttyS0 and in order to make it work with /dev/ttyAMA0 you have to switch Bluetooth’s default serial device.

Thank you!

Hello @RobertLucian

Thanks for the advices. The sensor worked perfectly in the GrovePi RPI_SER.
I had some issues with the Bluethoot as you said. I made some changes about that.

Next step is to connect a Grove GPS, sadly I’ve heard that even RPI has two UARTs, they don’t work together. That is right?
There is a way to make the Grove GPS in the GrovePi Serial and the Sensor dust in the RPI_SER work togheter ?
Thank you
Regards
Fabian