Arduino-Powered Four Letter Word Generator
by uhclem in Circuits > Arduino
8961 Views, 9 Favorites, 0 Comments
Arduino-Powered Four Letter Word Generator
Build an Arduino-powered version of the "Four Letter Word Generator" (FLW). This version generates "words" on the fly - it does not use a list. The "original" version from the 1970's used B7971 nixie alphanumeric tubes. These tubes are getting hard to find and they're certainly expensive. They also require interfacing with high voltage and an understanding of multiplexing.
This version uses a slightly more modern and easier to use display while maintaining the overall glowy, multi-segment look of the original. The Siemens DL2146T is a 4-character, 16-segment (plus dot) intelligent display. It has built-in drive and an ASCII font table. You basically send it seven bits of ASCII along with a couple more bits that select the position and control reset, blanking and chip select. It uses "a lot" of pins but we're not doing anything else so the available outputs on a ATMEGA168 are plenty.
An Arduino beginner with good soldering skills should be able to complete this.
This version uses a slightly more modern and easier to use display while maintaining the overall glowy, multi-segment look of the original. The Siemens DL2146T is a 4-character, 16-segment (plus dot) intelligent display. It has built-in drive and an ASCII font table. You basically send it seven bits of ASCII along with a couple more bits that select the position and control reset, blanking and chip select. It uses "a lot" of pins but we're not doing anything else so the available outputs on a ATMEGA168 are plenty.
An Arduino beginner with good soldering skills should be able to complete this.
Parts List
1x Siemens DL2416T display
This is an obsolete part, but it is generally available. You should pay less than $20 USD for it.
Here are some websites that had it in stock at the time of publishing this instructable:
http://www.alltronics.com/cgi-bin/category.cgi?item=DL2416T
http://www.intertexelectronics.com/DL2416T-160-Red-4-Character-16Seg-Alphanumeric-Intelligent-Display-P8698.aspx
http://www.electronicsurplus.com/item/39202/
1x Atmel ATMEGA168
Buy this wherever you get the best price. You can get it with the bootloader already installed if you want.
An ATMEGA328 will work but is overkill. An ATMEGA8 might also work but I have not personally tried it.
1x 28-pin narrow DIP socket or 2x 14 pin DIP sockets
1x 40-pin DIP socket
1x PB400 protoboard from Wright Hobbies http://www.wrighthobbies.net/
Feel free to use whatever you want, but this is a great quality protoboard and it is cheap, esp. if you buy a five-pack.
This board is double-sided, real fiberglass, tinned and all the holes are through-hole-plated.
You'll appreciate how nicely it solders and how well you can unsolder without ripping up pads.
1x 1 ft 16-conductor rainbow ribbon cable
Try jameco.com for this one; it's not mandatory but the colors help keep you from messing up the bus wiring.
2x 0.1 uf mono caps
2x 22uf 16v radial electrolytic caps (anything 10uf - 47uf is fine)
1x 16mhz ceramic resonator
1x 10k Ohm 1/4 watt resistor
1x 2.1mm power jack 1 mm lead size
Try moderndevice.com - use the one they sell for the RBBB
1x 5v switchmode wall power supply
Try bgmicro.com - they have a 5v 2a for $3.99
I used to make my own linear regulator setups on-board for wall-powered stuff, but a regulated switchmode supply
is so much more efficien and they are cheap, so I no longer bother.
Make sure to observe the polarity of your adaptor. Most use center positive. Adapt your wiring for the jack if necessary.
1x 8" x 10" sheet of 1/8 clear red acrylic
Ebay is the best option here.
General parts:
- hook-up wire - solid core is easiest but consider looking into teflon-insulated wire - costs more, harder to strip but it does not shrink or melt when soldering.
- get a "grab bag" of standoffs and mounting hardware - try alltronics.com, bgmicro.com or goldmine-elec.com
This is an obsolete part, but it is generally available. You should pay less than $20 USD for it.
Here are some websites that had it in stock at the time of publishing this instructable:
http://www.alltronics.com/cgi-bin/category.cgi?item=DL2416T
http://www.intertexelectronics.com/DL2416T-160-Red-4-Character-16Seg-Alphanumeric-Intelligent-Display-P8698.aspx
http://www.electronicsurplus.com/item/39202/
1x Atmel ATMEGA168
Buy this wherever you get the best price. You can get it with the bootloader already installed if you want.
An ATMEGA328 will work but is overkill. An ATMEGA8 might also work but I have not personally tried it.
1x 28-pin narrow DIP socket or 2x 14 pin DIP sockets
1x 40-pin DIP socket
1x PB400 protoboard from Wright Hobbies http://www.wrighthobbies.net/
Feel free to use whatever you want, but this is a great quality protoboard and it is cheap, esp. if you buy a five-pack.
This board is double-sided, real fiberglass, tinned and all the holes are through-hole-plated.
You'll appreciate how nicely it solders and how well you can unsolder without ripping up pads.
1x 1 ft 16-conductor rainbow ribbon cable
Try jameco.com for this one; it's not mandatory but the colors help keep you from messing up the bus wiring.
2x 0.1 uf mono caps
2x 22uf 16v radial electrolytic caps (anything 10uf - 47uf is fine)
1x 16mhz ceramic resonator
1x 10k Ohm 1/4 watt resistor
1x 2.1mm power jack 1 mm lead size
Try moderndevice.com - use the one they sell for the RBBB
1x 5v switchmode wall power supply
Try bgmicro.com - they have a 5v 2a for $3.99
I used to make my own linear regulator setups on-board for wall-powered stuff, but a regulated switchmode supply
is so much more efficien and they are cheap, so I no longer bother.
Make sure to observe the polarity of your adaptor. Most use center positive. Adapt your wiring for the jack if necessary.
1x 8" x 10" sheet of 1/8 clear red acrylic
Ebay is the best option here.
General parts:
- hook-up wire - solid core is easiest but consider looking into teflon-insulated wire - costs more, harder to strip but it does not shrink or melt when soldering.
- get a "grab bag" of standoffs and mounting hardware - try alltronics.com, bgmicro.com or goldmine-elec.com
Tools List
The following are necessary for doing the project:
- soldering iron
- 60/40 solder
- screwdriver
- wire cutters
- wire pliers
- scoring knife
- wood clamps or a vise
- a table with a sharp edge and a sturdy straight edge, or two pieces of square cut hardwood
- arduino board or clone and/or an in-circuit ATMEGA programmer; I use a usbtiny kit from www.adafruit.com
Ooptional, but nice to have:
- "helping hands" or PanaVise board holder
- temperature-controlled soldering iron (trust me, it's worth the investment)
- multimeter
- gaffer's tape (found in high-end camera stores and theatrical supply houses)
- soldering iron
- 60/40 solder
- screwdriver
- wire cutters
- wire pliers
- scoring knife
- wood clamps or a vise
- a table with a sharp edge and a sturdy straight edge, or two pieces of square cut hardwood
- arduino board or clone and/or an in-circuit ATMEGA programmer; I use a usbtiny kit from www.adafruit.com
Ooptional, but nice to have:
- "helping hands" or PanaVise board holder
- temperature-controlled soldering iron (trust me, it's worth the investment)
- multimeter
- gaffer's tape (found in high-end camera stores and theatrical supply houses)
The Prototype
Here's the original as developed on a breadboard with jumpers. The Arduino is an Adafruit Boardiuno kit. It's meant to plug right into a breadboard. It works very well for that purpose. The flexible jumper wires are also a worthwhile investment.
Fabricating the Display Filter
The following few steps are optional but they improve the look of the display. If you want the display filter, do it now before you solder anything to the board. Otherwise you won't be able to use the board as a template, unless you bought more than one.
Measure
Trace the outline of the protoboard onto the arcylic sheet. Don't remove the protective paper until every step with the acrylic is done. Measure a line across the short dimension of the sheet based on the board outline. I demonstrate the score and snap method, so it is necessary to snap a piece all the way across each time.
Score
Clamp your acrylic sheet down onto a table via a straight edge. In my case, I used a square oak dowel. Use the utility knife to score a groove all the way across the piece. Then unclamp, turn it over and do it on the other side. Try to accurately line up the score lines on each side - it will determine how straight your edge turns out.
Snap
Clamp your scored sheet down between two study straight edges - in my case, the oak dowel and a 1/2" sheet of polycarbonate. Try to get your score line lined up exactly with the edge of your straight edges.
Apply force evenly across the whole piece to be snapped with your palms, then push down quickly. Your piece should snap off precisely along your score line.
I was lucky and had a piece the right size in one dimension and only had to snap it once. If you are working with a different size piece, you'll have to measure again and repeat the process to get the size you want.
Apply force evenly across the whole piece to be snapped with your palms, then push down quickly. Your piece should snap off precisely along your score line.
I was lucky and had a piece the right size in one dimension and only had to snap it once. If you are working with a different size piece, you'll have to measure again and repeat the process to get the size you want.
Completing the Display Filter
Here's my piece post-snapping.
Now place the protoboard down on the acrylic piece, line it up and trace out the mounting holes with a pencil or fine-tipped marker. Then drill out the holes. While drilling, place the acrylic atop something expendable, like scrap wood and go slowly. Acrylic tends to crack if you push the drill too fast.
Once done drilling, re-check your hole alignment. If it's good you can now remove the protective paper backing.
Now place the protoboard down on the acrylic piece, line it up and trace out the mounting holes with a pencil or fine-tipped marker. Then drill out the holes. While drilling, place the acrylic atop something expendable, like scrap wood and go slowly. Acrylic tends to crack if you push the drill too fast.
Once done drilling, re-check your hole alignment. If it's good you can now remove the protective paper backing.
Protoboard
Here's a new Wright Hobbies PB400 board. It has two rows of 5-pin colums, as well as inside and edge power busses. It is also double-sided. Keep this in mind if you decide to use your own board. Otherwise, copy mine exactly and it will work the first time.
Cutting Traces
We have to cut a few traces to accommodate the ceramic resonator and the power jack. I use a jeweler's file to cut and scrape off the traces. Any pointy and sturdy metal object will work. They key is to cut only the trace you want, do it cleanly and not gouge the board unnecessarily.
Note, you will be cutting traces on both sides. I have marked in black where you must cut.
More Cutting Traces
Here are some images of me using the file, what it looks like close-up and how it should look when you are done.
Chip Placement
The following images illustrate where the chip sockets are going to go. You can skip this if you want, but pay attention to the fact that the ATMEGA is flipped to keep the wires to the display from having to cross the board. The little square denotes pin 1.
Make an 18-pin Socket
Cut your 40-pin socket carefully as shown to leave two rows of nine pins each.
Solder the Sockets
Solder in the sockets. It helps to tape them down to the board. Gaffers tape works best. Note I did not have a 28-pin socket so I used two 14-pin sockets end-to-end.
Solder the Ground Wires
Solder in the ground wires.
Solder the VCC Wires
Solder in the supply wires. Don't miss the wire on the back.
Solder 10K Pull-Up Reset Resistor
Solder in the 10K pull-up resistor to the reset pin.
Solder the Resonator and Bypass Caps
Solder in the resonator and bypass caps. There isn't a wrong direction for these.
Prep the Data Bus
Make a piece of ribbon cable about 4" long with 8 conductors. Split the ends to about 1", then strip and tin the ends to about 1/8".
Install the Data Bus
Solder in the data bus as shown. Note carefully how the wires are out of order on the display compared to the ATMEGA.
Prep the Address Bus
Take the ribbon cable leftover and pull off a five wire piece. Strip, split and tin.
Install the Address Bus
Solder in the address bus. Here too, the wires are in a different order on the display side.
Install Display Select Jumper
The DL2416T has a two-bit display select bus. Both display seelct pins need to go high to enable the display. Install a piece of wire as shown.
Testing
You're done soldering! Time to test the board. Plug in your regulated 5v power supply. Use a multimeter to make sure you have 5v where you should on the board.
Programming Hardware
There are many ways to program an Arduino. If your ATMEGA was purchased with a bootloader, all you have to do is pop out the original chip from your Ardunio board, put yours in and upload the program. If, like me, you bought a blank ATMEGA and plan to program it in the Boarduino, you will have to first install the bootloader. This can be accomplished like with an in-circuit programmer (ISP) like a usbtiny. Alternatively, look around online for instructions on how to use an Arudino and some jumper wires to an ATMEGA on a breadboard with a crystal or ceramic resonator to load the bootloader.
My design does not include a 6-pin ISP header, but you could move the display a few pins right and get yourself plenty of room for one on the left side of the board.
Anyhow, I began by popping the original chip off the Boarduino. Then I installed the blank chip gently into the socket (to make it easier to get out), plugged in the usbtiny and programmed it using the Arduino software.
Note for Mac and Usbtiny Users
I use an OSX 10.6 Mac. The Arduino (0022) software can upload the bootloader using the usbtiny, but it never recognizes it the first time. So, I have to use its version of avrdude to wake it up first.
Upload the Bootloader
Here's how to upload the bootloader using Arduino 0022.
The Program
Here is the .pde file for the program. Let's talk about it a bit:
First, the program algorithmically generates four-letter "english" words - it does not use a list. It chooses from beginning letter pairs and ending letter pairs, checks them against some simple rules and then sends them off to the display. There is also an intro phrase and an "intermission" phrase every 100 iterations. You can change these to whatever you want.
As far as the algorithm goes, it generates real English words about 2/3rds of the time. The other times it's still word-like or perhaps a word in another language than English. And yes, it will occasionally generate a "bad" (vulgar) word. If that is a problem for you, you will have to modify the code.
The other way this is done is to store a list of 4000+ words in flash and access them via PROGMEM.
The rest of the code deals with the DL2416T display. It parses out "words" from a string, meaning characters separated by spaces. If a word fits in four characters, it displays it directly. If it does not, it scrolls it. There's some button-checking code in there. If you want to add a button, use the return value from the formatting function. It keeps things responsive while scrolling without using interrupts.
First, the program algorithmically generates four-letter "english" words - it does not use a list. It chooses from beginning letter pairs and ending letter pairs, checks them against some simple rules and then sends them off to the display. There is also an intro phrase and an "intermission" phrase every 100 iterations. You can change these to whatever you want.
As far as the algorithm goes, it generates real English words about 2/3rds of the time. The other times it's still word-like or perhaps a word in another language than English. And yes, it will occasionally generate a "bad" (vulgar) word. If that is a problem for you, you will have to modify the code.
The other way this is done is to store a list of 4000+ words in flash and access them via PROGMEM.
The rest of the code deals with the DL2416T display. It parses out "words" from a string, meaning characters separated by spaces. If a word fits in four characters, it displays it directly. If it does not, it scrolls it. There's some button-checking code in there. If you want to add a button, use the return value from the formatting function. It keeps things responsive while scrolling without using interrupts.
Downloads
Upload the Program
Here goes the program...
When done, pop out your chip (hopefully you did not press it all the way in) and plug it into your board. Be sure to put it with pin 1 to the right. Also install the display - pin one on the left.
When done, pop out your chip (hopefully you did not press it all the way in) and plug it into your board. Be sure to put it with pin 1 to the right. Also install the display - pin one on the left.
Downloads
Testing
Check your chip and display orientation one last time, then power it up. If you burned the bootloader, don't forget there's a two second delay before you'll see anything on the display.
Install the Filter and Feet - Done
Time to install the display filter, if you included it. It really does improve the look of the display (my photo is somewhat overexposed). I bought a standoff assortment online, and it took some digging to find the right height off the board. If you're considering an Altoids tin, the PB400 needs to have the corners cut to fit. You could use the blank space on the board between the power rails and the pin rows to drill new mounting holes, in that case.