239 lines
12 KiB
HTML
239 lines
12 KiB
HTML
<!--startcut ==============================================-->
|
|
<!-- *** BEGIN HTML header *** -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML><HEAD>
|
|
<title>Displaying Real Time System information on a LCD Display using LCDproc & lcdmod LG #76</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!-- *** END HTML header *** -->
|
|
|
|
<CENTER>
|
|
<A HREF="http://www.linuxgazette.com/">
|
|
<IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.png"
|
|
WIDTH="600" HEIGHT="124" border="0"></A>
|
|
<BR>
|
|
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="sunil.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue77/taneja.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../lg_faq.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
<P>
|
|
</CENTER>
|
|
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4 ALIGN="center">
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<H1><font color="maroon">Displaying Real Time System information on a LCD Display using LCDproc & lcdmod</font></H1>
|
|
<H4>By <a href="mailto:tanejagaurav.hotmail.com">Gaurav Taneja</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
|
|
<!-- END header -->
|
|
|
|
|
|
|
|
|
|
<P>Being a System Administrator or a Linux enthusiast/user, we almost
|
|
always keep an eye on important system information like disk usage,
|
|
memory usage, cpu load, users logged in etc., now how about having
|
|
all this information on a sleek LCD Display kept next to your monitor
|
|
?</P>
|
|
<P>LCD or a Liquid Crystal Display is almost seen everywhere ranging
|
|
from digital watches to microwave ovens, from audio systems to PDA's
|
|
and even some high-end servers. There are several cheap commercially
|
|
available displays which can be controlled through the computer's
|
|
parallel port or the serial port(RS-232). LCDs are manufactured by
|
|
quite a few different companies. Units typically seen in the surplus
|
|
market come from Hitachi, Epson, Hewlett Packard, Optrex, or Sharp.
|
|
Common configurations are 16, 20, 24, 32, or 40 characters by 1, 2,
|
|
or 4 lines.</P>
|
|
<P>I have personally tried out Hitachi HD44780 compatible 16X2 LCD
|
|
display which are easily available from many display vendors and can
|
|
be controlled through the parallel port. Please do note that some
|
|
displays come with an option of backlight and others don't, the ones
|
|
with a backlight option have some more pins to control the backlight
|
|
and are bit more expensive, so the choice is yours!!</P>
|
|
<H2>A Word of Caution</H2>
|
|
<P>Before you embark on this exciting exercise beware that LCD
|
|
Displays are really sensitive to improper wiring and operate only on
|
|
specific voltages(typically 5V or 12V), if anything is messy they
|
|
burn up!! also before you buy a display make sure that you also
|
|
procure a pin configuration diagram and a technical data sheet along
|
|
with it so that you have all the information handy when required.</P>
|
|
<H2>What all do i need?</H2>
|
|
<P>Before you begin do make sure that you everything in the checklist
|
|
given below:</P>
|
|
<UL>
|
|
<LI><P>A HD44780 compatible LCD Display (don't worry about the
|
|
brand, just make sure from the vendor that it is Hitachi HD44780
|
|
compatible. by the way HD44780 is a display with an onboard
|
|
controller which understands some standard instructions(protocol) to
|
|
show characters on the screen from it's internally defined character
|
|
set)</P>
|
|
<LI><P>A Parallel Port (Centronics) connector with a cable
|
|
attached(make sure you have a long cable with loose wires on the
|
|
other end).</P>
|
|
<LI><P>A soldering iron with some solder & flux (ask any
|
|
electronic enthusiast friend of yours if you can't do this stuff
|
|
yourself).</P>
|
|
<LI><P>A power supply source (you'd typically require 5V or 12 V DC
|
|
power supply, a AC to DC adapter available at your local electronic
|
|
store will solve the purpose).</P>
|
|
<LI><P>LCDproc (can be downloaded at <A HREF="http://lcdproc.omnipotent.net/download.php3">http://lcdproc.omnipotent.net</A>)
|
|
or/and lcdmod (available at <A HREF="http://lcd-mod.sourceforge.net/">http://lcd-mod.sourceforge.net</A>)</P>
|
|
</UL>
|
|
<P><BR><BR>
|
|
</P>
|
|
<H2>Let's get Wired!!</H2>
|
|
<P>Before you attempt to wire up the display with your computer
|
|
remember that you have to be pretty cautious with what you do here
|
|
otherwise you can damage either the display or your computer, so if
|
|
you are not aware of assembling simple electronic circuits, don't get
|
|
disheartened. just ask some electronics geek friend of yours.</P>
|
|
<P>I am taking an example of a HD44780 Display which i have connected
|
|
with the parallel port of my linux box as per the following wiring
|
|
diagram:</P>
|
|
<P><IMG SRC="misc/taneja/parlcd.png" ALIGN=LEFT WIDTH=398 HEIGHT=285 BORDER=0 alt="Wiring Scheme (HD44780)"><BR CLEAR=LEFT>
|
|
<BR><BR>
|
|
</P>
|
|
<P>This wiring scheme works fine for all HD44780 type displays and
|
|
should hopefully work fine with your setup too.you can check whether
|
|
your display is alive by adjusting the 'Contrast' resistor in the
|
|
diagram above, it should show dark bands on the display when the
|
|
resistor is at it's minimum value.</P>
|
|
<H2>Installing the Software</H2>
|
|
<P>I have taken examples for both LCDproc and lcdmod, you can install
|
|
either of these to test your display. If you are a newbie it's better
|
|
you check out LCDproc first.</P>
|
|
<P>Firstly extract the archive you've downloaded:</P>
|
|
<P><PRE>[root@Linux gaurav]# tar -zxvf lcdproc-0.4.1.tar.gz</PRE>
|
|
<P>Next configure LCDproc with your parameters
|
|
</P>
|
|
<P>
|
|
<PRE>[root@Linux gaurav]# cd lcdproc-0.4.1
|
|
|
|
<P>[root@Linux lcdproc-0.4.1]# ./configure --enable-drivers=curses,hd44780</PRE>
|
|
<P>This will configure and generate a Makefile so that you can test
|
|
your installation with a curses based preview as well as use your
|
|
HD44780 compatible display.</P>
|
|
<P>Let's now compile and finish our installation:</P>
|
|
<P><PRE>[root@Linux lcdproc-0.4.1]# make install</PRE>
|
|
<P>After you're done, we can test our installation with a check on
|
|
the console itself by issuing the command</P>
|
|
<P><PRE>[root@Linux lcdproc-0.4.1]# LCDd -d curses -f</PRE>
|
|
<P>This shows a nifty little curses screen on your terminal with
|
|
vital system information scrolling one by one. now for the real
|
|
thing!! you can connect your LCD display with it's power supply on
|
|
and start up the display by:</P>
|
|
<P><PRE>[root@Linux lcdproc-0.4.1]# LCDd -d hd44780
|
|
</PRE>
|
|
<P>[root@Linux lcdproc-0.4.1]# lcdproc C M T X
|
|
</P>
|
|
<P>This should bring up your LCD Display to life and show something
|
|
like this:</P>
|
|
<P STYLE="margin-bottom: 0in"><IMG SRC="misc/taneja/lcdproc.png" ALIGN=LEFT WIDTH=121 HEIGHT=37 BORDER=0 alt="LCD Display"><BR CLEAR=LEFT>
|
|
<BR>
|
|
</P>
|
|
<P STYLE="margin-bottom: 0in"><IMG SRC="misc/taneja/lcdproc2.png" ALIGN=LEFT WIDTH=121 HEIGHT=37 BORDER=0 alt="LCD Display"><BR CLEAR=LEFT>
|
|
<BR>
|
|
</P>
|
|
<P><IMG SRC="misc/taneja/lcdproc3.png" ALIGN=LEFT WIDTH=121 HEIGHT=37 BORDER=0 alt="LCD Display"><BR CLEAR=LEFT>
|
|
<BR><BR>
|
|
</P>
|
|
<P>By the time you've installed and configured LCDProc you must have
|
|
realized that this software is actually based on a client-server
|
|
model. The LCDProc server starts first with the client programs
|
|
connecting to it and displaying the information. infact you can
|
|
telnet to the LCDProc server (LCDd, the daemon process) and execute
|
|
the commands manually.But, what if you want a faster mechanism to
|
|
display and want to do away with all this socket thing. Well lcdmod's
|
|
here to the rescue.</P>
|
|
<H2>Lcdmod</H2>
|
|
<P>Lcdmod is a Character device driver for all HD44780 compatible
|
|
displays written by Michael McLellan.It's much more faster then
|
|
lcdproc and you can write stuff to the lcd as you are writing to any
|
|
other device.</P>
|
|
<P>Let's get going through the installation, i've assumed that you
|
|
have your lcd display properly wired up and tested with LCDProc.
|
|
</P>
|
|
<P>Firstly let's uncompress the source archive:</P>
|
|
<P>
|
|
<PRE>[root@Linux gaurav]# tar -zxvf lcdmod-0.5.5.tgz
|
|
|
|
<P>[root@Linux gaurav]# cd lcdmod-0.5.5</PRE>
|
|
<P>Let's 'make' the source and install it:</P>
|
|
<P>
|
|
<PRE>[root@Linux lcdmod-0.5.5]# make
|
|
|
|
<P>[root@Linux lcdmod-0.5.5]# make install</PRE>
|
|
<P>This creates a LKM(Linux kernel Module) & a device named
|
|
'lcd' that will point to your LCD hardware.</P>
|
|
<P>Insert the LKM we've bulit by issuing:</P>
|
|
<P>
|
|
<PRE>[root@Linux lcdmod-0.5.5]# insmod lcd io=0x378 disp_rows=2 disp_cols=16</PRE>
|
|
<P>This inserts the module specifying the i/o based address of your
|
|
parallel port (io), no. of rows(disp_rows) & no. of columns
|
|
(disp_cols) of your display.</P>
|
|
<P>Now let's confirm whether the module has really gone in:</P>
|
|
<P><PRE>[root@Linux lcdmod-0.5.5]# lsmod</PRE>
|
|
<P>This should show an entry of the lcdmod module along with any
|
|
other modules inserted (if any).</P>
|
|
<P>You can now display any text on your LCD by just issuing the a
|
|
single command. eg.,</P>
|
|
<P><PRE>[root@Linux lcdmod-0.5.5]# echo Hello > /dev/lcd</PRE>
|
|
<P>This displays 'Hello' on your display. The aim of this article was
|
|
to give you all the information to control an LCD display, so now it's
|
|
up to your creativity and skills that how you implement this
|
|
idea in your specific scenario. I've used a LCD Display for developing
|
|
an employee logging system with a custom keypad, with the whole thing
|
|
being web-enabled. ;-)</P>
|
|
<H2>More information</H2>
|
|
<P>More information about configuring and wiring schemes can be had
|
|
from <A HREF="http://lcdproc.omnipotent.net/">LCDProc</A> &
|
|
<A HREF="http://lcd-mod.sourceforge.net/">lcdmod</A> Project Pages.</P>
|
|
|
|
|
|
|
|
|
|
<!-- *** BEGIN bio *** -->
|
|
<SPACER TYPE="vertical" SIZE="30">
|
|
<P>
|
|
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Gaurav Taneja</H4>
|
|
I'm working with a Software MNC as a Technical Consultant in New Delhi,
|
|
INDIA and actively involved in open-source projects related to
|
|
Linux,Java,C/C++ with some projects hosted on
|
|
<A HREF="http://sourceforge.net/">SourceForge</A> also.
|
|
|
|
<P> In my spare time I work on developing computer interfacing circuits and
|
|
programs and developing software on Linux. I also run my own software
|
|
consulting company named
|
|
<A HREF="http://www.broadstrike.com">BroadStrike Technologies</A>.
|
|
|
|
<!-- *** END bio *** -->
|
|
|
|
<!-- *** BEGIN copyright *** -->
|
|
<P> <hr> <!-- P -->
|
|
<H5 ALIGN=center>
|
|
|
|
Copyright © 2002, Gaurav Taneja.<BR>
|
|
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
|
Published in Issue 76 of <i>Linux Gazette</i>, March 2002</H5>
|
|
<!-- *** END copyright *** -->
|
|
|
|
<!--startcut ==========================================================-->
|
|
<HR><P>
|
|
<CENTER>
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="sunil.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue77/taneja.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../lg_faq.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
</CENTER>
|
|
</BODY></HTML>
|
|
<!--endcut ============================================================-->
|