Intro: Tribble Calculator
Star Trek. It's a show about space and people in space interacting with various species (in space). There are a billion of those species (I counted), but there is one specific creature that has captured the hearts of pretty much anyone who has seen the episodes in which it is featured: the tribble.
Tribbles do three things: look cute, sound cute, and multiply. When one of my friends made a tribble—clearly a fake as it didn't sound cute or multiply—I decided that I should take a stab at it. Not literally, of course. Have you seen how cute they are? (You could just skip to step 7 and make a fake tribble, too.)
Making sound is easy. That's what Arduinos are for. Cute sound might be a bit more difficult, but it's manageable. Multiplying, though, was going to be an issue … until I remembered that the Arduino programming language can do the four basic mathematic functions including multiplication in a shockingly short period of time. Like tribbles!
And so was conceived (brace yourself for the puns) the tribble calculator. All it can do is look cute, sound cute, and multiply.
(If you just want a stuffed tribble without all the bionic implants, skip to step 7.)
(If you wanted to see the video, it's on step 8.)
Step 1: Okay, But What Does It Actually Do?
It takes numbers as input in the form of button presses and outputs their product as a series of gentle purrs. The computing power comes from an Arduino (or a clone thereof) hiding in the furry thing.
I made a clone Arduino circuit board with the button and speaker built into it. I didn't want to put a real Arduino semi-permanently into a tribble, so I did this. You can use a proto-shield and real Arduino if you want.
There's a video in step 8 that shows how it multiplies.
Speaking of Arduinos, I'm putting this in the Arduino contest. Vote for me if you like.
I'm also putting this in the Kit contest. As a kit, the PCB could be an Arduino and proto-shield. Vote?
I'm putting this in the Battery-Powered contest. It's like I want to win just by entering a billion contests and getting lucky. I want a robot T-shirt because they're cool. Vote?
Step 2: Materials
-Official Arduino Uno used for programming and prototyping
-Arduino programming capabilities that I'll assume you have if you have an Arduino
-Solderless breadboard for prototyping
-Fake fur—your choice of color and style
-Crappy 8Ω speaker. I got the one on most Radio Shack component shelves.
The stuff for a specialized copy Arduino: (You can use a real Arduino and proto-board, if you want.)
-ATmega328P-PU This is the chip on a real Arduino
--corresponding 28-pin IC header
-LM7805 voltage regulator
-Copper-clad board for etching or strip-board or whatever you want to use to make a circuit board. Go to step 5 for more
--if you use copper-clad like I do, you need etchant and some kind of masking material. Again, go to step 5 for elaboration
-2x 10kΩ resistors
-16MHz crystal oscillator
-An electrolytic capacitor around 22µF
-9V battery holder
-A switch for the power. Any style you like as long as it's small enough.
-needle and thread
-soldering iron and solder
-if you're making a circuit board, a drill (preferably a drill press) and something to cut it like a dremel.
Step 3: Circuit Prototype
It's good to check that the code gets along with the hardware. I like prototyping every step to make sure I know what works and familiarize myself with the circuitry.
Copy the code in this pastebin and paste it into the Arduino software:
Upload it to the official Arduino.
Set up the circuit in the image.
The resistor is just there to make sure that the button stays at ground. An open pin will read a whole bunch of weird voltages from charge floating around and building up around it.
If you press the button between 1 and 10 times (inclusive), the speaker should purr the same number of times. You just entered the first digit of the first number (10 presses for 0). You can repeat this up to 9 times for 9 digits, after which it will start squeaking at you. Also, the button and breadboard don't like each other in my experience and the contacts aren't always solid. If it still gets some presses but too many or too few, it's probably the connection.
If you hold the button until it emits a low purr, you move on to the next factor. Enter digits the same way.
If you hold the button until it purrs again, it should purr out the product of the two numbers you entered as a set of purrs for each digit followed by a pause. Yay, it works! There is currently no protection against overflow errors. You'll just have to deal with the fact that if the product is over 4,294,967,295, you'll get some wonky numbers.
If it does a high-pitched squeak, it's an error code. You either pressed the button more than 10 times, tried to enter too many digits, or you tried to multiply without entering a number.
If you read, "Yay, it works!" and said, "No, it doesn't," then that's sad. Try resetting the Arduino. Make sure the button is actually in the board, as it sometimes gets pushed out. Make sure the button is in the correct orientation. The legs should be sticking out of the top and bottom rather than side to side.
Step 4: Circuit Prototype Again
Okay, let's make a clone Arduino do it. If you are okay with sewing a real Arduino and proto-shield into your tribble, then you don't have to do any of the steps about a clone Arduino. I just don't have a bunch of Arduinos lying around.
This is a schematic I use all the time when making Arduinos on breadboards or PCB: http://www.fiz-ix.com/2012/11/schematic-of-a-breadboard-arduino/ I don't have a reset button in mine. It resets automatically when the power gets cut.
The easiest way to program an ATmega chip is to put it in the official board, upload, then pull it out again. There are ways to just wire up a board without a controller, but it still involves pulling chips off. Be careful not to break pins. Use a tiny flathead screwdriver to pry it off. Make sure you line up the end of the chip with the little notch with the notch in the IC header of the Arduino.
Once the chip is programmed, build it into the circuit below. (Watch the polarity on the capacitor. It's fun to pop them, but not good for anything else.)
It should do the same stuff as last step, still. If not, double check. Watch the button as it likes to pop out. Look at the datasheet for the LM7805 to make sure it's wired right. Make sure you put the notch in the ATmega is facing the right way. If you put it in wrong, you may have to re-program it. Check that one resistor goes to power and one to ground, as it's easy to mess up. (I'm going to pretend I didn't accidentally do all of those things.)
Step 5: Circuit Board
Okay. Everyone has their own preference on how to make a board.
Perf board is easy and you can copy the beadboard pretty well. Some even have the breadboard pattern coppered on. Some are just holes in a grid and you solder the leads of the components together.
Or you can do what I do. Etch circuit boards. Using copper-clad board and hardware store chemicals, you oxidize away the unwanted copper to make a pretty, fancy-looking PCB if you're better than I am. It's fun and makes you feel like you know what you're doing.
It's also a bit tricky, easy to mess up, and it produces a bit of chlorine gas. No big deal, right? I could make a whole instructable about this, but there are many already.
Home-made etchant: https://www.instructables.com/id/Stop-using-Ferric-Chloride-etchant!--A-better-etc/
I use Sharpie marker for a really simple, cheap masking material, but some people like toner transfer which turns out nicer, usually. Here's a random one I found: https://www.instructables.com/id/Etching-Method-and-Sticker-Method-of-PCB-fabricati/ If you use a sharpie, just be sure to draw dark, solid areas.
If you haven't etched before, make a USB LED or something. I've messed up some boards before I got some right.
In any case, make the circuit board from earlier in your preferred style. I have pictures of my (admittedly sloppy) PCB. I used a drill press to make a bunch of holes and I rounded the corners so it would be less of a pointy box inside the tribble. Since there are a billion different methods, I put instructions in the picture labels and tried to document it well.
***N.B. Put the button on the wrong side of the board.*** The button has to be on the outside of the little box we make so you can push the button from outside the tribble. You can still solder to the sides of the legs of the button from the back side, luckily.
***N.B. Also put the switch in series with the battery.*** My switch just didn't fit well in circuit board.
Step 6: Box
Make a little box to house the circuit board and make the button easier to press. Cardboard, thin plywood, duct tape, whatever. I made mine out of the sides of a clementine box.
I just duct taped it together. I had to redo it in masking tape for the final version, but it doesn't need to be too fancy. All you people with laser cutters, I'm jealous and you can be as fancy as you want.
Cut a hole for the speaker to go out. It's okay if you tape over it, but a solid piece blocks too much of the sound.
Make a flap the size of the circuit board and tape it on like a hinge so that it presses the button when you touch the flap.
Step 7: The Tribble Part
I don't sew. Well, I do, but not with anything resembling skill, efficiency, or competence. Luckily, Tribbles were designed to be easy to make so that the crew of Star Trek could pile them all over the bridge and dump countless furry lumps out of a storage compartment and throw them at the cast.
I hand sewed it. The last part doesn't work well with a machine because the fur is facing out, but you could do a lot with a sewing machine if you have one.
1: Fur. Fake fur. Cut it into two ellipses of the approximate final size of your tribble. You might want to consider the fur direction to make it look nice or crazy or whatever you're going for.
2: Pin the two ellipses together with the fur facing inwards. Start sewing them together. Leave a bit un-sewn at one end so you can …
3: Flip it inside-out (or right side out, I guess).
4: Stuff it.
5: I tried putting the Arduino box just in with the stuffing, but it was hard to get to and got all jammed. So I made a little tube out of scrap cloth for the Arduino. Sewing the tube to the edge of the fur is the hardest part. Just be patient and take your time.
Bonus: You can put a little zipper or velcro or drawstring to change the battery. I found that it's well-hidden even if you sort of fold the fur into itself or safety-pin it.
6: Put the Arduino box in and try to get it aligned in such a way that the button can be pressed and won't get stuck pressed. Make the power switch easy to get, too.
Step 8: IT'S ALIVE!!!
Flip the power switch. Squeeze it a few times. Good? Aww, yiss. Here's my tribble. Isn't it adorable? Also, check out the video at the bottom.