# # # Original Version # ---------------- # http://www.Linux-1u.net/LCD/lm_sensors.txt/lcd-front-panel.uHowTO.txt # # # Front-Panel LCD Monitor micro-HowTo # # # Contributed by: # Ray Olszewski ray@comarre.com,ray@Linux-Consulting.com # Alvin Oga alvin@linux-Consulting.com # # # 12-Mar-00 rxo Original # 04-Mar-01 amo Moved lcd-sensors.pl to a separate file # 20-May-02 amo Changed from netroedge.com to lm-sensors.nu # # # This micro-HowTo describes a prototype system for displaying system monitoring information on a small LCD display, mounted in the front panel of a standard Intel-style PC running Linux. It covers these topics: 1. Locating the information to be displayed. 2. Selecting an LCD for the display. 3. Installing the LCD. 4. Displaying the information. Appendix A: Compiling and Installing i2c/lm-sensors Appendix B: Sample Perl Program 1. Locating the information to be displayed ---------------------------------------- The prototype system displays the following information on a rotating basis: hardware sensors: modern motherboards typically include devices to monitor key system values, such as voltages (+5, -5, +12, -12, +3), fan operation (CPU fan, case fan, backup case fan), and temperatures (CPU, case). Motherboards vary in what they monitor, and access to the monitors is not a standard part of the Linux 2.2.x kernel distribution. Supplementary packages (lm-sensors and i2c) exist that create kernel modules to detect the common chipsets used for monitoring, add to the /proc filesystem the appropriate pseudo-files to access this information, and provide utilities to detect sensors and display their output. Appendix A to this HowTo discusses installation of the lm-sensors modules. Information taken from /proc/sys/dev/sensors/*/* . CPU utilization: reported as percent time in kernel mode; percent time in user mode; and percent time idle. Information taken from /proc/stat . Memory utilization: reported as amount and percent of RAM used (exclusing buffers and cache), and amount of swap used. Information taken from /proc/meminfo . Filesystem utilization: reported as percent of space used and absolute amount of space used, for each mounted filesystem. Information taken from the output of "df". Subsequent versions should be extended to include interface (e.g., eth0, ppp0) monitoring and <> 2. Selecting an LCD for the display -------------------------------- Standard text-based LCDs are widely available. Standard ones are based on the Hitachi 44780 chip, which offers a 4- or 8-bit parallel interface to a pre-defined character set. Common LCD display sizes are 2 lines of 16 characters, 2 lines of 20 characters, 2 lines of 40 characters, and 4 lines of 20 characters. Because the prototype system was designed for use in a 1U rackmount case (17.5" wide by 1.75" high), I focus here on the 2*16 size most suitable for use in the limited space available. The LCDs themselves are widely available, in a wide range of quality and price, in both single and large quantities. Examples of sources for the basic, parallel-interface LCDs are: http://www.shellyinc.com/ http://www.flat-panel.com/ It is possible to interface directly from a PC’s parallel port to the standard LCD interface. Instructions, including wiring diagrams, can be found at URLs such as: http://www.doc.ic.ac.uk/~ih/doc/lcd/pc_example/conn1.html http://www.beyondlogic.org/parlcd/parlcd.htm http://home.iae.nl/users/pouweha/lcd.htm A simpler method is to use a serial-interface converter to present the LCD device to the PC as a serial device. Serial converters can be purchased from three main sources: Scott Edwards Electronics – http://www.seetron.com Shelly, Inc. – http://www.shellyinc.com Wirz Electronics – http://www.wirz.com Pre-assembled LCDs with serial interfaces are less common. Two sources for them are: Orbital Matrix – http://www.matrixorbital.com Scott Edwards Electronics – http://www.seetron.com The prototype was developed using products from both sources, but the large size of the Orbital Matrix display (4*20) made it unusable in a 1U rackmount case. Accordingly, I focus here on use of the Scott Edwards BPI-216N 2-line-16-character LCD serial display module. 3. Installing the LCD ------------------ Physical installation of the LCD into a 1U case involves these two steps: A. Providing a suitable space on the front panel. The Scott Edwards LCD module used in the prototype requires an opening approximately 3.0" * 1.25" big and takes up 3.75" * 1.5" * 1.0" space inside the case. A template for creating the necessary opening and mounting holes is available from Scott Edwards at URL www.seetron/pdf/mounts.pdf B. Creating a cable to provide signal and power: The serial interface uses a 1*5 pin connector, with these pinouts: 1 = +5 V in 2 = GND 3 = RS232 in 4 = GND 5 = +5 V in Only one of the +5 V pins needs to be supplied with power. Since the LCD is inside the case, the best approach to cabling is to create a custom cable that connects as follows: power supply +5 V = 1 = +5 V in power supply GND = 2 = GND motherboard serial conn., pin (TX) = 3 = RS232 in motherboard serial conn., pin (SG) = 4 = GND unused = 5 = +5 V Connect the signal portion to whichever of the standard serial ports is available as a 10-pin connector on the motherboard. 4. Displaying the information -------------------------- The prototype uses a short perl program to cycle through the items being reported, updating the display every 3 seconds. It takes about a minute to cycle through the full set of items being monitored. The perl program is written to be customized for the particular motherboard and LCD display being used. For different motherboards, it requires three types of customization: A. The name of the sensor chipset used. The i2c/lm-sensors modules create a pseudo-file-directory in /proc/sys/dev/sensors/ that reflects the name of the sensor chipset in use on the motherboard. The perl program needs to have the name of that directory added to it. B. The specific sensor lines being monitored. The i2c/lm-sensors modules create a pseudo file in /proc/sys/dev/sensors/*/ for each sensor line provided by the chipset in use. The perl program needs to have the list of sensors to be monitored added to two lists: a list of file names to check, and a matching list of labels for the sensors. C. Numeric conversions. The various sensor chipsets report values that do not directly correspond to the values as we want them in monitoring. Conversion formulae analogous to Celsius-to-Fahrenheit conversions are needed to convert the system’s internal representations of values to the ranges we expect. These conversions are chipset specific, and can be found in the "sensors" program that ships as part of the lm-sensors package (see Appendix A). The perl program needs to be customized for the particular LCD being used in two ways: A. Different serial interface modules use different control codes for various non-printing commands. The needed entries are analogous to a temcap entry for a terminal type, and tell the program how to clear the screen, jump to a particular x-y location, change cursor types, etc. B. Different size LCD displays offer different amounts of room to display information. 2*16 displays demand more succinctness in message contents than do 4*20 displays. The actual information being displayed can vary considerably depending on display size. Appendix A: Compiling and Installing i2c/lm-sensors --------------------------------------- i2c/lm-sensors is a package that combines kernel modules to report the output of various sensor chips, and a set of userspace programs to probe for sensors, display sensor information to the screen, and reformat raw sensor output into human-readable form. The home site for lm-sensors is URL http://www2.lm-sensors.nu/~lm78 ##http://www.netroedge.com/~lm78 - obsolete The latest version can be downloaded from URL http://www2.lm-sensors.nu/~lm78 ##tp://www.netroedge.com/~lm78/download.html - obsolete Linux kernel 2.2.x users need to download two packages. They are (as of March 12, 2000): lm_sensors-2.5.0.tar.gz i2c-2.5.0.tar.gz Linux kernel 2.0.x users need to use an earlier version of the program, downloaded as lm_sensors-2.3.4.tar.gz Earlier versions can be found in distribution-specific formats such as .rpm (for example, at http://fr.rpmfind.net/linux/RPM/contrib/libc6/i386/lm_sensors-2.4.5-3.i386.h tml) and .deb (as sensors-common.*.deb and i2c.*.deb, available via the standard Debian apt-get procedure). Compile the modules using the procedure appropriate to your distribution. The prototype code was compiled for kernel 2.2.13 on Debian 2.2 (potato), using make-kpkg, an extension to kernel compilation designed to simplify compilation of modules distributed outside the kernel source tree. If necessary, compile the userspace programs and install them. Use the program sensors-detect to identify the sensor modules needed by your motherboard, and add them to /etc/modules. Then either reboot or (preferably) run modprobe to install the needed modules. Check the pseudo-file /proc/sys/dev/sensors/chips for the name of the chip being accessed. The pesudo-file-directory /proc/sys/dev/sensors// (replacing with the name found in the previous step) will contain a pseudo-file for each sensor line maintained by that chip. To determine which of these lines report actual motherboard data, refer to the documentation for the motherboard or the "Hardware Monitoring" display offered by the motherboard’s BIOS. Appendix B: Sample Perl Program ------------------- This sample reads the sensor data provided by the SuperMicro SEA370 motherboard. It displays those data, along with system information about CPU use, RAM and swap use, and filesystem use, on a Scott Edwards 2*16 serial LCD display. http://www.Linux-1U.net/LCD/lcd-sensors.pl ------------------------------------"Never tell me the odds!"--- Ray Olszewski -- Han Solo Palo Alto, CA ray@comarre.com ----------------------------------------------------------------