So this summer, my dad gave me an ultimatum. By the time of his birthday this year (which is November 5th), I had to have an electronics installation ready to give as a present. That forced me to get 'unstuck', and get to work.
The result so far is a tall stack of electronics. With on the third floor: a shiny 8x8 LED matrix:
There's nothing much special about the LED matrix -- it has 16 pins: 8 are to drive the anodes of the columns, 8 are to drive the cathodes of the rows. Standard-issue multiplexing.
Second floor: the 4017 to drive the row cathodes, and a 64 KBit EEPROM with an I2C interface.
Here's a detail of the transistors that drive the cathodes:
The cathodes of the rows of the LED matrix feed into the collector of the transistor. If a current is applied to the base of the transistor, it allows the current to flow out of the emitter -- which means that that row of LEDs will light up if there is any voltage applied to the anodes of the columns. A 4017 is a 'decade counter', which means that it has ten outputs -- only one of which is high at any time. By pulsing a single pin, the output advances one position. Ideally suited for this application, even though I only need eight outputs to drive the eight rows.
First floor: a 4094 shift register to drive the anodes of the columns, and a 12F683 programmed with the ORB firmware.
The 4094 is a shift register with 8 outputs. Using only 2 pins, I can 'clock in' bits into the shift register via a serial protocol. One pin is the data (which I pull high for a 1, low for a 0), and the other is the clock (when it is pulled high, the bit that is present on the data-line is clocked in). When I have clocked ineight bits, I pull the strobe pin high, and the last eight bits to be clocked in will be put on the outputs.
I only need eight outputs in this application, but the cool thing about shift registers is that you can chain them to create 16, 24 or even more outputs -- all of which you can control by using only 3 pins.
Ground floor: a 16F628a to drive it all.
The 16F628a is my favourite workhorse PIC. A lot of hobby projects were made with the 16F84, and this chip is almost pin-compatible with that old one - except it is cheaper and has more features such as a built-in serial port.
The PIC will communicate with the EEPROM through the 2-pin I2C protocol. The pins have to be pulled high when not in used, so I placed pull-up resistors (of 10K Ohm) between the PIC and the EEPROM:
A pull-up resistor is connected to the positive voltage on one end, and to a pin/button/whatever on the other end. High values are preferred, so as to minimize the current drawn. This makes sure that, when nothing pulls the pin low (in this case: either the PIC or the EEPROM), it registeres as high.
The reverse of a pull-up resistor is... a pull-down resistor. These are for the two buttons. When they're not pressed, their pins register as a 0.
Basement: the plumbing.
In this case, a MAX232 serial port level converter, and a 7805 voltage regulator.
A detail of the power supply:
Due to height constraints, I had to place the 7805 (to the left) and the giant elco on their sides, which gave problems with placing the other components...
A detail of the MAX232 and its attendant elcos:
The MAX232 changes the RS232 voltage levels of the serial port (-12V and +12V) into 0V and +5V, which is what the serial port in the microcontroller understands.
There are no connections for external things on this board: there is no room for such. But you have to have a power terminal, a serial port and the two buttons on there somewhere. I solved that by using angled pins, and soldering those to the underside of the board:
Here is the same pinheader with a power socket inserted:
And it all adds up to a tall stack!
This is the stack in front.
And this is from an angle. You can see how I made the connection between the layers: male header pins soldered to the underside of the board, and female header pins soldered above the boards below. Works like a charm!
I haven't started on the firmware yet, but I think I will add an in-circuit programming header to the board with the PIC, so that I can reprogram the PIC without having to disassemble the whole stack if I want to add new functionality.