Logo Banner

Velleman K8000 - [K8000 Stand alone Usage]- [PIC Controller for the K8000]

PIC controller for the Velleman K8000

Introduction

This website has many examples on how to control a K8000 with the Standalone card FEZ Panda II. This is my favorite solution because the Panda II is very flexible. Of course there is another way to control the Velleman K8000 without a computer: by using a simple microcontroller. This page will show you how to get started.

The PIC circuit

I designed a K8000 controller for the PIC16F84A microcontroller. This controller is quite old: it was introduced mid-90's but it is still used by many hobbyists. The 16F84A is easy to program (you can program it with a home-made PIC programmer) but it doesn't have much memory and it lacks support for the I2C protocol. This poses a problem because the Velleman K8000 uses this I2C communication protocol. This means we will have to do the I2C program coding ourselves.

The image below shows the schematics for my PIC controller. As you can see the circuit is not very big. You can construct it on a breadboard in just a few minutes.

The connections SCL/SDA/GND/+5V must be connected to the connector at the side of the K8000. You should try to keep the wires as short as possible: the I2C protocol was not designed to bypass larger distances.

The software

I wrote a basic program that turns on the outputs of the K8000 one by one. Only one output is active at a time. The code below is a snip from the complete program. It gives you an idea of the outputs on the K8000.

	
      while (1) {	
        sendEffect(0b00000000,0b00000001);
        sendEffect(0b00000000,0b00000010);
        sendEffect(0b00000000,0b00000100);
        sendEffect(0b00000000,0b00001000);
        sendEffect(0b00000000,0b00010000);
        sendEffect(0b00000000,0b00100000);
        sendEffect(0b00000000,0b01000000);
        sendEffect(0b00000000,0b10000000);
        sendEffect(0b00000001,0b00000000);
        sendEffect(0b00000010,0b00000000);
        sendEffect(0b00000100,0b00000000);
        sendEffect(0b00001000,0b00000000);
        sendEffect(0b00010000,0b00000000);
        sendEffect(0b00100000,0b00000000);
        sendEffect(0b01000000,0b00000000);
        sendEffect(0b10000000,0b00000000);
      }			
    

I didn't write a complete library with software functions to control the K8000: I just wanted to create a quick demonstration on how you can control the K8000 with a PIC microcontroller.

My program contains a simple implementation of the I2C protocol. I wrote this functions but they are not optimized yet. For now you can only send information to the card's I/O chips.

Here you can download the PIC source code for the K8000 controller. The code is written in the MPLab IDE for the High-Tech C (Lite-Mode) programming language. You need a PIC programmer to program the 16F84A microcontroller. I use the cheap Olimex USB PIC programmer [External].

Copyright ©1998-2017 Vanderhaegen Bart - last modified: August 24, 2013