Introduction: Four Letter Word Clock With Akafugu Word Generator and Inspirational Phrases
This is my version of the Four Letter Word Clock, an idea that originated back in the 1970s. The clock displays a series of four-letter words that are generated from either a random word generator algorithm or from a database of related four-letter words.
This version uses more modern 14-segment LED displays and an Atmega 328p microcontroller to display the words and time. Two word generation modes are supported. The first uses an algorithm to generate four-letter word groups that are likely to be actual words, similar to the original. Each successive word is unrelated to the previous. The second mode uses the relational word database from the "Edinburgh Associative Thesaurus", a document of word associations based upon people's responses to asking the first word that comes to mind after giving them a seed word, then continuing the process with the response word. The database was adapted to four-letter word generation by the Akafugu Corporation, who created a 57 Kbyte data file that is stored in an external EEPROM for processing by the Atmega. The result is that the clock uses Unix time as a random seed and generates a string of associated four-letter words based upon human responses, not some algorithm.
Note: The Akafugu word database contains some sexually explicit and potentially offensive words. If this bothers you, please turn on the random word mode. This may also generate some offensive words, but at least will not display streams of related offensive words!
The "Edinburgh Associative Thesaurus" was compiled based upon responses from people living in England in the early 60s. The word relations definitely reflect that bias! For example, the word "BEST" is frequently followed by "PETE". No obvious connection exists, unless one knows that Pete Best was the original drummer for the Beatles in the early 60s! Other biases toward UK culture of the 60s abound. I think it is very interesting to watch!
The device also contains an I2C addressable Real Time Clock module with rechargeable battery backup. The clock displays 5 words from one of the two selectable algorithms, then displays the time, date, day of week and year. The clock and operating modes are set using three push button switches. Operating modes are stored in non-volatile EEPROM and survive a reset or power failure. The RTC continues to run for about a year after power is removed, with extreme temperature-compensated accuracy. The correct time is automatically displayed when power is restored.
An added feature is the 107 quotations about time that are displayed randomly every 10 minutes. These quotations scroll from right to left across the four characters, providing frequent encouragement and inspiration! Storage for the phrases is in the external EEPROM with the Akafugu word database. The databse takes only 57 Kbytes of the 64 Kbytes available in the device, leaving space for the 107 phrases. A "brag" phrase is always the first to display when the clock is first powered up at the next 10 minute interval.
The unit uses common cathode 14-segment displays (2 cathodes for each digit) that are multiplexed by a timer interrupt service routine that results in the four-character display being refreshed at 100 Hz. Whenever the ISR runs, it switches off the previous half-character, retrieves 7 of the 14 segments for one of the four characters, turns on the corresponding segment pins and grounds the corresponding cathode. The displays are a bit uncommon, but I had a large surplus supply that I wanted to use. The dual-common cathode reduces the number of pins needed per digit from 15 to 9. There are just enough pins on an Atmega 328p to allow direct-drive of the display without a shift register.
TO-DO: Modify code to use the Adafruit 4-character alphanumeric LED module.
Step 1: History
The original FLW clock was built with large Burroughs B7971 alphanumeric neon surplus tubes scavenged from decommissioned stock ticker display boards. These are similar to the numeric nixie tubes of the time, but used a 14-segment display to form all of the ASCII characters. The clock used discrete logic, selecting letters from a table to form random four letter combinations that were weighted to be likely to produce real words.
With the algorithm In the original 1972 model, only certain letters appear in each position. A hand-tabulated analysis of several hundred four-letter words was done and the frequency of letters in each of the four positions was counted. The ten most frequent letters of each position were used, except in the second position which contained only eight letters.
For each position, a simple BCD (0-9) counter (a 74LS90 IC) ran freely and the count was captured and held about once every few seconds to once per minute, depending on the speed setting. The counter snapshot was then applied to a diode decoding matrix (using about 150 diodes) to form the characters.
Since only the ten (or eight) most common letters were selected for each position, with no regard for letter combinations, many non-words can appear, e.g., FRLR, LREE, LLLL, etc.
Note that the second position only had eight letters, since the ninth and tenth letters in the sample had a proportionally low frequency, while the first and second had extremely high frequency—so they were doubled. Thus 10 x 8 x 10 x 10 = 8000 permutations. The letters that were programmed into the first 1973 model are shown in one of the images above.
Step 2: Code and Schematic
The schematic is attached.
The clock may be built using any Atmega 328p-based Arduino.
For use with a standalone Atmega 328p, as shown in the schematic, an ISP programmer must be used to program the microcontroller via the Arduino IDE. After programming, the fuses should be set using the following avrdude command (WinAVR must be installed). Substitute the com port and programmer type. The easiest is to use an Arduino as an ISP programmer. Google for details.
avrdude -c arduino -P com13 -b 19200 -p atmega328p -U lfuse:w:0xFF:m -U hfuse:w:0xDF:m -U efuse:w:0x05:m
These settings disable the bootloader reset vector so the code immediately starts from the main code vector. The fuses are also set for an external 16MHz oscillator. Once burned, you will not be able to program the chip again until the crystal and capacitors are connected as shown in the schematic, as the default internal oscillator is disabled with these fuse settings.
The DS3231 Arduino library must be installed to provide access to the RTC clock routines. It is necessary to enable Unix time support in the library by uncommenting the line "#define CONFIG_UNIXTIME" in DS3231 RTC library config.h file. Unix time is used as a seed for the random number generator so that the word and phrase sequences will not be repeated each time the clock is powered up.
The DS3231 RTC clock module itself is a common variety sold on ebay. The module is illustrated above. Look for the type with a rechargeable backup battery.
In addition to a programmed microcontroller, it is also necessary to obtain and program a Microchip 24LC512 serial EEPROM with the Akafugu word database and phrase list. This is done using a simple circuit built with an Arduino, and SD card formatted as FAT32 with the output2.dat file on it. A sketch reads the data from the SD card and writes it to the EEPROM. Details may be found at the following two links. Be sure to use the programming sketch and data file in this Instructable, as the one at the Akafugu link lacks the phrase database. Follow the procedure in the links.
Step 3: Clock Setup and Control
The following button combinations are used for clock setup:
Hour set: Hold button 1 during normal operation.
Minute set: Hold button 2 during normal operation. Second are reset to "00" automatically
Seconds reset to zero: Hold button 3 during normal operation, release to synchronize with start of new minute
Set Month: Hold buttons 1 and 2 together during normal operation
Set Date: Hold buttons 1 and 3 together during normal operation
Set Year: Hold buttons 2 and 3 together during normal operation
Set Day of Week: Hold buttons 1, 2 and 3 together during normal operation
When the unit is first powered on, the operating modes are quickly displayed before word generation starts:
"EE" means the I2C external EEPROM containing the Akafugu word database and phrase list has been detected.
"NOEE" means that the EEPROM was not detected. The unit reverts to random word generation and no phrase display.
"CK" means the time and date are displayed after displaying 5 consecutive words.
"NOCK" means the time/date is switched off. A steady stream of words are continuously displayed, interrupted every 10 minutes by a phrase.
"RND" means random word generation mode is used
"REL" means the relational "Akafugu" word database generation mode is used
To change and save modes, unplug the clock and plug back in while holding one of the indicated buttons. Then release button. The new mode is stored and displayed:
Button 1: Toggle and save Random or Relational word generation mode
Button 2: Toggle the display of date/time after 5 consecutive words on or off
Phrases are always displayed every 10 minutes. This cannot be disabled.
We have a be nice policy.
Please be positive and constructive.