To prevent misunderstandings: this says that it's not a mediaeval toilet.

To prevent misunderstandings: this says that it’s not a mediaeval toilet.

This article wasn’t on the blog in 2011. I took it from my old CMS in 2015.

I built this photo booth for our wedding in summer 2010.

I can’t remember where I got the idea, I guess I saw something similar somewhere on the net. After everything else for the ceremony was set I had some time to spend. And this idea…

Hardware

Manual

Manual

I had most of the needed material at home. Enough wood, a cloth for the curtain, an unused notebook. And a test circuit I built for my USB-projects. I just had to acquire a webcam, a push button like it’s used in moist rooms (how do you call that in english?) and two fluorescent tubes.

Unfortunately, I forgot to take a picture of the entire booth. It was basically a large box made of oriented strand board, about 2.20m high, 1.20m wide and 1m deep. On one side was the entrance, closed by a thick brown curtain. Inside there was a bank, opposed to it the technology.

Visible there were two simple tubes for the light, a rectangular section with a screen, a small round hole with a lens and said moisture-proof switch.

Hidden behind the wall were an IBM Thinkpad T43 along with a power supply, a Logitech Webcam Pro 9000 and some electronics.

I built this circuit since I didn’t want to make the same USB-interface over and over again on breadboard. It is essentially the same circuit as in my USB LED fader, the USB servo or my Dulcimer Keyboards. An ATmega8 microcontroller and some bird seed for the USB interface, at the other end a pin header to interface all unused pins of the controller on the breadboard.

The box was not built to last forever, so I just had two of the pins connected to terminal cables to the push button.

Software

The circuit is the same as the USB-Servo

The circuit is the same as the USB-Servo

In this project there are two important software components: the photo booth program on the laptop and the firmware on the controller.

The notebook was easy to equip. First I wanted to write a program myself, but after a short search I found something that does exactly what I wanted: Cheese. This is basically a photo booth. You press the space bar, then the program takes four images, at intervals of a few seconds. Simple and perfect.

The microcontroller was not quite as trivial to program, but I already had the solution in the drawer. With a slightly adapted Dulcimer firmware, the circuit behaves just like a simple USB keyboard. I just had to see in the schematic which pins I had to connect to create a space key.

:arrow: In combination with the moisture-proof push button I probably had the only wet room space bar in the world! ;-)

The combination worked perfectly: you go into the box and see the large display. After pressing the button, there were four consecutive pics taken, each with a short countdown.

The pictures end up in a directory and each has the recording time in the file name. That allows to rearrange the pics with a nice one-liner, so the result is a big picture with the full series of four images:

Results

Box of Fools

Box of Fools

I had assured that I would not put the images into the net, so there is only one unrecognizable example. The names of people and the original contents of the bottle are withheld. :-)

The quality has really surprised me. The camera makes really sharp and detailed images, and the fluorescent lights illuminated everything pretty evenly.

The box was used at the wedding-eve party and at the actual wedding. From the eve we’ve got more than 500 images, from the wedding even more than 800. Almost all the guests have found their way into the box, most of them repeatedly. And in packs: on some pictures we see at least seven people at once…

The curtain has proven to be a terrific feature. On many of the pictures you can see that the people did not expect that we can see the pictures lateron… ;-)

We are happy about each image. By means of that box, and above all the spontaneity of our guests, we have truly unique memories of one of the best days of our lives. Thanks again to all who joined us!

I didn’t have this article on my blog in 2009, it came over from my old CMS in 2015.

Test circuit on breadboard

Test circuit on breadboard

This project turns an AVR ATmega8 microcontroller into a LED controller for a matrix of 8×8 LEDs. The controller is acting as I2C-slave, so you can control the patterns to display via this bus (also known as TWI, Two Wire Interface).

Purpose

For my next project, I need to display number values on seven-segment-displays. I bought a bunch of 4-digit-displays a while ago, now I’m going to put them to a use. They are built with four digits in one case, and 12 pins on the underside. Eight of them are the cathodes of the segments (seven segments plus dot), four are the anodes. One for each digit.

You can imagine these modules as a matrix of four times eight LEDs, as can be seen in the included circuit. I use two of these, so I have a matrix of eight times eight LEDs.

The rows and columns of this matrix are connected to the microcontroller, so it can power them row by row. This has two advantages: at first a maximum of eight LEDs is powered at a time, so power consumption is lowered. And at second you need only 16 pins of the controller to address a total of 64 LEDs.

Driving the LEDs in this way makes them flicker a bit, but the controller is fast enough to keep the flickering way above the level you would be able to recognize.

I could have connected my display modules directly to the main controller of my next project, but I don’t have enough free pins on that. As a further benefit, multiplexing the LEDs on a second controller makes the main program easier to write, since I don’t have to mind the timing. So the solution is to use a cheap ATmega8 as LED driver and use the I2C-bus to tell it what to display.

I2C communication

The ATmega8 has a built-in hardware I2C-interface, so it doesn’t take very much code to use it. Nevertheless, I used a little library that Uwe Grosse-Wortmann (uwegw) published on roboternetz.de. I only reformatted it a bit to make the code resemble my style. It is well commented, but the comments are in german. Since only one global array, one init-function and an interrupt service routine are used, it shouldn’t be too hard for english-speaking people to figure out how it is used.

Usage

On the other end of the communication, I used the excellent Procyon AVRlib written by Pascal Stang. You can find it here.

The Circuit

The Circuit

Note: the buffer doesn’t contain any numbers that should be displayed on 7segment-displays. At least not in this example. It only holds bit-patterns.

Displaying numbers

If you solder 7segment displays to the unit and intend to display numbers or characters on it, you need to define them on the master-side of the bus. I didn’t include the definitions in this library because I want the master to have the full flexibility of displaying whatever it wants to, even if it are no numbers.

However, if you are going to use 7segment displays, definition of the numbers still depends on how you soldered them to the controller. I don’t know if the pin-outs are commonly standardized.

To give an example of how you would implement this, here is a fragment of code that defines hexadecimal numbers for usage on my displays:

Drawbacks

Till now, the device worked in all situations I tested it in. So far everything is fine.

Thanks!

I’d like to thank the authors of the libraries I used: Uwe Grosse-Wortmann (uwegw) for the I2C-slave and Pascal Stang for the Procyon AVRlib.

About the license

My work is licensed under the GNU General Public License (GPL). A copy of the GPL is included in License.txt.

Download

This text wasn’t part of the blog in 2009, I copied it from my old CMS in 2015.

My etching tank

My etching tank

Somehow I resisted to etch my own printed circuit boards for years. As I now know, I had no reason: it’s not as hard as I thought it would be. Having the right equipment helps with many things, so it does in this case. After having evaluated the whole process, one of the hardest things is to take off the rubber gloves after handling the chemicals…

Preparing the layout

One of my first own layouts

One of my first own layouts

Before creating the board, one has to create a proper layout from the circuit.

Many people use Eagle CAD for this job. It’s a great tool, but the free (as in beer) version has the handicap that it can only do layouts for half euro cards (that’s 8x10cm). You can do a lot of things on that amount of space, but at least for my Dulcimer project I needed more.

Meanwhile, I got used to KiCad. The usability is even worse than Eagle’s, but if you take your time and if you are kind to the program, it gives nice circuits and board layouts to you in return. And the killer advantage: it’s free software.

Exposure

Exposing the photo sensitive material is a bit tricky. I tried several methods, and I think I reached what I consider to be the optimum.

First the layout has to be printed. I made my first tries with simple paper, printing with my Laserjet 5. After not seeing any results on the boards, I tried coating the paper with oil to make it more transparent. Using a nitraphote lamp it would probably work with an exposure time of 50 minutes or so, but that seemed to be too long in my opinion. I got really good and quick results with overhead slides. With my first tries, I put two prints on top of each other, later I found that to be unnecessary, one layer is enough.

There’s even more choice with the source of light. What didn’t work at all was a 500W halogen lamp. Other people had more luck with that, but I guess that mine has a safety glass that blocks UV light.

A better solution would be the 250W nitraphote bulb that I acquired just for this reason. It’s a standard bulb with an E27 thread, but it delivers more UV than a normal lamp would. Unfortunately, 250W tend to be very hot after a while, and I almost ruined my kitchen lamp trying to expose through a layout printed on paper. After all, using the overhead sheet made really good results after an exposure time of 10 minutes in a distance of 15cm.

The best solution seems to be a facial tanner that I bought for 1,50 Euros — about a quarter of what I paid for the nitraphote lamp. It’s a Philips HB170, it has four tubes with 15W each. I turn it on for a few minutes, so the tubes are pre-heated. Then I put it face-down on two pieces of wood that are 3cm thick. Beneath it the stack consisting of the photo sensitive board, the printed layout and a glass plate. I turn the tanner on for two minutes and get great results — without risking to set the room on fire.

Etching

My first PCB

My first PCB

Surely, you can etch your boards in a simple lab dish, it shouldn’t affect the results much. But I didn’t like that method already on my first tries. Especially since it is everything but easy to maintain the temperature in the etching solution to be arount 50 degrees Celsius.

So I built my own etching tank. It was the cheapest solution since I already had some of the parts from my fish tank hobby. The etching tank consists of:

  • some sheets of glass
  • silicone
  • aquarium heater
  • aquarium glass thermometer
  • aquarium air pump
  • aqua-curtain air diffusor
  • air hose
  • parts of a cable channel (?) that hold the air diffusor and the board in place
  • a plastic container to put underneath the whole thing, since this is the first time I ever glued glass…

The tank holds about one liter of etching solution (natrium persulfate). The size fits quite exactly for one full euro card (16x10cm), the process takes about 10 to 15 minutes.

I am more than happy with the results. I didn’t make any detailed tests yet, but till now I found all the fine structures on my boards that I wanted to be there.

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

The module

The module

Well, the name is a bit too big for a project as little as this, but I couldn’t think of anything better at that moment.

It is a little circuit you can use on your bread-board. Most microcontroller-projects run at 5V, but cheap power supplies lack this setting. So the first step in building a circuit on a bread-board is building the power supply. Over and over again.

This is not much fun, so I built this circuit to use it ‘en bloc’. After building it, I thought of inserting another diode to prevent wrong connection to the power supply. Too late for me, but you should put one in if you build one of these.

I created the label using Eagle, even if it is not derived from the circuit I used. Anyway: It’s in the downloadable package.

Plagiarism?

The circuit

The circuit

At first I didn’t want to release this to the public. But after finding a link to a similar project in the Make Magazine — it’s on Instructable, and a detailed step-by-step guide to a circuit like this at SparkFun I did.

I just can say: I did it before I saw the other articles. :-)

I suppose the idea is simple enough for anybody to have it…

Download

See also…

  • SparkFun – detailed description of a similar project
  • Instructables – step-by-step-description of a similar project

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

The new adapter

The new adapter

The common programmer-adapters for AVR-controllers come with a ten-pin connector that is connected to the target circuit. Why the thing has to have ten pins, I don’t understand. Four of them are connected to the ground, and one isn’t connected at all. So effectively there stay six pins that are really solving a purpose.

The problem

When developing a prototype on a breadboard, it is not really possible to connect the ten-pin connector on it. I built myself some kind of an adapter cable to connect every pin onto the board.

As you can see, it’s really ugly and not quite stable. Plastic parts are getting weak during the soldering-process, and they are not really stable.

The solution

The adapter at work

The adapter at work

To make it a bit more elegant, I made this little tool. I printed the pin configuration using Eagle CAD. You can find the required file in the end of this page. So I just have to consider the controller’s documentation for the pin-settings, not for connecting the ISP-adapter to it.

Beneath the printed cardboard, there is a simple circuit board. Otherwise there is a ten-pin connector for connecting the ISP-adapter, and a six-pin connector that is attached to the breadboard. I pressed the pins until they are almost fully beneath the board, so it fits tighter to the breadboard.

Oh, and the wires on the board’s lower side are painted. And not soldered really niceliy, but the mainthing is: it works!

Download

The assembled clock

The assembled clock

In Germany, the official time is transmitted in a signal called DCF-77. You can find many descriptions of the signal format on the internet.

The Binary DCF-77 Clock is a simple device to receive and decode the signal and display the current date and time in binary form. The signal is received in a stock DCF-77 receiver module, decoded with an ATmega8 microcontroller and displayed in binary form on an array of LEDs. This array consists of for lines with eight LEDs each. The ATmega8 is not able to control 32 LEDs at once, so an SAA1064 module is used which is connected via I2C-bus.

The time should be displayed in several different binary formats, the format can be selected with a simple button. The formats will be described later.

The distribution contains the firmware for the controller, the schematics, the documentation and a copy of the GPL license.

Building and installing

The circuit is not too complicated

The circuit is not too complicated

The installation is described in the documentation.

Usage

Connect the device to a DC power source with 9V. As long as no time has been decoded, a running light is shown on the output LED array. The single DCF indicator LED should start flashing to indicate that a signal is received. It is set to on when the input signal is high, and switched off if the signal is low. So you should see it flashing with one flash per second, each flash being 100ms or 200ms long.

If the signal is received correctly, after about two minutes the clock should be able to tell the correct time.

Reading the time

The different modes

The different modes

The time and date are displayed in seven different styles. You can select the style by pressing the button for a while. A pattern of lights indicate which mode is selected, you can read it as a binary value.

Mode 1: Time as binary

This simply displays the hours, minutes and seconds as bytes, one after each other. The fourth line of the display stays blank.

Mode 2: Date as binary

This is like the previous, with the difference that it displays the day of the month, the month and the year in the first three lines. The last line shows the day of the week, monday being a 1, tuesday a 2 and so on.

Mode 3: Time as BCD

This shows the time as binary coded digits (BCD). The first line displays the hours. The left four LEDs indicate the 10-hours, the right four LEDs indicate the 1-hours.

In the same way, the second and third line display the minutes and the seconds.

Mode 4: Date as BCD

This is like the previous mode, but the date is displayed.

Mode 5: Time as BCD (vertically)

This shows the time in a BCD-form as described in mode 3, but the BCD-values are put vertically next to each other. So in the first two colums you can read the hours, the third column is empty, the fourth and fifth columns show the minutes, the sixth is empty and the seventh and eighths indicate the seconds.

Mode 6: Date as BCD (vertically)

This is like mode 5, but it displays the date.

Mode 7: Unix timestamp

This is probably the least human readable format. It shows a 32-bit value of the seconds since january 1st, 1970. :-)

Demo mode

If you connect the clock in a place with a poor DCF-reception, but want to demonstrate the functions, you can use the demo mode. To toggle this, you can touch and hold the button for about five seconds. Afterwards, you can switch through the different display modes. The time displayed will stand still, so this can be used to explain the display modes without a hurry.

Switching to demo mode is indicated by all LEDs flashing for a short moment. Leaving demo mode shows an empty rectangle for a short moment.

Drawbacks

I didn’t expect the DCF-signal to be so easily disturbed. In my case sometimes there is no usable signal left when I put my notebook with WLAN next to the clock. Fortunately, the time will be counted further until the next ‘correct minute’ is received.

Thanks!

I’d like to thank Michael Meier, who developed and published a much more sophisticated clock on his site. The SAA1064-stuff and the routine to calculate the Unix timestamp are based on his project. You can find it on his page.

And once again I’d like to give special credits to Thomas Stegemann for help with the C language.

License

This project is licensed under the GNU General Public License (GPL). A copy of the GPL is included in License.txt.

Download

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

Shellprogrammierung

Shellprogrammierung

My apologies, this PDF I wrote is german only.

I’m sure you’ll be able to find plenty of information about shell scripting on the net. When I wrote this text (started 1999, with some updates until 2005) there wasn’t a good german introduction.

:arrow: If you can read german: here’s the download.

Initially, I wrote this text for a school project. It quickly became too long to be a handout, so I published it on my page.

Distribution

From my page, the text was included into SelfLinux. With SelfLinux being a part of the Knoppix distribution, my text has been pressed to thousands of CDs. :-)

The Wikibooks project took the text from SelfLinux.

Both of those sites enhanced my text on their own, I see them as forks of my project.