Python code for K8056

Hi folks - you may moan in pain now - here is a n00b! :slight_smile:

I sit in a rather large company and build test panels, based on the Raspberry Pi. All programming is done in Python 2.
Someone suggested to me that i use the K8056 relay board instead of… well, something a bit more expensive!

I just can’t talk to the damn thing. I use code like this:

#!/usr/bin/env/python

import serial

# --- Open serial port---
ser = serial.Serial ('/dev/ttyUSB0', 2400, timeout = 0.5) #Default is 8N1, no need to specify
# --- Send stuff to K8056 ---
ser.write('whatever_i _want_to_send_to_K8056\r')
# --- Close port again ---
ser.close()

Has anyone tried this before? How do i make the board identify itself (code ‘D’) and how do i talk to the board afterwards, please? So far, no success…

Any help will be appreciated.

Have fun -
Kim ‘The_Pirate’

Please take a look at the VB source of the K8056 demo, this will show you how to talk to the board.
The manual also contains a protocol description.

Thank you for your very speedy reply. Unfortunately it does not help me any further.

  1. I can not install MS Win .exe files on a linux box in any meaningful way.

  2. Even if i could, i have never learned Visual Basic, and as MS seems to have abandoned all their .net stuff, any such efforts seem rather futile. Apart from the fact that i lack time, and probably never ever will get near any MS products again.
    Apart from those little unfortunate hitches, it was a very good suggestion…

  3. The protocol seems quite useful, but there is a few open ends, e.g. is the CHR$(13) a character from the MS character set, a standard ASCII character or … something completely different?

No matter what i try: no response.

Have nobody tried to run this device from a Linux box? Perhaps trough some C or C++ code or similar? Please?

Have fun everyone -
Kim ‘The_Pirate’

The latter. It is ‘\r’ or 0x0D.

Regards,
Jan

I have been stuck for a while, but i have found a solution!

The stupid thing was, the solution was right here… and has been since 2005!

There is a wiki page here. And, there is a link to it on the product description page here.

The included examples of Python scripts will, with small changes, work on… well, all platforms that can run Python.

Thanks for the help, and have fun everyone -
Kim ‘The_Pirate’