Here
is just about everything you could ever want to know about the design
and construction of the Hotpants board, except for a circuit schematic,
which does not exist.
Hardware
Theory
The whole
circuit is controlled by a PIC 16F876 microcontroller running at 20 MHz.
It has 22 usable I/O pins. We are using it to drive four 5 X 7 LED arrays.
The LED elements in the arrays are referenced by row and column, so we
do not have simultaneous unique access to each one. Basically what we
have to do is turn on one column at a time and light each row that is
on in that column. Then quickly switch to the next column, and so on.
That means that each column is only lit for a fraction of its possible
time. This is sad, as it cuts down on brightness, but unavoidable. We
do, however, play one nice trick, which is to treat the four arrays as
two tall columns rather than one large array. That way we can control
each LED while keeping the columns lit 1/5 of the time rather than 1/10,
effectively doubling the brightness. (I know could be explaining this
better, but print out the data sheets and have a look at the code, and
I think it'll make sense.)
Unfortunately,
that means that we have to control two columns of 14 LEDs independently.
So with 10 columns and 28 effective rows, we are saddled with a burden
of 38 outputs, which we know the PIC can't provide by itself. So we use
shift registers. Shift registers turn serial outputs parallel by piping
clocked values to their output pins on a specific signal. So we hook up
4 shift registers in series, and end up with 32 extra outputs controlled
by 3 pins on the PIC (data, clock, and output enable).
Finally
we have a potential problem with constant brightness. We want all of the
LEDs to be equally bright, but the PIC has a limited ability to sink or
source current, which means that when it's lighting 14 LEDs at once, they'll
be dim, and when it's lighting one, it'll be bright. So we run the PIC
column outputs through a Darlington current source chip to give it muscle.
Construction
tips
The silkscreen layer is your friend. Use it as a guide. Even if you produce
the board without a silkscreen layer, print it out and use it. It will
tell you the direction each of your chips should face. Don't solder them
in the wrong direction. I've done it countless times, and the orientations
are not intuitive. Also note that the LED arrays are soldered on the back
of the board, which is weird. There will be one side of each LED array
with some text written on it. That must face down toward the header at
the bottom of the board. Otherwise it's pretty much straightforward. I
would recommend socketing your PIC so you can burn it in a burner when
necessary. If you don't socket it, be sure your bootloader is burned on
before you solder it to the board.
That's it
for the hardware. The rest is software.
Software
Theory
There are
several different incarnations of software for Hotpants because it has
been used in a bunch of different contexts. All of the software for Hotpants
to date has two components, one on a PC and one on the board. A system
by Megan Galbraith allows you to write programs in the Nylon language
and send them to Hotpants. A setup by Simon Greenwold lets you take movies
with a webcam and send them to the board. The software on the PC side
is different, and so is the firmware on the PIC. It is helpful to burn
a bootloader onto the PIC ahead of time so that you can download different
programs to it to change its functionality.
The basic
operation of the firmware on the PIC is to change the values in the display
buffer over time. That becomes an animation. The actual refresh of the
screen column by column is done by timed interrupt, so it remains consistent
no matter what else is going on on the PIC.
We get three
pixel levels (ON, HALF-ON, OFF) by using two alternated screen buffers.
A pixel that is half brightness is on in one buffer and off in the other.
That way it gets half duty cycle. (Actually it only gets 1/3 duty cycle
because we display the second buffer two times out of three. That was
just because it made the contrast between all-on and half-on better.)
Tools
The tools
you should collect in order to play with the Hotpants as set up are
PIC
Programmer (like PICSTART
Plus)
Necessary if you want to build a Hotpants from scratch. You will need
this to burn a bootloader on the PIC. With luck that's the only time you'll
need to use it. So maybe you can borrow someone else's. They are more
expensive than they need to be ($100 or so).
PIC
C Compiler
We recommend and use CCSC. It's relatively
cheap ($125), and it works. If you're the assembler type, good for you.
Forgo the compiler. But don't waste your time with the free compilers
unless you have a lot of extra time you don't know what to do with.
PIC
Bootloader
I would recommend using the same bootloader we used for compatibility.
It's by Petr Kolomaznik and Shane Tolmie, and is available free from www.microchipc.com.
You'll need to make a serial converter cable to use it, which is not detailed
in the discussion or arts list below, but is described on their site.
The PIC's
serial pins are exposed from the board as the last two header pins on
the right (after power and ground) as seen in the schematic below. Which
is which, I forget, but it's easy to discover from the PIC datasheet or
trial and error.
Circuit
Board
I love ExpressPCB. They are cheap,
fast, and great. The file below is an ExpressPCB layout files. It will
open in the free software available from them. You can send them the design
directly and they will send you back a beautiful circuit board. No hassle.
Their new schematic software is very good too. If it had existed when
we developed Hotpants, I'd be able to offer you a circuit schematic too.
Parts
All of the
parts and associated data sheets for Hotpants are available from Digikey
except for the LED arrays, which come from Jameco.
The total component cost should be roughly $18.
Software
PIC
side
The packages you'll see here have a .c file, which is C source to be compiled
with CCSC, a .lst file, which is a listing of the compiled code, and a
.hex file, which is the compiled code in a non-human-readable format,
but ready to download to the PIC with PICLoader (see below) or burn on
with a PIC programmer.
|
LittleVision.zip
LittleVision is the PIC side code needed to run movies made with
CompressMovie or VideoMaker (see below). You must burn this on first
to have those movies work. If this program gets overwritten, write
it again.
Scroller.zip
Scroller
is a little program for Hotpants that lets you scroll text messages
across the screen. An easy starter program because it doesn't require
any other steps. Note that if you burn this on, you'll need to reload
LittleVision if you want to go back to showing movies.
|
PC
side
|
PICLoader.zip
This is the PC-side software for sending .hex files to the PIC.
The syntax is "picloader.exe -PCOM1 yourFile.hex", where
-P is optional and specifies the name of the serial port.
CompressMovie.zip
CompressMovie makes downloadable movie files from a series of
images. You must prepare the board by downloading LittleVision first.
Usage details are in README.txt. Full source is included.
VideoMaker.zip
This program burns movies taken with a webcam to the Hotpants board.
It is basically like CompressMovie attached to a video capture program.
I'm making available a weird combination of binaries and source
because I'm not free to release certain parts of the source (even
if you ask nicely). The source that I can give you is the stuff
that pertains specifically to this project, so that should be helpful.
The binaries here should run on pretty much any PC with a video
capture device attached. You must prepare the board by downloading
LittleVision first.
Nylon4Hotpants.zip
This program by Megan Galbraith allows you to write graphics routines
for the Hotpants board using the Nylon
language, a subset of Java augmented with tiny graphics library.
The environment lets you preview and debug your programs before
sending them to the board. It is written in Java but runs only on
Windows PCs because of the program downloader. This program also
requires you to have installed the CCSC compiler (see above), and
added the executable to your path. Note that if you burn this on,
you'll need to reload LittleVision if you want to go back to showing
movies. |
|