Logo Banner

FEZ - Control K8000 with FEZ

Control your K8000 with a FEZ

Introduction

It is possible to connect a FEZ with a Velleman K8000 board. Doing so you can use your old K8000 without the need of a running computer. The FEZ acts here like the old Velleman K8001 but is way more powerful: programming is done in C# instead of some restricted assembler language. As the K8001 is no longer available with Velleman, the FEZ is a nice replacement! With $40 the FEZ costs also less than the 8001 used to cost.

Connection between FEZ and K8000

The connections between the Fez Panda II and the K8000 are easy to make: you only need to interconnect the SCL,SDA and GND lines. SCL and SDA are used for the communications: Serial Clock, Serial Data. They are two lines that are connected to the +V through a pull-up resistor. Unfortunately the K8000 and the FEZ are operating on a different supply voltage: the K8000 operates on 5 VDC, while the FEZ operates on 3.3 VDC. So, some voltage adjustment is required. This can be done with a simple electronic circuit:

.

I didn't design this circuit but I found it in the I2C specifications from Philips (the company who invented the I2C protocol). The design is very easy: you need only 2 FETs and 4 resistors. The left side of this voltage adjuster is connected to the FEZ, the right side to the K8000. ( the left side should always be connected to the device with the lowest voltage, which is the FEZ). Q1 and Q2 are FETs (Field Effect Transistor). They should be handled with care during soldering as they are very sensitive to static discharges (ESD).

You can plug two JST3AA connectors onto the FEZ Panda II: there is a separate connector for the SCL and SDA lines. Each connector has 3 connections: GND (black), SIGNAL (white) and +3.3V (red). You need to connect those to the left side of the I2C voltage adjuster. The Velleman K8000 has a 5P screw terminal: there is a connection for the +5V, GND,SCL,SDA,DIS. You should connect all but the DIS to the right side of the I2C voltage adjuster. Then your K8000 is properly connected to the FEZ.

Like mentioned earlier the FEZ has some JST3AA connectors. You need the right plugs before you can make connections with the FEZ. The JST connectors are produced by JST, which stands for Japan Solderless Terminals. I bought my connectors at Farnell*. Here are the reference numbers for Farnell:

9492429 B3B-PH-K-S(LF)(SN) Connector at the PCB
3616198 PHR-3 Empty plug housing
1671245 SPH-002T-P0.5S Contacts for the housing

(*) Farnell takes orders from private users but they require you to order for a certain minimum amount of money. Alternatively you can order them at Conrad.

k8000 library for the FEZ

Now your K8000 card is connected with the FEZ, you need to create a program for the FEZ. This is quite easy as I have created a library with standard functions to control the K8000. In fact the functions are exactly the same as in the libraries that were provided with your K8000 card: I just rewrote the code from BASIC to C#, to make it work with the FEZ.

It is very easy to use my library. The sample belows show the minimal code to generate a simple light effect where the outputs LEDs are one by one activated:

Minimal code to output the LEDs

Advantages over the K8001

Using the FEZ instead of the K8001 offers you a lot of advantages. First of all the FEZ can be programmed very easily. But the FEZ also has an RTC clock, an microSD card reader, an Ethernet connection, ... Basically you can use it to do whatever you want.

DISCLAIMER

This code is provided to you as it is. You can use it for free, but there still might be errors in the code. I advise you to do some tests before you use my code to control critical applications.

Download C# Library

Developed in: Visual C# 2010 Express
Download type: C# file (.CS file)
License: Freeware
Size: 311 kB
Source code: Available
MD5 Checksum: 036cae196de44f99dc641e0030cfff39

Download C# Sample project

Developed in: Visual C# 2010 Express
Download type: Zipped Source
License: Freeware
Size: 8 kB
Source code: Available
MD5 Checksum: 090a79bf3b2567f2eaac3da804880bcf

Copyright ©1998-2012 Vanderhaegen Bart - last modified: February 08, 2012