Advertisement

LCD displays easy to use and easy to build

Not rated 17,965

#LCD #display #clock #perl #LCDd server #time #date #heartbeat #lcdproc
LCD displays easy to use and easy to build
LCD displays easy to use and easy to build

Description: This example implements a clock using 36 lines of Perl code. It displays the time and date, with a small icon called "heartbeat" in the upper right corner. The "heartbeat" icon, added by the LCDd server, blinks intermittently to indicate that the display is operational. The LCDproc framework allows for more than just strings; it supports bar graphs, scrollers, title bars, and text strings. At the beginning of the program, these objects (referred to as widgets) are defined and subsequently filled with data. This is detailed in the LCDproc Developer's Guide, starting from page 7. The Perl script initiates communication, sets the client name, and defines a text string widget. It continuously updates the LCD with the current date every 10 seconds.

The parallel port of a PC operates under specifications that provide 5V. Modern LCD displays, such as those from Tuxgraphics, require minimal power, only 2 mA. This low current allows for the possibility of powering the display directly from the parallel port, eliminating the need for an additional power connector. However, not all parallel ports adhere to specifications. To test if the parallel port can support a "self-powered" solution, a 33K resistor can be connected between pin 1 and pin 18; the voltage should drop to 4.25V. If it is higher, the parallel port is suitable for this application. If the test is unsuccessful, alternative power sources include the internal 5V supply of the PC or a free USB connector. The pin assignments for the parallel port to the LCD are as follows: pin 1 (strobe) = 220V; pin 2 (D0) = LCD pin D4; pin 3 (D1) = LCD pin D5; pin 4 (D2) = LCD pin D6; pin 5 (D3) = LCD pin D7; pin 6 (D4) = LCD pin RS; pin 7 (D5) = LCD pin RW; pin 8 (D6) = LCD pin EN; pin 10 (ACK) = button A (upper red button); pin 12 (PE) = button C (lower black button); pin 14, 16, and 17 (strobe) = 220V.

The implementation of this clock using Perl and an LCD display demonstrates a practical application of interfacing software with hardware components. The LCD display serves as a visual output device for timekeeping, while the Perl script manages the data flow and updates the display at regular intervals. The use of the parallel port for power simplifies the design by reducing the number of required connections, making the overall setup more user-friendly. The integration of the "heartbeat" icon provides an additional layer of functionality, indicating the operational status of the display. This project exemplifies the intersection of software programming and electronic hardware, showcasing how simple coding can yield effective results in real-world applications.Here is an example which implements a clock in just 36 lines of perl code. It displays time and date and the upper right corner shows a little icon called "heartbeat". The "heartbeat" is added by the LCDd server. This "heartbeat" icon blinks once in a while to indicate that the display is still alive. In lcdproc you can have more than just strings. You get bar-graphs, scrollers, title bars. and text strings. At the beginning of the program you define those objects (they are called widgets) and then you fill them with data. It`s explained in the LCDproc Developer`s Guide from page 7 and on wards. #!/usr/bin/perl -w. # initiate the communication: print $remote "hello ";. # set our name and define a text string widget print $remote "client_set name lcdtime "; print $remote "screen_add scr1 "; print $remote "widget_add scr1 str1 string ";.

while(1) {. $date = scalar localtime; # now write to the LCD: print $remote "widget_set scr1 str1 1 1 "$date" "; sleep 10; } The parallel port of a PC works according to specifications with 5V. If you now take a look at the datasheet of a modern LCD display (e. g from tuxgraphics: ) you will notice that even though the displays are big they need extremely little power.

Only 2 mA ! With so little current it must be possible to power the display directly from the parallel port. The advantage is then that you do not need any extra power connector. It is just one LCD display with one connector to the parallel port. Very convenient. It is possible with a parallel port that really provides 5V. The problem is that there are some which do not follow the specifications. So how do you know if your parallel port is good enough for "self powered" solution Here is a little test: Now connect a 33K resistor to the parallel port between pin 1 and pin 18. The voltage should go down to 4. 25V. If you get more then your parallel port is very good. If you get less then the "self powered" solution will not work. If this test passes then you can go for the "parallel port power" solution using the tuxgraphics 20x2 display (or equivalent).

This is tested. It will work. If your parallel port is a bit weak then don`t worry too much. You can either use the internal 5V of your PC (you have to open it for this purpose) or you can get 5V from an free USB connector. Parallel port pin 1, strobe = 220, supply voltage pin 2, D0 = LCD pin D4 pin 3, D1 = LCD pin D5 pin 4, D2 = LCD pin D6 pin 5, D3 = LCD pin D7 pin 6, D4 = LCD pin RS pin 7, D5 = LCD pin RW pin 8, D6 = LCD pin EN pin 10, ACK = button A, upper red button pin 12, PE = button C, lower black button pin 14, strobe = 220, supply voltage pin 16, strobe = 220, supply voltage pin 17, strobe = 220


Related Circuits