Category Archives: Smartie-utils

Using LCDProc and Smartie Utils on SureElectronics LCD

This is a brief post about how to get smartie-utils and/or LCDProc working with a USB SureElectronics LCD display.

My testing was on a “20×4 LCD Display with UART Based USB (Edition 1)”, which I connected via USB to my hosts. I tested this on my regular server candidate as well as RaspberryPi.

First you need to head over to google and grab the source for smartie-utils which is written in TCL.

Once you have that you might think you are home free to start using, but the TCL scripts require cmdline.tcl which you can get from the TCLlib. I was testing on debian so this was easy with an apt-get:

apt-get install tcllib

If you run the smartie-utils without that TCLlib you will probably get an error back from tclsh saying that it cant find “cmdline.tcl”.

Once you have got this installed and the code downloaded and unzipped you should see amongst a README and several other files, three main files.

I used smartie-cat.tcl as the basis for my test.

tclsh smartie-cat.tcl -tty /dev/ttyUSB0 test.txt

Inside test.txt just put a few lines of text, this is what will get read in and pushed to the display.

This requires a few arguments one is the tty device that was given to you when you plugged the device in, you should be able to see that in dmesg or /var/log/messages.

In my case it was ttyUSB0.

The last argument is a filename for smartie-cat to read its input from. So I created a test file from which smartie-cat would be able to send the contents to the LCD display.

This was pretty straightforward, but what if I wanted to be able to send a real command to smartie-cat??

I tried using the following and piped command output to smartie-cat, which worked pretty well, only problem is that without any pre-formatting anything larger than the display can accomodate was truncated instead of scrolling for example.

uptime|tclsh smartie-cat.tcl -tty /dev/ttyUSB0

while :; do uptime|tclsh smartie-cat.tcl -tty /dev/ttyUSB0; sleep 5; clear; done

But for proof of concept this worked well.

Next up I also tested using LCDProc, by default this didnt have the driver that I needed for the LCD display, so it was necessary to pull down the source version so I could compile in the required support.

There was a really handy post here, which helped me with most of the steps:

cvs -d:pserver:[email protected]:/cvsroot/lcdproc login
cvs -z3 -d:pserver:[email protected]:/cvsroot/lcdproc co -P lcdprocsh ./autogen.sh
./configure –enable-drivers=SureElec
make
sudo make install

I had limited success with the rest of the documentation, and had to change the Driver details, as it didnt seem to work with the suggested parameters, so I’ve included those here(I had to specify driver “File” instead of name):

[SureElec]
DriverPath=/usr/local/lcdproc/lib/lcdproc/
File=/usr/local/lcdproc/lib/lcdproc/SureElec.so
# Port the device is connected to  (by default first USB serial port)
Device=/dev/ttyUSB0
# Edition level of the device (can be 1, 2 or 3) [default: 2]
#Edition=2
# set display size
# Note: The size can be obtained directly from device for edition 2 & 3.
Size=20x4
# Set the initial contrast [default: 480; legal: 0 - 1000]
Contrast=200
# Set the initial brightness [default: 480; legal: 1 - 1000]
Brightness=480
# Set the initial off-brightness [default: 100; legal: 1 - 1000]
# This value is used when the display is normally
# switched off in case LCDd is inactive
#OffBrightness=100

Once I had made these changes I started up LCDProc explicitly to use the SureElec driver:

LCDd -d SureElec

You may notice that once the LCDd process starts you will get an error about the dimensions of the display being misinterpreted, this for me was safe to ignore and did not affect the test.

I then executed the following and checked that the output was successfully sent to the display. Theres some great documentation on LCDProc and how to get histograms,etc sent to the display.

Here’s an image of my SureElectronics display:

Sure Electronics LCD display for LCDProc
Sure Electronics LCD display

 

 

 

 

 

 

 

Heres the command I sent to LCDProc:

lcdproc G L I U

Next I’m going to attempt to write my own LCDProc modules to plugin to the display, these could include performance statistics for certain programs or alerts for certain events. I’m thinking it would be good to write something if its not already out there as a plugin to asterisk. I’ll report back here with some examples when I’m there!

(c)Matt Palmer 25 June 2013