For the first version of my Open Source Framework for USB Generic HID devices based on the PIC18F and Windows I made a USB interface for an LCD. Now that I’ve finished the second version of the library I thought it would be fun to enhance the LCD project into a fully self-contained LCD module which fit in a 5.25 inch drive-bay of a PC case.
This project explains how the LCD module can be built together with the PIC firmware and the Windows host software around the C # USB Generic HID library. For the example host code the CPU and memory utilization is displayed on the LCD along with the current time. The hardware is the same size as the LCD itself and can be mounted directly from the ATM1602B 2 * 16 LCD module to provide a compact host powered LCD for many applications.
The hardware design is extremely simple and can be built using the supplied PCB artwork or on a stripboard / breadboard. The circuit consists of a PIC18F2550 with a 20 MHz resonator and the required components for the LCD screen and USB.
The PCB artwork required to build the controller board is available in the zip files at the end of this article.
Here’s the circuit schematic for the LCD controller board:
The circuit board uses mainly SMD devices (although you could fit through-hole devices in the same space it saves a lot of time drilling holes). Also the USB connection is provided via a SMD mini-USB connector that keeps the whole module very thin and space-efficient. Only the top copper layer is used (and there are no jump wires required) so this can be easily made with a single sided PCB. Here is a picture of the finished board:
As you can see in the picture, the display is connected to the controller board using single strand wire. You can simply scroll the wire to the controller board and then use the LCD to top up some of the screws (and I used some M6 bolts to act as spacers) and then solder the wires to the LCD.
The contrast control potentiometer is mounted under the board to allow easy adjustment after the LCD screen has been mounted. The diode can be soldered on the top or bottom of the board; I decided to keep it on the top to make the finished module look neater.
The firmware is based on the Open Source Framework for USB Generic HID devices based on the PIC18F and Windows (Version 2_0_0_0) and implements several USB commands that allow the host to clear the display, move the cursor, output text and write a ‘raw’ byte to the LCD display. The raw byte command allows the host to be able to send custom commands to the LCD so that you can implement things like special LCD characters without having to change the PIC firmware (if you know a bit about the communication that is possible with ATM1602B) . Furthermore there is no reason why you could not use the same firmware to communicate with the larger versions such as the 4 * 16 display. I chose the 2 * 16 because it is fit behind a single drive-bay cover.
Windows host software
The host software is written using Visual Studio C # 2010 and has been tested with Windows 7 (although it should work fine with Vista and XP).
The host software implements the performance counters and passes the appropriate text strings to the PIC firmware. The mechanism is very simple and should be very flexible if you want to implement your own display information.
In addition, version 2 of the USB HID library implements an example debugging log stream from the USB firmware to the host that is shown in the host code.
Here is a screenshot of the GUI:
As you can see from the screenshot the application monitors both the CPU and the memory usage using windows’ built in performance counters. In addition there is a debug text box showing the live streaming debug information coming from the USB firmware (which is very useful for firmware design and debugging).
Mounting the LCD
Along with the PCB artwork and the schemics is a cut-sheet of a standard 5.25 drive-cover cover so you can mount the screen in a PC Case. Here is a picture of the screen mounted in my PC:
Files for download
The PCB artwork and schemics in expressSCH and expressPCB format (these are freely available programs) – also includes a panel cut-sheet to help with mounting the LCD module:
The PIC18F2550 firmware source code (for HiTech C18):
The Windows source code in Microsoft Visual Studio 2010 C #: