0

I am trying to communicate with a temperature humidity readout unit, a Fluke 1620, using a Raspberry Pi Pico W. Ultimate goal is to log data and make it available on our work network. I wanted to test the UART connection but I get a null response when I run the code. Here is the code I wrote.

from machine import UART, Pin
import time

uart1 = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))

uart1.write(b'*IDN?\n')
time.sleep(0.25)
rxData = bytes()
while uart1.any() > 0:
    rxData += uart1.readline()

print(rxData)

The response I get is b'\x00'

I will admit I am pretty new to Python and haven't written a real program in many years but this in my mind should work. I've written a normal Python script very similar to this and received a response. Can anyone tell me where I'm going wrong?

DJ Rez
  • 1
  • Are you able to communicate successfully with the Fluke using a laptop/desktop and a terminal program? Is the behavior any different if you replace `\n` with `\r\n`? From reading [the docs](https://docs.micropython.org/en/latest/library/machine.UART.html), it's not clear that `uart1.any()` is useful: it might return 0 when you call it because the device has not responded *yet*. Maybe drop that for starters and just try a loop with a blocking call to `uart1.readline()`? – larsks Oct 12 '22 at 19:28
  • It works with a laptop but I think I might have found my issue. My problem is that the voltage of the rs232 isn't compatible with uart. I need an adapter. I'll try it and see if it works. – DJ Rez Oct 13 '22 at 21:25

0 Answers0