Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading LAB values
#1
Photo 
Hey everyone,

I’m trying to read LAB color values from a SICK CSS/CSX sensor via a SICK SIG200 (SiLink 2) IO-Link Master using Python. SOPAS ET reads the values fine, but Python gets no response.

- Sensor on COM4, detected in Windows
- Cycle time: 3200 µs, Pin 5 deactivated (no external trigger)
- Tried listening for data & reading ISDU 0x128, 0x03, 0x04 → No response
- SOPAS ET is closed, tested baud rates (19200, 9600, 115200)

Does the sensor need an activation command or a different ISDU index? Any ideas?

import serial
import time

ser = serial.Serial('COM4', baudrate=19200, bytesize=8, parity=serial.PARITY_NONE, stopbits=1, timeout=1)

def send_request(command):
    ser.write(command)
    time.sleep(0.1)
    return ser.read(ser.in_waiting)

isdu_request = bytes([0x02, 0x00, 0x01, 0x28])  

print("Requesting LAB data...")
response = send_request(isdu_request)

if response:
    print("Raw Response:", response.hex())
    if len(response) >= 6:
        L = int.from_bytes(response[0:2], 'big') / 100
        A = int.from_bytes(response[2:4], 'big') / 100
        B = int.from_bytes(response[4:6], 'big') / 100
        print(f"L: {L}, A: {A}, B: {B}")
    else:
        print("Unexpected response length.")
else:
    print("No response received.")

ser.close()


Appreciate the help!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020