The Fish. The first embedded project.

This page is dedicated to the design and construction of one of the neatest things I have made for a beautiful woman. Most of my pre-college projects were built as presents for girls I dated: Star field projectors, dead hands in boxes, singing pigs, all sorts of fun and romantic stuff. This fish was both the coolest and the last project I hand made for a woman- I guess the dating scene hasn't impressed me too much since this project. It should also be noted that this project helped get me my job at Fermi National Accelerator Lab. Gennady mentioned it the first day of work.

The casethat holds the fish. On the surface it looks like a very unassuming little black suitcase- When looking for packaging, my mom suggested this. It was nice living in a resourceful household with cool parents. Unbeknownst to you, the viewer, this case contains what is actually a pretty cute little piece of equipment.

The Beginning

While wandering through the hardware store after meeting this excellent girl, I was thinking about what I could give her that would be cool. I knew that she liked singing, and I further realized that she went to school pretty far away, in Minnesota, which is a nine hour drive from The University Of Illinois at Champaign - Urbana. These silly things were on sale, because the singing fish craze had apparently died down after the holiday season, so I bought a shopping cart full, and started tinkering.

The fish inside the case This is the inside of that case- The power supply is donated from one of those slim-line Macintoshes. A school had a broken one, so I decided to donate its power supply to this. The case is lined with foam, and has actually proved so far to be quite durable. It comes with its own little stand and a power cord, too. All you do is plug it in, and push the black button, and it goes. The blue button is a stop button, so if you do not want to hear the whole five minute message, you can stop it.

What it used to do:

Out of the box, the Billy Big Mouth Bass could play two 15 second irritating melodies, while moving only one of its parts (mouth, tail, body) at a time.

The fish in motion What it does now:
It dances, and sings, for five whole minutes, moving as many body parts at once as I deemed necessary while making it. The songs it sings, recorded by me, in my voice are Mama Cass' "Dream A Little Dream of Me" and a brief snippet of "Oh What A Beautiful Morning" from Oklahoma. While singing, it moves its mouth and dances, all in time with the music. Its motions are updated eight times each second, to give a pretty fluid and happy sort of motion.

The Development

The project started in my basement, after I had these fish, with some ISD sample chips, the kind you have in your digital answering machine. I found out before from a previous present that you could gang these things together pretty simply- Just run the enable pin of the next chip into the previous chip's end of message pin, and you could store as long as you wanted. Five chips and several weeks later (I ended up giving up on cruddy Radio Shack sockets and ordered nice gold plated machine-pin sockets from Digi-Key) I had a recorder/ playback board capable of storing five minutes of pretty ghetto-quality audio. I could have done better, but these chips were samples from the kind folks at ISD, and being a starving college student at the time, these things are good for me. The audio board is on the right hand side in the picture below.

So now I thought to myself- Great, I have myself a little circuit board that will play back these messages. Next, I need a controller to make the motors go. Out comes a copy of one Steve Ciarcias' books in which he details the plans to build the BCC-board, a singled board microcomputer based on Intel's 8052. A few days later, after actually pulling out a ruler and making some circuit diagrams, I had a basic architecture based on the 8052 using 8k static ram chips, EEPROMs and the 8052's digital I/O port for control and input. The controller board is on the left hand side in the picture below. After that, the assembly on this thing began. Let nobody ever tell you that wire-wrapping is easy when you start. I am glad I did it, because now I can use a hand-wrapping tool like the dickens, but good heavens. Consider this- The controller board contains around 300 pins worth of stuff, and each one of those gets two wraps. I also had to build it twice, because the first time I screwed it up by not paying good attention to chip placement. Note to self and others doing this things: If you are going to wire wrap, put good hard thinking into where you are going to put your stuff, so you can put it into your case, without having dozens of wires running over the place you need to wrap next.

Controller board finished. That's great. Now I have to make it talk to the little board that actually makes the motors go, which is original to the fish. That original board, and all that is in the Billy Big Mouth Bass originally, is in the center top of the picture. The i/o board is on the bottom of the picture, next to the speaker. Out comes out my 1984 copy of Texas Instruments' data book (LSxxx chips have pretty much always been the same- Different electrical characteristics, but an LS138 will always be a 3-8 decoder, whether it be a 74LS138, 74HCT138, etc etc). Looking through that, I find some parts that look nice, and with no knowledge of actual digital systems design, put this little board together that reads switch states and allows the moving of all three of the motors at once- The analog board requires three wires, but the computer outputs four- mouth open, body up full, body up half, and tail up. On the little i/o board there are some resistors and bits that make the halfway feature work.

The inside guts of the fish project

Solved Problems: Controlling Hardware:

Have you ever noticed that nothing ever works the first dozen times you do it? Originally, I only had 8K of SRAM and 8K of EEPROM in the design, which is what I originally thought I needed. However, in trying to make this work, that ballooned up, and then down again. Above, in the current implementation, there is 24k of SRAM and 16K of EEPROM. I am only using 8K of the EEPROM and only a few bytes of the SRAM in its current implementation. However, there comes a time when you have to stop futzing. After I figured out the proper way to store the data for the fish's motion, I had already built all the systems to do it the previous bad way. The key thing I made in the name of more storage space was the little carrier that holds the two PLCC sockets. Those are my EEPROM's, and the underside of that board has a lot of traces hand drawn in fine-point sharpie, and quite a pile of wire-wrapping connecting the pins together.

Solved Problems: Sound Hardware:

Putting the sound into the audio board was tricky. I recorded it quite a few times before I realized to not leave the record and enable pins floating. If you do, then the ISD chips get confused and may randomly record over what you have already stored. Also, to program the sound, I had to make an external board which had the microphone, control switches, and pullup resistors. In recording the messages, I also found the best way was to use a cheap condensor microphone, put my really nice Sony headphones around it, and secure it with a c-clamp around the headphones. This kept external sound to a minimum. Combined with a discarded piece of RF shielding and a wire screwed onto the ground of my power supply, I got a pretty good relatively fuzz-free recording into the ISD. I should have snapped a picture of this bit, too. RF shielding humped over a double-decker hand soldered set of circuit boards with 6 wires micro-clipped on, plugged into a little board with a pair of sony headphones c-clamped over the top. Very interesting.

Solved Problems: Synchronization:

Once I had this thing running, and could control the motors with commands from the computer, I had to find a way to synchronize it all together, so that it works in time with the music, and stays marginally together through the length of the song. The 8052-AH Chip from Micromint, which is the CPU in here, has the great benefit of not only having a wonderful built in BASIC interpreter, but also has a real time clock! The loop to make the thing record and play back the motions are synchronized to the 8052's internal clock, and in every second, the thing plays back, if I recall correctly, 8 motion commands to the i/o board. Every second then the thing re-synchronizes, so you will never be more than a small amount off. I also found out that DATA and READ are too slow to make this work. As it plays, the chip copies the contents of 8 actual machine memory locations- It just starts at a hex value in the data, and counts up and copies the data over. It was very nice to work with this chip, and the people at Micromint are very helpful.

Solved Problems: Programming:

To get the motions into the thing, I had to built a separate little keypad with four buttons, donated from my first Atari 600XL, which I took apart when I was too young to know any better. The keypad plugs into the 8052's i/o port, and a program that is locked to the same timing loop as the playback routine just streams the numbers over the 8052's serial port. I capture them in a term program, and then convert them to the output values (due to the way the playback and reset switches work, and due to a lack of forethought on my behalf, the numbers the i/o board gets and the numbers you program with the keypad are different). Once you have the converted numbers, I fed them back into a program that wrote them into the at my specified start address. I could not have written this bit of code if it were not for Micromint's EEPROM emulator code that they wrote in basic to enable this sort of thing.

Solved Problems: Those Irritating Little Connectors:

Ribbon cables are great fun, but putting on crimp pin connectors without the right tool can be very annoying. More recently in my life I discovered the MTA series of connectors, which need a special tool, but the cheap version is only like $8 from digi-key.

Solved Problems: Portability:

I am not talking source code here, but the whole set of tools and equipment I used to build this. Because this project started at Christmas, when I was home, and went back to school, home over spring break, back to school, home for the start of summer, back to school for summer vacation, then finishing it, I got pretty good at fitting all my necessary tools in a box. I built this project with two toolboxes worth of stuff and a cardboard box. One box has mechanical tools, dental picks, screw drivers, and the like. The other box has soldering iron, my multimeter, and application-specific bits, like chips and spare parts. I also had a computer, I guess, but I have a sea of those, and all the software for this hardly takes up more than 50k on a floppy. The cardboard box contained the fish itself, and then one of those rubbery work-mats, and an apron. I would rather have wire jackets and solder drippings land in an apron I have on, instead of on the floor where I have to vacuum.

Solved Problems: Construction:

Ahh the Dremel! The plastic of the back is transparent, so people could see how cool my handiwork is. The plastic came from junk out of my High School's physics room. I also found out that making little paper models of holes makes your life much easier. If you have a lot of holes to drill in strange spots, as I did here, it makes sense to sit down with a ruler and a piece of notebook paper, measure the holes out, and then just go and mark them with a sharpy and drill. Eyeing and doing things one at a time is very irritating, especially when I had only one clear back piece to drill into. All the electronics are mounted to the back piece of plastic, so the whole thing comes into two pieces with a single rather neat looking wire bundle running between them.

Solved Problems: Deadlines:

I originally wanted this to be finished for this particular beautiful woman's birthday. It ended up not getting finished for quite a ways after that. Something on the order of eight months after that. But when you really like someone, what do deadlines really matter? In doing this project, if I had to do this again, or something like it, I could probably churn one out in about a week if I worked at it for a five hours or so a day, having already made the necessary software tools and things. I also would be able to simplify the wire-wrap, maybe make a printed circuit board, and certainly order the proper parts the first time around.