%@ Language=JavaScript %>
| ---. |
|
|
|
||||||||||||||||||||||||||
|
Project 1. Toy Sword Lighted With Blue LEDs. |
|||||||||||||||||||||||||||
It was a cool, brisk evening, and I was walking around the Arizona State Fair, in Phoenix, this evening with friends and their children. As we were about to depart the fair for another year, my nephew, who is an absolute nut about swords, spotted a vendor selling plastic (PETE) swords with styrene plastic handles. The business end of the sword consisted of a semi-oval certainly had jaws dropping all over the neighborhood. This article is intended to take you back through the project, and hopefully, you might learn something from it at the very least, or perhaps you can take it and adapt it for some other interesting purpose. If you do find an interesting use for the circuit, please send me an email with the details. I would be most interested in seeing what you can do with it. This is my first article, so I am a little light on the photos, as I didn't start taking them until afterwards, on a second thought. Anyway, on to the project.
Step 1. Disassemble the sword. This one was designed so one-half of the handle contained two sturdy posts, on which the sword, which had a somewhat flared handle end, was pressed down onto, thereby affixing it rigidly to the handle half. The other half of the handle contained two holes for screws to be turned into the top of the posts, thereby locking the handle halves, and trapping the sword-piece firmly between them. Pretty slick molding work, if you were to ask me. The "ladder" of LEDs was slid up the center of a tube, which slid up into the sword, and were connected directly to the power switch terminals. Step 2. Make room for the electronics. There was no wasted space in the design of the sword. All the remaining space in the handle was taken up with the three double-A batteries. They would have to be the first to go, so, with my trusty Dremel© Roto-Tool™ and a carbide cutting wheel, I cut out the rails that held the batteries in the center of the handle. I then unsoldered the LEDs from the switch and the battery connectors. I preserved the spring contact at the bottom of the handle in case I wanted it in some other battery configuration. In fact, it came in perfectly handy. Without the side rails, I could almost fit a sub-c battery in there. I removed the inner tube with the LEDs and removed them from it as well. That accounted for about everything. I left the power switch in as I would need it later, anyway. Then I set the sword and its parts aside until I was ready to reassemble it with the new parts. Step 3. Build a test platform. In order to write the firmware, I needed a test platform. I needed to have a working test circuit so I could write, test and debug the firmware for the microcontroller. First, I think a little background on the PIC chip is in order. If you are already an established builder, programmer or both, you might want to skip to the construction step. A PIC chip is in a sense, a full, complete computer system. A typical chip has 1024 14-bit words of flash program memory, 512 bytes of EEPROM, and 256 bytes of scratch RAM. More can be obtained by using some of it's many internal registers. You may have noticed that the program memory is separate and distinct from data memory. This arrangement is known as "Harvard" architecture. You may be more familiar with the way today's computers work, with the same memory for both, more familiarly known as "Von Neumann" architecture. PIC chips use Harvard architecture. This makes them easier to program in the long run. I chose to use probably the most common of the bunch, a PIC 16F84A. This chip has 1,024 words of 14-bit program memory, 54 bytes of EEPROM, and 68 bytes of RAM. It is of the 18 pin variety, typically uses a 4 MHZ clock, and has 13 I/O pins that can be either an input or an output, depending on how you write your program. Some have timers, A/D conversion, interrupt handling and more. Not this one, though. All we need is the ability to flash 8 LEDs. I decided to use eight because I could make use of some of the bit rotate functions to create some interesting patterns. Extending it to other port bits would severely complicate the code I would need to write later.
|
Figure 2. List of tools needed.
Using the application notes provided by Microchip, I constructed the test platform using a Protoboard™ breadboard. See fig. 1 for a photo of the parts and tools you will need in order to complete this project yourself. See fig. 2 for a list.
|
||||||||||||||||||||||||||
| [Home] | [Website Design] | [Website Hosting] | [Engineering] | [Programming] | [Software (FTP)] | [Consulting] | [News & Info] | [Entertainment] | [Support] | [Contact] | [Online Store] | [Jeff's Page] |
To report problems with this
website, send an email to
webmaster@icsaz.net
Website best viewed with Microsoft® Internet Explorer® 6.0 32-bit color
and 1024x768 minimum resolution.
Copyright © 1988-2008, ICS Engineering, Inc. All rights reserved.
Designed by Jeffrey LeClair
Revised:
04/11/2008 07:29:29 -0700
Comments? Please use our
online feedback form.