# Ignition Serial Port Not Reading Sensor

**URL:** <https://forum.inductiveautomation.com/t/ignition-serial-port-not-reading-sensor/79452>\
**Category:** Ignition\
**Created:** [September 21, 2023, 2:06pm UTC](https://forum.inductiveautomation.com/t/ignition-serial-port-not-reading-sensor/79452 "2023-09-21T14:06:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlesovsky](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@rlesovsky](https://forum.inductiveautomation.com/u/rlesovsky)\
**Post date:** [September 21, 2023, 2:06pm UTC](https://forum.inductiveautomation.com/t/ignition-serial-port-not-reading-sensor/79452/1 "2023-09-21T14:06:04Z")

</div>

I am having trouble reading a Omega PX409 serial usb sensor. I have used PuTTY to read the sensor and it returns the PSI immediately. I want to read this PSI in Ignition for a testing application. I have tried a couple ways of writing the script and both have been unsuccessful.

`Preformatted text`# Same idea as example one, but uses all available parameters.  
with system.serial.port(  
port = "COM6",  
bitRate = system.serial.BIT\_RATE\_115200,  
dataBits = system.serial.DATA\_BITS\_8,  
handshake = system.serial.HANDSHAKE\_NONE,  
hardwareFlowControl = False,  
parity = system.serial.PARITY\_NONE,  
stopBits = system.serial.STOP\_BITS\_1) as port:

```
line = port.readLine(60000)

```

this only returns empty.

`port_name = "COM6"`

```auto
#Configure the serial port
system.serial.configureSerialPort(
   port=port_name,
   bitRate=system.serial.BIT_RATE_115200,
   dataBits=system.serial.DATA_BITS_8,
   handshake=system.serial.HANDSHAKE_NONE,
   hardwareFlowControl=False,
   parity=system.serial.PARITY_NONE,
   stopBits=system.serial.STOP_BITS_1
)

```

```auto
# Try to communicate with the sensor
try:
   # Open the serial port
   system.serial.openSerialPort(port_name)

```

```auto
 # Write the command to the port
   system.serial.write(port_name, "P")

```

```auto
 # Read the response from the port
   read = system.serial.readLine(port_name, 60000, "ASCII")

```

```auto
# Print or handle the read value here
   print(read)

```

```auto
except Exception as e:
   print("Error in communication with %s: %s" % (port_name, str(e)))

```

```auto
finally:
   # Ensure the serial port is closed
   system.serial.closeSerialPort(port_name)

```

this script will give me errors on a unknown source and port time outs. I have tried increasing the time and still nothing is returned.

my PuTTY configurations are here and work perfect.  
 ![Capture3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/9/39a1a3ed08a9838000b759fba387b628e3e12446.png)  
 ![Capture4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/8/d8b06246be0ce3986f0ad486fa78328dbb01bd84.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 21, 2023, 2:08pm UTC](https://forum.inductiveautomation.com/t/ignition-serial-port-not-reading-sensor/79452/2 "2023-09-21T14:08:42Z")

</div>

Please format your code. Use triple backtick blocks or highlight your code and click the `</>` button in the editing bar.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 21, 2023, 2:15pm UTC](https://forum.inductiveautomation.com/t/ignition-serial-port-not-reading-sensor/79452/3 "2023-09-21T14:15:38Z")

</div>

> [@Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831):
>
> This thread is intended as a short help file for all those struggling to post formatted code on the forum. Posting formatted code on the forum (and most others) is as simple as selecting the code and pressing the \</\> button. It works the same as applying Bold or Italic styles to your document. It preserves indentation and applies syntax highlighting. [How to post code]

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 21, 2023, 2:30pm UTC](https://forum.inductiveautomation.com/t/ignition-serial-port-not-reading-sensor/79452/4 "2023-09-21T14:30:07Z")

</div>

> [@rlesovsky](#):
>
> system.serial.write(port\_name, "P")

Well, anyways...

This probably needs to be:

```python
system.serial.write(port_name, "P\r\n")

```
