What is that about these keyboard layouts?

On three occasions during the program execution calc.pw has to translate from the encoding keyboards are using to the ISO 8859-1 encoding. To do this a lookup table is needed. However, the Arduino does not have enough memory to store such a table for every keyboard variant there is (which are dozens besides the German QWERTZ keyboard, the American QWERTY keyboard, the British QWERTY keyboard, etc.). Instead, calc.pw has the ability to flash a keyboard layout to its EEPROM storage. Keyboard layouts have a certain structure which will be shown in the following example.


63616C632E7077 00080002 01 000000

A keyboard layout is always represented in uppercase hexadecimal encoding. The example consists of several elements. A keyboard layout starts with a header which consists of the ISO 8859-1 encoded text "calc.pw" ("63616C632E7077"). Then follows an Adler-32 checksum ("00080002"). It is calculated for all the data that follow. Next comes a length field ("01") that defines how many key combinations this keyboard layout consists of. And finally there are the key combinations ("000000"). The first two numbers represent the scancode according to the USB HID Usage Table for keyboards. The second two numbers represent the modifier and the third two numbers give the ISO 8859-1 representation of the character.

These values are valid for the modifier element:

00 - no control key is pressed
01 - AltGr (or alternatively Ctrl+Alt) is pressed
02 - Shift is pressed
40 - NumLock is active (for the numpad)
80 - the pressed control keys are not relevant (Space, Enter, Tab, Backspace)

To give you a more functional example the next picture shows the keyboard layout of the German QWERTZ keyboard. It consists of the header ("63616C632E7077"), of the checksum ("00EB00D7"), of the length field ("81") and of the key combinations ("040061 040241...").

QWERTZ Layout< (the QWERTZ layout) On startup and after having been reset calc.pw checks whether a valid keyboard layout has been flashed to the board. If yes, it proceeds normally. If not, a corresponding error message is presented. This may be the case when you start calc.pw for the first time or when the last flash attempt failed. This is nothing to worry about because flashing a new keyboard layout is relatively easy. Missing Layout
(error message due to missing layout)

To flash a new keyboard layout onto calc.pw it has to be set into flash mode. To do this just press the reset button and keep it pressed until the red and green LEDs light up at the same time. At this point the display tells you that calc.pw has switched to flash mode and is now waiting for a new keyboard layout. In flash mode calc.pw opens a serial interface with a transfer rate of 9600 baud. This interface has to be used to provide the keyboard layout.

Flash A Flash B Flash C Flash D
(status messages during flash process)

calc.pw also uses the serial interface to provide you with the current status of the flash process. After flashing is complete (whether successful or not) calc.pw resets itself. If the flash process was successful you can now start using calc.pw. If it has not been successful it is best to power off calc.pw before starting a new attempt on flashing a keyboard layout.

Layout Flashed
(flash messages via serial interface)


  1. Why calc.pw?
  2. How does calc.pw work?
  3. How do I have to enter the information?
  4. How does the password generation work?
  5. How was calc.pw built?
  6. How was calc.pw programmed?
  7. What is that about these keyboard layouts?
  8. Who is the person behind calc.pw?
© 2013-2016 Kenneth Newwood (@weizenspreu)
no-www.org extra-www.org IPv6 ready
Datenbank: 24 Abfragen | Generierung: 0,40201 Sekunden Top