NSLU2-Linux
view · edit · print · history

HowTo.AddVellemanK8055USBBoard History

Hide minor edits - Show changes to markup

June 18, 2009, at 10:02 AM by Lee Kimber -- Formatting
Changed lines 22-23 from:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

to:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

Changed lines 31-33 from:
 @@ SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", \\
MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh" @@ 
to:
SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", \\
MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh"
Changed lines 38-42 from:

@@ #!/bin/sh

  1. Based on:
  2. http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
  3. Called from /etc/udev/rules.d/10-local.rules
to:

@@#!/bin/sh \# Based on: \# http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup

\# Called from /etc/udev/rules.d/10-local.rules

Changed lines 49-50 from:

udevcontrol reload_rules

to:

udevcontrol reload_rules

Changed lines 76-77 from:

timestamp;digital;analog 1;analog 2;counter 1;counter 2

to:

timestamp;digital;analog 1;analog 2;counter 1;counter 2

Changed line 84 from:

@@ Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug]

to:

@@Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug]

Changed line 106 from:
    * -debug Activate debug mode @@
to:
    * -debug Activate debug mode@@
Changed lines 110-111 from:

k8055 -reset1 -reset2

to:

k8055 -reset1 -reset2

Changed lines 116-117 from:

k8055 -P:0 -D:147 -A1:25 -A2:203

to:

k8055 -P:0 -D:147 -A1:25 -A2:203

Changed lines 124-125 from:

k8055 -A1:10

to:

k8055 -A1:10

Changed lines 128-129 from:

k8055 -A1:128

to:

k8055 -A1:128

Changed lines 132-133 from:

k8055 -A1:255

to:

k8055 -A1:255

June 18, 2009, at 09:58 AM by Lee Kimber -- Formatting
Changed line 28 from:

Create the following udev rule and added it to a new file

to:

Create the following udev rule and added it to a new file:

Changed lines 31-33 from:

SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf",
MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh"

to:
 @@ SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", \\
MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh" @@ 
Changed lines 38-44 from:

@@ #!/bin/sh\\ \# Based on:
\# http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
\#
\# Called from /etc/udev/rules.d/10-local.rules
/bin/beep -f 392.0 -n -f 493.9
\\

to:

@@ #!/bin/sh

  1. Based on:
  2. http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
  3. Called from /etc/udev/rules.d/10-local.rules

/bin/beep -f 392.0 -n -f 493.9

Changed lines 49-50 from:

udevcontrol reload_rules

to:

udevcontrol reload_rules

Changed lines 70-71 from:
  @@ k8055
\\
to:

@@ k8055

Changed lines 75-78 from:
  timestamp;digital;analog 1;analog 2;counter 1;counter 2 

Timestamp is the number of milliseconds taken to report back the output (not the number of milliseconds between data being read and program start ).

to:

timestamp;digital;analog 1;analog 2;counter 1;counter 2

Timestamp is the number of milliseconds taken to report back the output (not the number of milliseconds between data being read and program start).

Changed line 84 from:
  @@ Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug] 
to:

@@ Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug]

Changed lines 110-111 from:
   k8055 -reset1 -reset2 
to:

k8055 -reset1 -reset2

Changed lines 116-117 from:
   k8055 -P:0 -D:147 -A1:25 -A2:203 
to:

k8055 -P:0 -D:147 -A1:25 -A2:203

Changed lines 124-125 from:
   k8055 -A1:10 
to:

k8055 -A1:10

Changed lines 128-129 from:
   k8055 -A1:128 
to:

k8055 -A1:128

Changed lines 132-133 from:
   k8055 -A1:255 
to:

k8055 -A1:255

June 18, 2009, at 09:55 AM by Lee Kimber -- Formatting
Changed lines 22-23 from:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

to:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

June 18, 2009, at 09:54 AM by Lee Kimber -- Formatting
Changed lines 22-23 from:
   udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev 
to:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

Changed line 31 from:
  @@ SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", \\
to:

@@ SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", \\

Changed lines 38-42 from:
  @@ #!/bin/sh\\ 
  1. Based on:
    # http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
    #
    # Called from /etc/udev/rules.d/10-local.rules \\
to:

@@ #!/bin/sh\\ \# Based on:
\# http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
\#
\# Called from /etc/udev/rules.d/10-local.rules \\

Changed lines 49-50 from:
   udevcontrol reload_rules 
to:

udevcontrol reload_rules

June 18, 2009, at 09:52 AM by Lee Kimber -- Formatting
Added lines 1-2:
Changed lines 49-50 from:

udevcontrol reload_rules

to:
   udevcontrol reload_rules 
June 18, 2009, at 09:49 AM by Lee Kimber -- Formatting
Changed lines 20-21 from:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

to:
   udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev 
Changed lines 29-30 from:

SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh"

to:
   SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", 
MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh"
Changed line 36 from:

@@ #!/bin/sh\\

to:
  @@ #!/bin/sh\\ 
Changed line 68 from:

@@ k8055\\

to:
  @@ k8055\\
Changed lines 73-74 from:

timestamp;digital;analog 1;analog 2;counter 1;counter 2

to:
  timestamp;digital;analog 1;analog 2;counter 1;counter 2 
Changed lines 107-108 from:

k8055 -reset1 -reset2

to:
   k8055 -reset1 -reset2 
Changed lines 113-114 from:

k8055 -P:0 -D:147 -A1:25 -A2:203

to:
   k8055 -P:0 -D:147 -A1:25 -A2:203 
Changed lines 121-122 from:

k8055 -A1:10

to:
   k8055 -A1:10 
Changed lines 125-126 from:

k8055 -A1:128

to:
   k8055 -A1:128 
Changed lines 129-130 from:

k8055 -A1:255

to:
   k8055 -A1:255 
June 18, 2009, at 09:47 AM by Lee Kimber -- formatting
Changed line 80 from:

@@ Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug]

to:
  @@ Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug] 
June 18, 2009, at 09:45 AM by Lee Kimber -- More formatting
Changed lines 20-21 from:

box=%blue% udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

to:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

Changed lines 29-30 from:

SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh"

to:

SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh"

Changed lines 35-48 from:

\#!/bin/sh

\# Based on:

\# http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup

\#

\# Called from /etc/udev/rules.d/10-local.rules

/bin/beep -f 392.0 -n -f 493.9

exit 0;

to:

@@ #!/bin/sh\\

  1. Based on:
    # http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
    #
    # Called from /etc/udev/rules.d/10-local.rules
    /bin/beep -f 392.0 -n -f 493.9

    exit 0; @@
Changed lines 46-47 from:
 udevcontrol reload_rules 
to:

udevcontrol reload_rules

Changed lines 67-70 from:

k8055

499;0;128;230;9;8

to:

k8055

499;0;128;230;9;8

Changed lines 72-73 from:

timestamp;digital;analog 1;analog 2;counter 1;counter 2

to:

timestamp;digital;analog 1;analog 2;counter 1;counter 2

Changed line 80 from:

Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug]

to:

@@ Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug]

Changed lines 102-103 from:
    * -debug Activate debug mode 
to:
    * -debug Activate debug mode @@
Changed lines 106-107 from:

k8055 -reset1 -reset2

to:

k8055 -reset1 -reset2

Changed lines 110-111 from:

Now for a more existing example: k8055 -P:0 -D:147 -A1:25 -A2:203

to:

Now for a more exciting example:

k8055 -P:0 -D:147 -A1:25 -A2:203

Changed lines 120-121 from:

k8055 -A1:10

to:

k8055 -A1:10

Changed lines 124-125 from:

k8055 -A1:128

to:

k8055 -A1:128

Changed lines 128-129 from:

k8055 -A1:255

to:

k8055 -A1:255

June 18, 2009, at 09:37 AM by Lee Kimber --
Changed lines 20-21 from:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

to:

box=%blue% udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

June 18, 2009, at 09:33 AM by Lee Kimber -- formatting
Changed lines 20-21 from:

'udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev'

to:

udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev

April 26, 2009, at 06:39 PM by Lee Kimber -- Spelling
Changed lines 1-2 from:

How to Connect a Velleman K8055 USB Experimenter's/Breadkout Board to an NSLU2 running SlugOS/BE

to:

How to Connect a Velleman K8055 USB Experimenter's/Breakout Board to an NSLU2 running SlugOS/BE

April 15, 2009, at 08:18 PM by Lee Kimber --
Changed lines 1-2 from:

--How to Connect a Velleman K8055 USB Experimenter's/Breadkout Board to an NSLU2 running SlugOS/BE--

to:

How to Connect a Velleman K8055 USB Experimenter's/Breadkout Board to an NSLU2 running SlugOS/BE

April 14, 2009, at 08:42 PM by Lee Kimber --
Added line 34:
Added line 36:
Added line 38:
Added line 40:
Added line 42:
Added line 44:
Added line 73:
Added line 88:
Added line 90:
Added line 92:
Added line 94:
Added line 96:
Added line 98:
Added line 100:
Added line 102:
Added line 104:
Added line 106:
Added line 111:
April 14, 2009, at 08:40 PM by Lee Kimber -- Formatting
Changed lines 7-9 from:

1.Having the operating system recognise the board and give you access to it 2.Having an executable or library that lets you or user-applications manipulate the board

to:
  1. Having the operating system recognise the board and give you access to it
  2. Having an executable or library that lets you or user-applications manipulate the board
Changed lines 34-38 from:
  1. !/bin/sh
  2. Based on:
  3. http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
  4. Called from /etc/udev/rules.d/10-local.rules
to:

\#!/bin/sh \# Based on: \# http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup \# \# Called from /etc/udev/rules.d/10-local.rules

Changed lines 45-46 from:
  1. udevcontrol reload_rules
to:
 udevcontrol reload_rules 
Changed lines 54-55 from:

http://libk8055.sourceforge.net/

to:

http://libk8055.sourceforge.net/

Changed lines 58-59 from:

http://robin.mulloy.ca/index.php?blog=4&c=1&more=1&p=34&pb=1&tb=1

to:

http://robin.mulloy.ca/index.php?blog=4&c=1&more=1&p=34&pb=1&tb=1

Changed lines 62-63 from:

http://robin.mulloy.ca/media/blogs/a/k8055-NSLU2.zip

to:

http://robin.mulloy.ca/media/blogs/a/k8055-NSLU2.zip

Changed line 66 from:
  1. k8055
to:

k8055

Changed lines 98-99 from:

Now for a more existing xample: k8055 -P:0 -D:147 -A1:25 -A2:203

to:

Now for a more existing example: k8055 -P:0 -D:147 -A1:25 -A2:203

Added line 107:
Added line 109:
Added line 111:
Added line 113:
April 14, 2009, at 08:38 PM by Lee Kimber -- First draft: How to add Velleman K8055 USB Board
Added lines 1-116:

--How to Connect a Velleman K8055 USB Experimenter's/Breadkout Board to an NSLU2 running SlugOS/BE--

A Velleman k8055 USB Experimenter's Board allows you to control up to eight digital outputs plus two pulse-width modulated digital outputs. It allows you to read two digital counter inputs, two analog inputs.

There are two steps to being able to work with a Velleman k8055:

1.Having the operating system recognise the board and give you access to it 2.Having an executable or library that lets you or user-applications manipulate the board

Dealing with recognising the k8055 board first, plugging in the k8055's USB cable should produce a response in the SlugOS/BE's udev control system.

You can see the physical plug-in by watching the 'dmesg' command.

We need the SlugOS/BE to modify its response to plug-in to enable us to have write permissions to the k8055. To do that, we need to write a udev rule that tells udev what to do on connection. To do that, we first need to find the k8055's VendorID? and its ProductID?.

Find these parameters by running 'udevmonitor' and noting which 'usbdev#.#' number-set appears when the k8055 is plugged in. On my NSLU2, the k8055 shows up as usbdev3.2.

Once you have the usbdevice number, you can find the VendorID? and ProductID? by feeding the usbdevice number to udevinfo. Eg:

'udevinfo -a -p /sys/class/usb_device/usbdev3.2/dev'

shows the k8055 as 'Bus 3 Device 2: ID 10cf:5500'. That's vendorID '10cf 'and ProductID? '5500'. You can also acquire this information by manually working through the output of 'cat /proc/bus/usb/devices'.

With that VendorID? and ProductID? information, we can move on to the next step: writing a udev rule to set up access to the device on connection.

Create the following udev rule and added it to a new file /etc/udev/rules.d/10-local.rules

SUBSYSTEM=="usb_device", SUBSYSTEMS=="usb", ATTRS{idProduct}=="5500", ATTRS{idVendor}=="10cf", MODE="0666", SYMLINK+="k8055", RUN+="/usr/bin/k8055.sh"

On detection of the USB device by udev, this rule uniquely identifies the device using the idProduct and idVendor numbers. It then sets the access mode to 0666 (read and write access for everyone), it also creates a symbolic link /dev/k8055 (which will be usable). Finally the rule runs my 'beep' script located at /usr/bin/k8055.sh

Contents of /usr/bin/k8055.sh

  1. !/bin/sh
  2. Based on:
  3. http://www.nslu2-linux.org/wiki/Applications/DigitalCameraBackup
  4. Called from /etc/udev/rules.d/10-local.rules

/bin/beep -f 392.0 -n -f 493.9

exit 0;

To reload this new udev rule run:

  1. udevcontrol reload_rules

Now run 'udevtrigger' to simulate a reconnect so that the k8055 is picked up by the new udev rule. I found I do also need to physically reconnect the k8055 to be able to write to the board.

After these steps, you should be able to hear the NSLU2 beep when the k8055 is connected.

We can now turn to being able to operate the board.

There appear to be two ways to do this. One is via a user-space executable and the other is via a library+user-space executable written by Sven Lindberg. I haven't played with Sven's library approach and I would appreciate it if anyone who has to update this how-to with information about how that went. The code for that is available at: http://libk8055.sourceforge.net/

For my first bite at this, I took the easy way out and used Robin Mulloy's pre-compiled k8055 executable from his blog at:

http://robin.mulloy.ca/index.php?blog=4&c=1&more=1&p=34&pb=1&tb=1

The pre-compiled binary is in a zip within the zip at:

http://robin.mulloy.ca/media/blogs/a/k8055-NSLU2.zip

Simply placing this executable in the executables path on the NSLU2 makes it available. Once it is made available, simply running the command 'k8055' will display the k8055's output. It should look something like this:

  1. k8055

499;0;128;230;9;8

That output breaks down like this: timestamp;digital;analog 1;analog 2;counter 1;counter 2

Timestamp is the number of milliseconds taken to report back the output (not the number of milliseconds between data being read and program start ).

You can quickly test the effect of changing the input by pressing either of the two 'Inp1' or 'Inp2' buttons on the left of the board. Doing so should increment the final two counters by one for each press.

Now let's test writing to the k8055 board. Here it is from the horse's mouth:

Syntax : k8055 [-P:(number)] [-D:(value)] [-A1:(value)] [-A2:(value)] [-NUM:(number) [-DELAY:(number)]] [-DBT1?:(value)] [-BDT2?:(value)] [-reset1] [-reset2] [-debug]

    * -P:(number) Set board number 
    * -D:(value) Set digital output value (8 bits in decimal) 
    * -A1:(value) Set analog output 1 value (0-255) 
    * -A2:(value) Set analog output 2 value (0-255) 
    * -NUM:(number) Set number of measures 
    * -DELAY:(number) Set delay between two measure (in msec) 
    * -DBT1?:(value) Set debounce time for counter 1 (in msec) 
    * -DBT2?:(value) Set debounce time for counter 2 (in msec) 
    * -reset1 Reset counter 1 
    * -reset2 Reset counter 2 
    * -debug Activate debug mode 

Let's reset the counters first by issuing: k8055 -reset1 -reset2

which should bring both back to zero.

Now for a more existing xample: k8055 -P:0 -D:147 -A1:25 -A2:203

The board number 'P' is set by SK5? and SK6? on the board. Both closed equals a board number of 0 - as indicated on the board itself.

Feeding decimal numbers to -D such as -D:147 - will display the binary equivalent in the column of LEDs? on the right of the board. Obviously, you can take these outputs out to MOSFETs? or relays (presumably via transistor drivers) to turn appliances on and off.

The -A1 and -A2 parameters will set a simulated analog voltage at PWM1? and PWM2?. So, if you run:

k8055 -A1:10 followed by: k8055 -A1:128 followed by: k8055 -A1:255

you should see the PWM1? LED glow at three levels of brightness.

Thanks to the various people who have been involved with writing Linux-usable, and NSLU2-usable, code for the k8055.

I'm interested to hear from people who have interfaced the k8055's output with switches and who have used 'Inp3', 'Inp4', and 'Inp5'. I plan to experiment with adding MOSFETs? to the output of my k8055 and will document that once I have some results.

view · edit · print · history · Last edited by Lee Kimber.
Originally by Lee Kimber.
Page last modified on June 18, 2009, at 10:02 AM