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.

Here you’ll find a few direct links to important content of this page:

Electronic projects: