1

I am trying to interface SPS30 via UART, but I am not able to start the fan. I am getting some response but it won't match any possible response from the datasheet. Using Micropython. Below is the code snippet -

import machine
import time
from micropython import const
if __name__ == "__main__":
   uart=machine.UART(1,115200,tx=machine.Pin(4),rx=machine.Pin(5)
   uart.write(bytes(0xff))
   buffer=[0x7e,0x00,0x11,0x00,0xee,0x7e]
   uart.write(bytes(buffer))
   uart.write(bytes(buffer))
   response=uart.read()
   print(response)
   time.sleep(1)
   buffer=[0x7e,0x00,0x03,0x00,0xfc,0x7e]
   uart.write(bytes(buffer))
   response=uart.read()
   print (response)

And response that I am getting -

b'\xfe~\x00}1C\x00\xab~'
b'~\x00}1C\x00\xab~'
10
  • Are you using the particular model: Datasheet SPS30 Particulate Matter Sensor for Air Quality Monitoring and Control cdn.sparkfun.com/assets/2/d/2/a/6/…
    – tlfong01
    Commented May 27, 2022 at 7:54
  • 1
    @tlfong01 yes I am using this model only. I have tested UART works with another sensor that I have used over UART. To be clear, not using both sensors on uart at once. The previous sensor is from different project.
    – Robot
    Commented May 27, 2022 at 9:09
  • 1
    This is wake up command. Cmd:0x11. Pg 12 of datasheet.
    – Robot
    Commented May 27, 2022 at 10:37
  • 1
    sensirion.com/media/documents/8600FF88/616542B5/…
    – Robot
    Commented May 27, 2022 at 11:31
  • 1
    The question in this thread is resolved. Thanks a lot!
    – Robot
    Commented May 27, 2022 at 15:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.