I didn’t have this project on the blog in 2008, I copied it from the old CMS in 2015.

Looks like the day it was made -- except for the cable

Looks like the day it was made — except for the cable

A ‘hammered dulcimer’ is a musical instrument, its german name is ‘Hackbrett’. But you also can loosely translate ‘Hackbrett’ to ‘hackboard’, which I think is a great name for this kind of keyboard. A funny fact on the side is, that the name ‘Dulcimer’ originates from the latin ‘dulce melos’, which means ‘sweet sound’. If you ever heard someone type away on a Model M, you know why I chose this name… ;-)

A computer keyboard can be a very personal utensil. Especially if it is an extraordinary well built one, like for example the IBM Model M. The Model M design dates back to 1984, but it still has many fans even nowadays. It came with the usual keyboard connectors. First the old 5-pin one, later a PS/2 plug. Unfortunately is that, at least to my knowledge, they never released a version with USB.

A friend of mine knew that I already had built other USB-devices, and one of them even acted as a keyboard (it isn’t really a keyboard, but that’s a different story… ;-) ). He is a big fan of the Model M, so he asked if I could put new life in one of his old keyboards, which had a broken circuit inside. And this is the result…

Hard- and Software

A first prototype

A first prototype

The main part of a computer keyboard circuit is the key matrix. You can imagine it as a number of keys, placed on a raster of horizontal (rows) and vertical (columns) wires. In the case of a Model M keyboard, we have a matrix of 8×16 lines. Eight columns in 16 rows, or the other way around, depending on how you look at it. Each key is connected to one column and one row. If you press the key, it will connect the column and the row on it’s crossing of the lines.

Connected to this matrix is a keyboard controller. That’s a chip with a number of I/O-lines to detect the state of the matrix, and on the other side an interface that enables it to talk to the computer. Oh, and not to forget: it also has three output lines to drive the LEDs for Num-, Caps- and Scroll-lock.

What I did in this project is, that I dumped the keyboard controller chip and its circuit, and replaced it by an ATmega32 and my own circuit. The ATmega scans the matrix for keyboard activity, controls the LEDs and talks to the computer.

For further convenience, I added a boot-loader. With that, it is possible to update the keyboard’s firmware without disassembling it, and without the need for a dedicated programmer.

Other Hardware?

Antique

Antique

As mentioned, the controller in this project is just connected to an ordinary keyboard matrix. You can find this kind of matrix in all kinds of keyboards, from key-telephones over good old hardware like the Commodore C=64 or the Schneider CPC, keyboards with non-PC-connectors like those made by Sun, to modern hardware that could need a few more features.

Till now, I just made a PCB layout for the IBM Model M, but I intend to modify at least a Sun keyboard. In order to do that, I expect having to refactor the key-scanning, since the key-matrix is not 16×8. The positions of the keys on the matrix will be different, I’ll have to re-engineer that. And of course, I’ll have to make another PCB.

Features

Powered by Kicad

Powered by Kicad

At the moment, the keyboard should be able to do everything that the average off-the-shelf-keyboard can do. But there are many features that are possible, regarding the fact that the ATmega32 is absolutely bored till now. You can think of ‘magic keystrokes’ that turn some hidden features on or off, like for example:

  • send complete phrases on one keystroke
  • ‘autofire’ feature on keys that don’t repeat normally, for example Alt+F4
  • change keyboard layout without reconfiguring the computer
  • turn bouncing keys on or off, to annoy other people using your computer
  • random caps lock function
  • use arrow keys as mouse, without having to include a special driver in the OS.

With a little tweaking on the hardware side, there should be even more possibilities:

  • turn the oldtimer-keyboard into a supermodern wireless bluetooth one
  • implement keylogger-funktionality, using for example an SD-card
  • include an USB-hub into the keyboard

If you are just a little like me, it won’t take you much brainstorming to come up with own useful — or even better: useless — ideas. ;-)

Usage

Connect the keyboard to the USB-port. All LED should flash up to indicate that the device is initialized.

Then you can use the keyboard as always. If additional features get implemented, you will be able to use them in their respective ways.

Drawbacks

I don’t know if and how keyboard manufacturers face the problem of ghost keys, I didn’t take special measurements for this. I hope that the engineers at IBM distributed the keys on the matrix in a way that minimizes this problem. Don’t misunderstand: I haven’t experienced that on this keyboard, but I know that it’s a common problem on key-matrixes.

Thanks!

Modern oldtimer

Modern oldtimer

I’d like to thank Objective Development for the possibility to use their driver for my project. In fact, this project wouldn’t exist without the driver.

I took great inspiration from Spaceman Spiff’s c64key, this software is based on his ideas.

Further credits go to xleave, who etched the PCB for me, and also answered many stupid questions about electronics I had during the last few years.

And of course I’d like to thank FaUl of the Chaostreff Dortmund who gave me the idea for this project.

About the license

My work – all contents except for the USB driver – is licensed under the GNU General Public License (GPL). A copy of the GPL is included in License.txt. The driver itself is licensed under a special license by Objective Development. See firmware/usbdrv/License.txt for further info.

Download

See also…

  • clickykeyboards.com – dedicated to IBM Model M
  • RUMP – practically the same project, a parallel development
  • Geekhack – protoboard version, based on Dulcimer

This text hasn’t been in the blog in 2006, I copied it from my old CMS in 2015.

... and you'll never have to search for your cursor again!

… and you’ll never have to search for your cursor again!

The USB-Servo is a device to control a servo via USB. A servo is a motorized device that is commonly used in remote controlled cars and planes. I built this device to activate a toy puppet. The puppet has a button on its bottom, if you press the button the puppet collapses. When the computer is able to press the button, I can use the puppet to signal information like someone’s online-state in the Jabber-network: when my friend goes online, the puppet stands up, when he logs off it collapses.

Servos are connected with three-wire-cables. A red and a black one for the power, and a yellow one for the signal. Power has to be between 4.8 and 6 volts, so the 5 volts from the USB-port is in the range. The signal doesn’t take much current, so you can connect it directly to the controller. The angle of the servo is controlled with pulse width modulation (PWM). It gets a signal of about 50Hz (one pulse every 20ms), the length of the pulse tells the servo the angle to adjust.

A problem that I didn’t really solve is the power consumption: I don’t know the current that runs through the motor. It seems to be low enough not to cause any problems, but I don’t know how high it will get when the servo is blocked. YOU HAVE BEEN WARNED, I don’t feel responsible for USB-ports catching fire… :-/

The circuit contains only a few standard components. There's no special USB-chip involved.

The circuit contains only a few standard components. There’s no special USB-chip involved.

There are three parts included in the distribution: The firmware for an ATmega8 microcontroller, a commandline-client that can be run under Linux, and the circuits needed to build the device.

This project is based on my USB-LED-Fader, which itself is based on the PowerSwitch example application by Objective Development. Like those, it uses Objective Development’s firmware-only USB driver for Atmel’s AVR microcontrollers.

Objective Development’s USB driver is a firmware-only implementation of the USB 1.1 standard (low speed device) on cheap single chip microcomputers of Atmel’s AVR series, such as the ATtiny2313 or even some of the small 8 pin devices. It implements the standard to the point where useful applications can be implemented. See the file “firmware/usbdrv/usbdrv.h” for features and limitations.

Building and installing

The installation is described in the documentation.

Usage

Connect the device to the USB-port. If it isn’t already, the servo will move to the 0-position.

Then use the commandline-client as follows:

Parameters

  • angle: The angle you want to set the servo to. 0 is full left, 255 is full right.

Examples

Get the status of the servo

This will tell you the angle the servo is currently put to.

Set a new angle

This sets the servo to the angle 23. 0 is full left, 255 is full right, so with 23 the servo will be almost on the left side.

Test the device

This function sends many random numbers to the device. The device returns the packages, and the client looks for differences in the sent and the received numbers.

Demo application xservopointer

Behind the scenes

Behind the scenes

This is a pure fun thing, nobody will need it. That was reason enough to write it…

To use it, you have to position the servo centered above the screen (with a little tweaking in the source, you can change that position). Then, you attach a pointer to the servo and start the application.

You’ll never ever have to search for your mouse cursor in the future. The pointer on the servo will always show you where to search.

Drawbacks

The main drawback is the mentioned power consumption. I tested it with my servo on my notebook, it is not sure to work on other systems. THIS MAY BE HARMFUL FOR YOUR COMPUTER, and nobody but yourself will be responsible for any damages.

Another, not so big problem is the crude implementation of the PWM. I got the timing-values by trial and error, and they might not fit on your servo. On the other hand, I think that servos should be interchangeable. But this is my first and only one, so I can’t say anything about that.

Thanks!

I’d like to thank Objective Development for the possibility to use their driver for my project. In fact, this project wouldn’t exist without the driver.

About the license

My work – all contents except for the USB driver – is licensed under the GNU General Public License (GPL). A copy of the GPL is included in License.txt. The driver itself is licensed under a special license by Objective Development. See firmware/usbdrv/License.txt for further info.

Download

This text hasn’t been in the blog in 2006, I took it from my old CMS in 2015.

The device in action.

The device in action.

The USB-LED-Fader is a device to control a number of LEDs via USB. I built it to display the online status of my internet connection, the recording status of my video recorder (VDR), and warnings if the available disk-space is low. You can imagine an endless number of applications for this.

The LEDs are controlled with pulse width modulation (PWM). That way, they are not only on or off, it is possible to control the brightness. Included in the device are a number of ‘waveforms’ that can be displayed through the LEDs. That way, one LED can display some kind of a sine- or triangular wave without any interaction with the controlling host.

Every LED can be controlled individually; each one can display its own waveforms.

You can assign three different waves to every LED. The first two (0 & 1) are ‘eternal’ waves. They are displayed alternating until anything different is required. The third wave (2) is only displayed once; afterwards the device will switch back to alternating between the first two waves.

They are displayed alternating until anything different is required. The third wave (2) is only displayed once, afterwards the device will switch back to alternating between the first two waves.

One wave is described by three parameters: the waveform, the duration for one repetition of the wave and the number of repetitions before switching to the next wave.

This version supports four LEDs. It should be quite easy to change that number to between one and eight. I have not tested any number greater than four, but I can imagine that the load on the controller may be too high to reliably communicate via USB.

There are three parts included in the distribution: The firmware for an ATmega8 microcontroller, a command line client that can be run under Linux, and the circuits needed to build the device.

This project is based on the PowerSwitch example application by Objective Development. Like that, it uses Objective Development’s firmware-only USB driver for Atmel’s AVR microcontrollers.

Objective Development’s USB driver is a firmware-only implementation of the USB 1.1 standard (low speed device) on cheap single chip microcomputers of Atmel’s AVR series, such as the ATtiny2313 or even some of the small 8-pin devices. It implements the standard to the point where useful applications can be implemented. See the file “firmware/usbdrv/usbdrv.h” for features and limitations.

Building and installing

The circuit contains only a few standard components. There's no special USB-chip involved.

The circuit contains only a few standard components. There’s no special USB-chip involved.

The installation is described in the documentation.

Usage

Connect the device to the USB port. All LEDs should flash up to indicate that the device is initialized.

Then use the command line client as follows:

When using the set function, it is possible to define several waves at once. You simply have to give the parameters for all waves. See examples below.

Parameters

  • ledId: ID of the LED (0-n, depending on the number of LEDs in your circuit).
  • waveId: ID of the wave (0-1: constant waves, 2: override).
  • waveformId: ID of the waveform (0-31: brightness, 32-37: patterns). For a reference to the patterns, use the show function.
  • periodDuration: Time in sec/10 for one repetition of the waveform. A value of 0 can be used to reset the wave.
  • repetitionCount: Number of repetitions before switching to the next wave. A value of 0 can be used to repeat this forever.

Examples

Get the status of all LEDs

This will result in output similar to this:

In this output, the values curvalue, curpos, nextupd and updtime are for debugging purposes only. They shouldn’t be of interest to the common user. The meaning of the other values should be clear.

Set the first LED to keep a moderate brightness

So, on LED 0 the wave 0 is set to waveform 15. It will stay there for one second and will be repeated once before switching to the next wave. There is no next wave because we didn’t define one, so this waveform will stay forever.

Now set a second wave on the first LED, a little brighter than the one before

This is wave 1 on LED 0. Waveform 25 has been defined as a constant level of brightness. After setting the second wave, it will alternate with the first one after every second, because both waves have the same duration and the same number of repetitions.

Set a third wave on the first LED

This sets the third wave (wave 2) on the first LED. Waveform 36 is a nice sine-like wave, so the LED starts to fade. One period of the fading takes 2 seconds, it is repeated for 5 times. Since this is the third wave, after the repetitions the LED returns to alternating between wave 0 and wave 1, this wave is discarded.

Set multiple waves at once

This will set all of the above waves at once. Thus, the first LED will first fade the sine-wave five times, then start alternating between the two brightnesses in one-second-rhythm.

Clear the first LED

This will clear all three waves on the first LED.

Reset the device

All LEDs will flash once, to indicate that the device is reset and the LEDs are working.

Show a waveform on the screen

This will lead to an output like the following:

Keep in mind that the width of the displayed wave corresponds to the length of the waveform. If you display a very simple one like the constant brightness levels (0-31), the length is 1. Therefore only one column is displayed.

Test the device

This function sends many random numbers to the device. The device returns the packages, and the client looks for differences in the sent and the received numbers.

Drawbacks

I know that I could have soldered that in a more beautiful way... ;-)

I know that I could have soldered that in a more beautiful way… ;-)

As mentioned above, controlling the PWM for several LEDs is a lot of work for one small microcontroller. So is speaking the USB protocol. Together, these result in a lot of load on the device, so the communication with the device is not 100% reliable. More than 99%, though, at least in our tests.

SO BE WARNED: You should not use this device to control the state of your nuclear reactor. If you intend to use it in that way despite of this warning, please let me know… ;-)

Thanks!

I’d like to thank Objective Development for the possibility to use their driver for my project. In fact, this project wouldn’t exist without the driver.

And I’d like to give special credit to Thomas Stegemann. He wrote the PWM-stuff, and I guess it would have been nearly to impossible to me to write the rest of the project without his help since C isn’t my natural language. ;-)

About the license

Our work – all contents except for the USB driver – are licensed under the GNU General Public License (GPL). License.txt is a copy of the GPL. The driver itself is licensed under a special license by Objective Development. See firmware/usbdrv/License.txt for further info.

Download