Hi!
It’s been a while since I gave myself time to experiment with electronics… Well, now I did some experimenting with Vellemans K8056.
When you have soldered all the components and the hardware is ready, it is easy to test the K8056 using the onboard “Test” button. When pressing the button the eight relays should step through 1 to 8.
After that comes the trickier part…
My idea is to attach this card to either an Android stick such as the CX01 or to a hacked router running OpenWrt. This does it hard to use the Linux and Windows programs written for it. If you want to run the K8056 from a Linux computer the code is accessible here. The implementation is supposed to be online 24-7 in my family summerhouse doing monitoring and automation.
The K8056 card does not reveal a life sign (apart from the power LED) until it receives the right command sequence and it took me some sincere research to find out those secrets.
The manual from Velleman describes the commands but is in this aspect not very clear. For me the confusion was total after a while. Read for your self:
Technical Description
- Port RS232 is configure with this setting: 2400/8/n/1
- To control the k8056 card, the correct sequence needs to be send like this:
- Ascii code 13
- card address (1..255)
- Instruction (see below)
- Address (1..255), relay #(‘1’..’9′) or 0 (for -E|-D|-F commands)
- checkum, it is the 2-complement of the sum of the 4 previous bytes + 1.
- Instructions:
- ‘E’: Emergency stop all cards.
- ‘D’: Display address of all cards in a binary fashion (LD1:MSB, LD8:LSB)
- ‘S’: Set a relay, followed by relay # (‘1’..’9′ in ASCII), 9 for all relay.
- ‘C’: Clear a relay, followed by relay # (‘1’..’9′ in ASCII), 9 for all relay.
- ‘T’: Toggle a relay, followed by relay # (‘1’..’8′ in ASCII).
- ‘A’: Change the current address of a card, followed by the address (1..255)
- ‘F’: Force all cards address to 1 (default)
- ‘B’: Send a byte, Allows to control the 8 relays in 1 byte (LD1:MSB, LD8:LSB)
Imagine you want to send a command to set all relays on the card with address 1. That would give the following ASCII sequence:
13 1 83 57 102
The ASCII codes 13 & 1 does not have readable representations.
The last digits (102) is a calculated value and have to be the two’s complement sum of the rest. It works like a checksum for the RS232 transmission. First you have to know how to calculate the two’s complement sum. I did not! So if you are like me you’ll be glad to know that it is done like this:
(In decimal now)
checksum = 255-(13+1+83+57)+1
Finally you have to convert the sequence to hexadecimal before you send it. In hex that gives:
0D 01 53 39 66
I don’t know if I am on the right track, but I prepared some files containing raw hex data. In that way i can simply dump those files on the serial interface whenever I want to switch relays on or off thus saving me some scripting in the controlling hosts.
If you should have use of such files, please find them here. They are coded with a card address of one.
My site do not allow me to add .zip files so you have to rename the file to .zip after you have downloaded it. Then you simply unzip the archive.