Velleman K8055 IO board misterhouse glue
The next device I added to my misterhouse proxy running on my router is the Velleman K8055 IO board. This is a USB powered experimental IO board with 8 outputs, 5 inputs, 2 DAC outputs and 2 analog inputs. I used the k8055 openwrt kernel module from the sourceforge project homepage.
I have compiled the module myself because there was no package available for the openwrt kamikaze 8.09 release, if you need it you can download it here so you don’t need to install the buildroot etc.or you can install the package directly.
opkg install http://blog.export.be/downloads/kmod-k8055d_0.1.2_2.4.35.4-brcm-2.4-1_mipsel.ipk
opkg install kmod-usb-uhci-iv
Like you can see I also installed the kmod-usb-uhci-iv package which was needed for the module to work. If all went well you now a /proc/k8055/0 directory with a file for every input and output. By reading or writing to these files you can read or write values to the board.
Next I wrote some misterhouse code to create misterhouse items for all the IO and the read and write commands to interface the files. Here is my code :
$k8055_out1 = new Generic_Item;
$k8055_out2 = new Generic_Item;
$k8055_out3 = new Generic_Item;
$k8055_out4 = new Generic_Item;
$k8055_out5 = new Generic_Item;
$k8055_out6 = new Generic_Item;
$k8055_out7 = new Generic_Item;
$k8055_out8 = new Generic_Item;
$k8055_in1 = new Generic_Item;
$k8055_in2 = new Generic_Item;
$k8055_in3 = new Generic_Item;
$k8055_in4 = new Generic_Item;
$k8055_in5 = new Generic_Item;
$k8055_out1 -> set_states (‘aan’,'uit’);
$k8055_out2 -> set_states (‘aan’,'uit’);
$k8055_out3 -> set_states (‘aan’,'uit’);
$k8055_out4 -> set_states (‘aan’,'uit’);
$k8055_out5 -> set_states (‘aan’,'uit’);
$k8055_out6 -> set_states (‘aan’,'uit’);
$k8055_out7 -> set_states (‘aan’,'uit’);
$k8055_out8 -> set_states (‘aan’,'uit’);
if ($state = state_changed $k8055_out1){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out1′,1);
}
else {
file_write(‘/proc/k8055/0/out1′,0);
}
}
if ($state = state_changed $k8055_out2){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out2′,1);
}
else {
file_write(‘/proc/k8055/0/out2′,0);
}
}
if ($state = state_changed $k8055_out3){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out3′,1);
}
else {
file_write(‘/proc/k8055/0/out3′,0);
}
}
if ($state = state_changed $k8055_out4){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out4′,1);
}
else {
file_write(‘/proc/k8055/0/out4′,0);
}
}
if ($state = state_changed $k8055_out5){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out5′,1);
}
else {
file_write(‘/proc/k8055/0/out5′,0);
}
}
if ($state = state_changed $k8055_out6){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out6′,1);
}
else {
file_write(‘/proc/k8055/0/out6′,0);
}
}
if ($state = state_changed $k8055_out7){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out7′,1);
}
else {
file_write(‘/proc/k8055/0/out7′,0);
}
}
if ($state = state_changed $k8055_out8){
if ($state eq ‘aan’) {
file_write(‘/proc/k8055/0/out8′,1);
}
else {
file_write(‘/proc/k8055/0/out8′,0);
}
}
my $input;
if ($New_Second){
$input = file_read(‘/proc/k8055/0/in1′);
set $k8055_in1 $input;
$input = file_read(‘/proc/k8055/0/in2′);
set $k8055_in2 $input;
$input = file_read(‘/proc/k8055/0/in3′);
set $k8055_in3 $input;
$input = file_read(‘/proc/k8055/0/in4′);
set $k8055_in4 $input;
$input = file_read(‘/proc/k8055/0/in5′);
set $k8055_in5 $input;
#print_log “Input 1 is now $input1″;
}
Handles for the DA and AD ports are not yet implemented because I don’t use them for the moment.
Update : I just finished doing the same setup on a NSLU2 . I compiled the k8055 module via the buildroot for the ixp4xx harware. The only difference was that I had to use the kmod-usb-ohci_2.6.28.10-1_ixp4xx.ipk module instead of the uhci one. If anyone needs tha packages for the Linux OpenWrt 2.6.28.10 #2 armv5teb GNU/Linux NSLU2 harware let me know.
March 23rd, 2009 at 14:08
[...] bits4life Bits and bytes for your daily life. « Velleman K8055 IO board misterhouse glue [...]