Correct UART pins and problems



  • I've been trying to get a Honeywell HPMA115S0 particulate sensor working with my LoPy4 and expansion board, but even with a modified Python library and lots of trial and error, it still can't read anything (the sensor works fine with a Pi). I want to check which pins I should be using for UART, and if there are any known issues that'd explain the problems I'm having.

    LoPy4 with the latest firmware, expansion board 2.0, USB connected, sensor connected to VIN (it uses 5V power and 3V logic), have tried a variety of pins but it seems like G24 and G11 should be the right ones.



  • @hopkapi If you connect
    G24 aka P3 -> 7
    G11 aka P4 -> 6
    GND -> 8 GND
    Vin -> 2 (5V)
    and run the LoPy from USB. then the electrical conditions shoul be OK, and the device shoudl be accessible via UART 1. SOmetimes the definition of Tx and Rx are reversed, so you may swap P3 and P4. That should not cause any harm to the devices. The UART setting according to the data sheet is baud rate: 9600, databits: 8, stopbits: 1, parity: no
    Some test code would be like:

    from machine import UART
    
    uart = UART(1, 9600)                         # init with given baudrate
    uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
    while True:
        data = uart.readall()
        if data is not None:
            print(data)
    

  • Banned

    This post is deleted!


Pycom on Twitter