Warning: This site is under construction, most links will be broken.
Electronics -> picbrick universal I/O device
Last modified on Tue, 1st Jan 2008 at 00:59 GMT by zipplet
Click to enlarge
What is it?
picbrick is a universal I/O device built using a PIC18F2550, connecting to the host (a PC) via USB. It can perform many functions, almost anything you can think of that does not need fast I/O or a huge number of I/O pins.
Why?
With picbrick it's easy to test out new ideas without having expensive test equipment. For example, you can quickly connect a serial EEPROM to the picbrick header on a breadboard and write a PC program to control it - either to program the EEPROM or just because you want to learn how to drive one.
Yes you could just write a program for the PIC directly for such a use but it's time consuming to test things properly, unless you have LCD display / keypad modules handy to enter data and show the output.
picbrick has many other uses, such as using it as a digital logic analyser, ROM chip dumper (with a very simple circuit on a breadboard), or to test other PICs. One such example is my LED display driver. It has a serial protocol to allow the host to send commands to the driver, such as writing text or plotting pixels. Using picbrick to test allows me to focus my efforts on the display driver chip and worry about building a host later.
How does it work?
picbrick contains an 18F2550 which controls the 14 available I/O lines on demand. The host PC connects using USB, and the firmware in picbrick sets up an emulated serial port (CDC class). Commands can be sent to make picbrick set pins as inputs/outputs, read pins, or set pins high/low. picbrick also includes 2 red status LEDs that can be controlled by the host, and a green power LED that is permanently lit.
To connect picbrick to the target you use the target header which consists of a piece of stripboard with 2 rows of turned pins spaced apart to simulate a 16-pin skinny DIP. picbrick supplies +5V power from the USB bus to the target too (only to be used with low current circuits!).
Problems
Reading port pins is slow because of USB latency - first the read command must be sent to picbrick, then the response must be sent back. Writing port pins is very fast and buffered.
Improvements
picbrick needs commands to start and end streams of port reads to get around the USB latency issue mentioned earlier. Also, commands to serially clock out data on 2 port pins would be very handy as right now this must be done by sending a lot of USB packets so for example testing SRAMs is very slow.
SRAM test circuit
As soon as picbrick was built I decided to test it by driving an SRAM chip. 2 serial in-parallel out shift registers are chained together and used to generate the address signals. The other signals (D0-D7, /CE, /OE, /WE) are directly connected to I/O pins.
An SRAM test circuit hooked up to picbrick

Click to enlarge
The SRAM chip under test (an ST zeropower RAM chip, built in battery backup)

Click to enlarge
The test program running on my PC:

Click to enlarge
Note that the test program tests using a 64KB address range. With smaller chips it still works, as the memory range wraps.
More pictures
The picbrick target header

Click to enlarge
The guts of the thing.

Click to enlarge
A close up of the PCB

Click to enlarge
Build your own
Parts list:
- Microchip PIC18F2550
- 1x 8-pin DIP socket
- 1x 28-pin DIP socket
- 500nF polyester capacitor
- 1x 33pF ceramic disc capacitor
- 1x 10uF electrolytic capacitor
- 4mhz oscillator module
- 1x 5mm green LED
- 2x 5mm red LEDs
- 3x 220R resistors
- 1x 10K or 100K resistor
- USB socket, or USB extension lead (cut the socket part off the lead)
- 16-way ribbon cable
- An IDC header for the target, or you can make a DIP header like I did
- PCB and a project case for a nice finish
I will be placing a schematic diagram here shortly.
Downloads
I will be placing firmware and software downloads here shortly.