USB Computer Status Display PDF Print E-mail
User Rating: / 75
PoorBest 
Friday, 13 July 2012 11:23

This project is a USB based computer status display. Downloads at the bottom of the page.

 

PIC Firmware: The firmware uses microchips USB stack. The files included in the USB folder are from the "Microchip Libraries of Applications" I used version v2012-08-22 of this library. The main.c, usb_descriptors.c, and usb_config.h were modeled after the "Device - HID - Custom Demos" files. The firmware processes the commands in the ProcessIO function in main.c The PIC firmware supports the following commands sent via USB HID...

HID Commands:

  • 0x10 - Clear display
  • 0x11 - Go to line 1, print string
  • 0x12 - Go to line 2, print string
  • 0x13 - Go to line 3, print string
  • 0x14 - Go to line 4, print string
  • 0x20 - Turn back-light off
  • 0x21 - Turn back-light on
  • 0x22 - Toggle back-light
  • 0x23 - Request back-light status
  • 0x30 - Update custom character

PC Support Application: The support application was written in C#. Some things of note... the file HIDInterface.cs is an invisible form. I created this as a form so I can get a window handle used for RegisterDeviceNotification calls. This allows me to detect when USB devices are plugged in and unplugged. This file is generic; the display specific commands live in HIDInterface_LcdDisplay.cs. That file extends the generic HIDInterface.cs and allows me to easily send commands to the display. In LineOptionControl.cs you will find the following function...

public string graphText(int percent)
{
    string returnStr = "";
    for (int i = 0; i < percent; i += 5)
    {
        // Check to see if we need a fraction of a full block (0x10 -> 0x14)
        if (i + 5 > percent)
        {
            returnStr += (char)(0x10 + (percent - i));
        }
        else
        {
            // Use a full block. (0x15)
            returnStr += (char)0x15;
        }
    }

    // Pad the graph out with empty blocks.
    returnStr = returnStr.PadRight(20, (char)0x10);

    return returnStr;
}

This function is how the application displays the graphs. It takes an integer input with a range of 0 -> 100 and will return a 20 character string representing the integer. Each character represents 5% of the graph. The PIC interprets characters 0x10 -> 0x15 as custom characters representing 0% -> 5%.

Settings: The support application allows changing of the refresh rate. This number is how often the PC is polled for status info and the display will be updated. You may also change the backlight idle timeout. After this number of minutes has passed with the computer idle (No mouse movement, no typing, etc), the backlight will turn off. If you set this to the same time as your monitor turns off it works out quite nicely. If you want to disable this feature, set the number to 0.

Command Line: If you pass either "min" or "minimize" to the program as an argument, it will start minimized to the tray. An easy way to do this is to modify the shortcut as follows...

"<PATH_HERE>\UCSD Application 1.0.exe" min
 
Example:
"C:\Users\andrew\Desktop\UCSD Application 1.0.exe" min

 

Parts List:

  • LCD Display:
    • 1x NHD-0440WH-ATFH-JT [P1] - Display itself. Exact model isn't critical. It is a 4x40 character driven by 2x SPLC780D ICs.
    • 1x 20KΩ potentiometer [R3] - adjusts display contrast
    • 1x NPN FET [Q1] - Exact model isn't critical. I had some MPSA42_D26Z FETs laying around.
    • 1x 1KΩ resistor [R5] - FET gate resistor. (Shouldn't be needed)
    • 1x 22Ω resistor [R6] - Backlight current limiting resistor.
  • Micro-controller and supporting hardware:
    • 1x PIC18F2550 [U2] - PIC18F micro with USB support
    • 1x 10KΩ resistor [R4] - Used for MCLR pullup
    • 1x SPST switch [S1] - Reset switch. I used a SKRGARD010.
    • 1x 20MHz cryatal [Y1] - Used by micro as a system clock and usb support. I used a ABL-20.000MHZ-B2.
    • 2x 18pF caps [C1] [C2] - Caps matched to the 20MHz crystal
    • 1x 220nF cap [C3] - Filter cap used by the micro-controllers' internal 3.3V regulator used for USB support
    • 1x 6 Pin Header [P2] - ICSP used to program micro-controller
    • 1x USB cable [P3] - Powers project and allows communication

 

Schematic full size: link

Dim lights Download Embed Embed this video on your site

PC Software:


Downloads:

Contact: 

Source Code, Schematics, Hex Files:

  • UCSD Release 1.5 - (Apr 09 2013)
    • PC Application: Added network usage performance counter.
    • PC Application: For HDDs split into multiple partitions, we will show the first drive letter and hide the others. Performance counters don't differentiate disk usage time per partition, so showing the additional letters would display redundant info.
    • PC Application: Switched from "% Idle Time" -> "% Disk Time" HDD activity counters for code clarity.
  • UCSD Release 1.4 - (Feb 16 2013)
    • PIC: now supports HID command to replace custom characters. (Command: 0x30)
    • PIC BugFix:  We will write custom characters to both controllers in the display.
    • PC Application: Added new performance counters. (HDD Single with graph & Many HDD % usage)
    • PC Application: User can now select data to be displayed per line. More than one item can be displayed. Program will cycle through items at specified rate.
    • PC Applicaion BugFix: Hidden daughter form object "HIDInterface" will be hidden from the "Applications" tab of task manager. (Set form.Text = null)
    • PC Applicaion BugFix: Main form will be hidden from "Applications" tab of task manager when minimized to tray. It will reappear when viable.
  • UCSD Release 1.3 - (Jan 12 2013)
    • PC Application: Will detect monitor going into low power state and can turn off backlight in responce. This feature requires Windows Vista or above. For previous versions of Windows, the feature will be disabled automatically.
    • PC Application: Now uses a custom NumericUpDown for backlight idle timeout box. Allows me to use the text "Disabled" instead of value "0" when user wishes to disable the idle timeout detection.
  • UCSD Release 1.2 - (Dec 16 2012)
    • Updated pic source to remove unneeded code.
    • Updated application to better handle system sleep / hibernate / resume.
  • UCSD Release 1.1 - (Oct 27 2012)
    • Updated schematic. Replaced LM317 circuit with a single resistor to simplify circuit.
    • (No source code changes)
  • UCSD Release 1.0 - (Oct 21 2012)
    • Original Release

 

Last Updated on Friday, 20 September 2013 12:48