For the first version of my Open Source Framework for USB Generic HID devices based on the PIC18F and Windows I made a quick example of how to use the library using a USB interface for an LCD. Now that I've completed the second version of the library I thought it would be fun to enhance the LCD project into a completely self-contained LCD module which would fit in a 5.25 inch drive-bay of a PC case.
This project explains how the LCD module can be built along with PIC firmware and Windows host software written around the C# USB Generic HID library. For the example host code the CPU and memory utilisation 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 behind 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 the USB.
The PCB artwork required to build the controller board is available in the zip files at the end of this article.
Here is 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 which 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 completed board:
As you can see in the picture, the display is connected to the controller board using single strand wire. You simply solder the wire to the controller board then mount the LCD on top using some 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 underneath 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 software available from my Open Source Framework for USB Generic HID devices based on the PIC18F and Windows (Version 2_0_0_0) and implements several USB commands allowing 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 alter the PIC firmware (if you know a bit about the communication that is possible with the 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 can 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 extremely flexible if you wish 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 which is demonstrated 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 which shows the live streaming debug information coming from the USB firmware (which is extremely useful for more complex firmware design and debugging).
Mounting the LCD
Along with the PCB artwork and the schematics is a cut-sheet which acts a template for cutting a standard 5.25 drive-bay cover so you can mount the display in a PC Case. Here is a picture of the display mounted in my PC:
Files for download
PCB and Schematic - The PCB artwork and schematics in expressSCH and expressPCB format (these are freely available programs) - also includes a panel cut-sheet to help with mounting the LCD module.
PIC18F2550 Firmware - The PIC18F2550 firmware source code (for HiTech C18)
MS VS C# 2010 host software source - The Windows source code in Microsoft Visual Studio 2010 C#.
Donate to waitingforfriday.com:
If you like this site and want to help support future projects, or you just want to show appreciation for a project you built, used or enjoyed, please consider leaving a PayPal donation. It's quick, secure and helps us to run the site and fund future projects!
|PayPal, fast, easy and secure|
Join the EFF:
The owner of this site is a member of the EFF and you should be a member too! The EFF protects the rights of open-source, open-hardware authors all over the world.
Most popular pages:
- Building a PIC18F USB device (252,918 views)
- Home (238,394 views)
- 4-Bit Computer (104,195 views)
- Projects (103,463 views)
- Open Source Framework for USB Generic HID devices based on the PIC18F and Windows (103,331 views)
- Open Source Visual C++ Class for USB Generic HID Communication (62,759 views)
- Real-Time Audio Spectrum Analyser (60,997 views)
- Controlling LED brightness using PWM (51,231 views)
- USB RGB LED VU Meter (49,636 views)
- PIC USB Development Board (48,666 views)
- 16x8 LED Matrix Display (43,962 views)
- C64 VICE Front-End (36,611 views)
- USB Performance Monitor (33,205 views)
- PC Case USB LCD (30,047 views)
- Rotary Encoder Demonstration (28,174 views)
- Commodore SID 6581 Datasheet (26,967 views)
- Reverse engineering an MB Electronic Simon game (24,029 views)
- Retro Computing (22,929 views)
- LED Colour Organ (22,797 views)
- Vetinari's Clock (18,592 views)