Adding an L.C.D. (Liquid Cristal Display) to BFW Server.

Several tutorials

Adding an L.C.D. (Liquid Cristal Display) to BFW Server.

Mensagempor BrazilFW » Seg Dez 24, 2007 7:31 pm

How to wire an L.C.D. to BFW
Get the software list & links on the bottom of this page.

*** ADVICE ***

Be sure that you can deal with electronic circuits.
I am not responsible for damages in your system or L.C.D.
All the wiring schemes described here have been tested.
This produtc is intended to be professionally installed.
For additional information, scroll down this page.


1) Choose your LCD: (HD44780 compatible LCD display preferred).

LCD example:

Imagem
Imagem

2) Use these standard pinouts as a reference:

Imagem

3) Use this wiring (Rasa) for one LCD (2x16, 2x20, 4x16, 4x20):

Imagem

3a) Use this wiring (Rasa) for two LCDs sets.

Imagem


3b) Use this wiring (Rasa) for three LCDs sets.(*NOT TESTED YET !*)

Imagem


4) For digital backlight control (lcd.tgz command --> [b = toggle backlight ON/OFF)

Imagem

5) Attention, double check the printer cable pinouts as below.

Imagem

6) Printed Circuit Board Example:

Imagem

7) First image on L.C.D. (= power on and wiring OK.)

Imagem

BrazilFW Running Lcdstats

Imagem
Imagem


Attention !

If you don't have a 100 ohms potentiometer, a 50 ohms resistor is necessary on +5v backlight power (this prevents it from overheating, as backlight LEDs work around 4,2 volts).
If you don't have a 10k ohms contrast control potentiometer, connect this terminal to ground, for maximum contrast.

Imagem

Another examples: power wire color reference and LCD working as "Spectrum Analizer" on WinAmp.

Imagem
Imagem

Download this files: sysinfo.tgz, lcd.tgz, lcdstats.tgz

This new sysinfo.tgz includes the modifications from Marcio (MPG thanks again) and several fixes/modifications from Claudio, (many thanks for the fixes).


Install and have fun :)

Installation:

1) Put sysinfo.tgz, lcdstats.tgz and lcd.tgz on your BrazilFW floppy, then reboot,

2) Or boot from a DOS disk and copy this files to HD and reboot,

3) Or if you don't want to reboot, do the following:

cd /
mount /dev/fd0 /mnt
tar zxvf /mnt/sysinfo.tgz
tar zxvf /mnt/lcdstats.tgz

tar zxvf /mnt/lcd.tgz

umount /mnt
/etc/rc.d/pkgs/rc.sysinfo


Attention! If your LCD panel not is an 2x16 (2rows by 16 caracters) it's necessary set up de mod.lcd file to format all text to be showed.

Código: Selecionar todos
edit etc/rc.d/pkgs/mod.lcd


See below the mod.lcd:

Código: Selecionar todos
#Instaling Parallel Port Support
insmod /lib/parport/parport.o
insmod /lib/parport/parport_pc.o

#Installing LCD Support

#You must enable only one of the tree modules below
#If you want to save some space you can delete the unused modules
#from the folder /lib/lcd

#insmod /lib/lcd/lcd.o       io=0x378 disp_rows=2 disp_cols=16 # Standard Wiring
insmod /lib/lcd/lcd-rasa.o io=0x378 disp_rows=2 disp_cols=16 # Rasa Wiring
#insmod /lib/lcd/lcd-8bit.o io=0x378 disp_rows=2 disp_cols=16 # 8 Bits Wiring

#You can change the parameters above if your lcd display
#is not a 2X16 caracters or is not pluged to the first parallel port


4) On Webadmin see Bandwidth Usage Statistics, beautiful graphs about traffic streams.

Lcdstats & Bwmon running

Imagem
Imagem

As you can see, your link is showed on LCD as DOWN or downstream value.

Default configuration: DL = Download, UL= Upload, Men = Memory Usage % and Ld = Processor Load ( 1.00 = 100%, 0.10 = 10%)

You can change this informations editing lcdstas.tgz

On root type : edit /usr/bin/lcdstats

The Lcdstats script is showed below.

#!/bin/sh

while [ 1 ] ; do
BW_IN=DOWN
BW_OUT=DOWN

LOADAVG_1MIN=`cat /proc/loadavg | cut -f 1 -d ' '`
MEMTOTAL=`free | grep Mem | sed s/\ */#/g | cut -f 3 -d '#'`
MEMUSED=`free | grep Mem | sed s/\ */#/g | cut -f 4 -d '#'`
PERCUSED=$((MEMUSED*100/MEMTOTAL))

. /tmp/netsubsys.state
if [ "$INET_UP" = "UP" ] ; then
if [ -e /tmp/bwmon.log ] ; then
bwstats > /tmp/bwstats.log
if [ $? = 0 ] ; then
if [ -e /tmp/bwstats.log ] ; then
. /tmp/bwstats.log
BW_IN=$BW_CUR_DOWN_K
BW_OUT=$BW_CUR_UP_K
fi
fi
fi
fi

# And send it to the LCD
echo -ne "\033[H\033[J" > /dev/lcd
echo -ne "D:${BW_IN} U:${BW_OUT}\r\n" > /dev/lcd
echo -ne "Mem:$PERCUSED% Ld:$LOADAVG_1MIN" > /dev/lcd

# Wait a bit
sleep 3
done


Comments:

echo -ne "\033[H\033[J" > /dev/lcd -> Clear all LCD screen.

echo -ne "DL:${BW_IN} UL:${BW_OUT}\r\n" > /dev/lcd -> Show DL and UL, carriage return (r)

and jump to the second line(n)

Sleep 3 -> For slow computers, you can increase or decrease this time.

If you find another information and ways to show it, please, advise me !!!

Below you can see "my" lcdstast.tgz script, with "paging" function.


Código: Selecionar todos
#!/bin/sh
#configuration
config() {
########## welcome configuration ##########
h=`date +%H`
dia=`date +%d/%m/%Y`
hms=`date +%H:%M:%S`
h=`date +%H`
if [ $h -lt "12" ] ; then
memo="Good Morning!"
elif [ $h -lt "18" ] ; then
memo="Good Afternoon!"
else
memo="Good Night!"
fi
#### showing I.P. configuration##########
. /etc/coyote/coyote.conf
interno=$LOCAL_IPADDR
externo=$IPADDR
####download, upload, memory usage and load processor######
BW_IN=DOWN
BW_OUT=DOWN
LOADAVG_1MIN=`cat /proc/loadavg | cut -f 1 -d ' '`
MEMTOTAL=`free | grep Mem | sed s/\ */#/g | cut -f 3 -d '#'`
MEMUSED=`free | grep Mem | sed s/\ */#/g | cut -f 4 -d '#'`
PERCUSED=$((MEMUSED*100/MEMTOTAL))
########## network adapter up down##########
. /tmp/netsubsys.state
if [ "$INET_UP" = "UP" ] ; then
if [ -e /tmp/bwmon.log ] ; then
bwstats > /tmp/bwstats.log
if [ $? = 0 ] ; then
if [ -e /tmp/bwstats.log ] ; then
. /tmp/bwstats.log
BW_IN=$BW_CUR_DOWN_K
BW_OUT=$BW_CUR_UP_K
fi
fi
fi
fi
}

########## lcd menu 1 ##########
menu1() {
config
echo -ne "\033[H\033[J" > /dev/lcd
echo -ne " Loading... \r\n" > /dev/lcd
echo -ne " \n" > /dev/lcd
echo -ne "    BrazilFW    \n" > /dev/lcd
echo -ne "Firewall  Router" > /dev/lcd
sleep 2
}

######### lcd menu 2 ###########
menu2() {
config
echo -ne "\033[H\033[J" > /dev/lcd
echo -ne "BrazilFW Router\n" > /dev/lcd
echo -ne "Welcome !" > /dev/lcd
sleep 2
}

########## lcd menu 3 ##########
menu3() {
config
echo -ne "\033[H\033[J" > /dev/lcd
echo -ne " ${memo}\r\n" > /dev/lcd
echo -ne "\n" > /dev/lcd
echo -ne "Hour:  ${hms}\n" > /dev/lcd
echo -ne "Date: ${dia}" > /dev/lcd
sleep 2
}

########## lcd menu 4 ##########
menu4() {
config
echo -ne "\033[H\033[J" > /dev/lcd
echo -ne "LAN: ${interno}\r\n" > /dev/lcd
echo -ne "WAN: ${externo}\n" > /dev/lcd
echo -ne "Dw:${BW_IN} Mem:$PERCUSED%\n" > /dev/lcd
echo -ne "Up:${BW_OUT} CPU:$LOADAVG_1MIN%" > /dev/lcd
sleep 1
}

#Here, you put the menu name in sequence to be showed.
#Menu 1, shows data only on boot.
#The menu2, 3 and 4 stay on loop.
#DO NOT ERASE THIS LINE -> "while [ 1 ]; do" AND "done"
#every thing inside this lines goes to infinite loop.

menu1
while [ 1 ]; do
menu1
menu2
menu3
menu4
menu4
menu4
menu4
menu4
menu4

done
exit



Useful Commands

\033 = Sends ESC, which all special commands begin with.
[A = Move the cursor up one row.
[B = Move the cursor down one row.
[C = Move the cursor right one position.
[D = Move the cursor left one position.
[H = Move the cursor home, to the upper left corner (position 0,0)
[J = Erase everything, does NOT move the cursor home!
[K = Erase to end of line, does NOT move the cursor home!
[M = Map character (haven't tried this one)
[Y = Direct access to position
[R = CGRAM Select (haven't tried this one)
[V = Linewrap ON
[W = Linewrap OFF
[b = Toggle backlight ON/OFF <------- SEE ELETRICAL WIRING TO DO THIS.
\r = Carriage return (return cursor to position 0 on current line!)
\n = Newline
\t = Tab (Default 3 positions)

Example: Clear the screen, then move the cursor home:

On root ->echo -ne "\033[H\033[J" > /dev/lcd

================================================
Imagem
================================================

Yes, you can use lcd4linux too, but once a time.
You can't run LCDSTATS with LCD4LINUX installed and vice versa.
So, make a choice about one of the two pieces of software.

LCD4Linux is very beautiful and you can create animated characters or icons as you want.

My opinion about LCD4LINUX versus LCDSTATS.

LCDSTAST is useful, because it indicates link down.
LCD4LINUX is more "animated" and looks like exactly as this gif -> Imagem

LCD4LINUX running:

Imagem

Imagem

Softwares: (click on name to download)

lcdstats.tgz
lcd.tgz
sysinfo.tgz
lcd4linux.tgz

Be careful, Internet Explorer may rename .tgz to .tar, if so, rename again to .tgz

Any doubt, give me a call, Marcelo - Brazil
BrazilFW
 

Voltar para Several tutorials

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 0 visitantes

cron