Sunday 20 November 2016

Displaying aprx-rf log onto 4x20 LCD display

Received a request on a short how-to to get the aprs packet shown in the 20x4 LCD display. The way I have for my setup are the following:

1. Raspberry Pi 3 (Raspberry Pi 2 will work, but below that, you need to have different kind of connection for the GPIO).
2. 20x4 LCD HD44780 or compatible screen.
3. Install lcdproc package ($ sudo apt-get install lcdproc)
4. A modified HD44780 driver,

I'm using the following diagram for my LCD connection to the GPIO lines. Ignore the temp sensor connection.

*Connection diagram taken from rototron.info website.

The how-to to get the LCD working can be found on the http://www.rototron.info/lcdproc-tutorial-for-raspberry-pi/ too.

A modified HD44780 driver can be found down below along with my python code.

Or download or compile your own following the thread in the following forum link:

https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=100066

This modified driver need to be moved into /usr/lib/arm-linux-gnueabihf/lcdproc/ directory and replacing the driver that comes with the lcdproc package.

Add the correct configuration (if missing) from your /etc/LCDd.conf. I've the following:

[server]
DriverPath=/usr/lib/arm-linux-gnueabihf/lcdproc/
NextScreenKey=Right
PrevScreenKey=Left
ReportToSyslog=yes
ToggleRotateKey=Enter
Driver=hd44780
ServerScreen=no


[hd44780]
ConnectionType=raspberrypi
Size=20x4

Done with the above, you can test your LCD setup if it is working correctly, run the LCD and lcdproc daemon:

$ sudo /etc/init.d/LCDd start
$ sudo /etc/init.d/lcdproc start

The above should bring up your LCD alive and show the cpu information etc if everything set correctly. You can enable or disable what to be displayed in configuration file /etc/lcdproc.conf. For me, I've disabled most of them except the cpu information.

Now, you've got the LCD working. Great, now the fun part to code a simple python script so that it will read the aprx log file and display the last line into the LCD screen. You need at least a Python 2.7 which I believe should be installed as default. You also need few more packages, namely the aprslib (to parse APRS packets), lcdproc (for displaying to LCD) and LatLon (for calculating distance).

To install the lastest aprslib python package, please refer to the following website:

https://pypi.python.org/pypi/aprslib

To install the latest lcdproc package, you can refer to the official website:

https://github.com/jinglemansweep/lcdproc

And lastly the LatLon package can be found here:

https://pypi.python.org/pypi/LatLon/1.0.2

My lovely looking python coding, modified driver and startup script to get everything to appear on LCD screen can be found here:

https://drive.google.com/open?id=0B_kYO6BlPebVdjR4QUJuVkM2dG8

To run the above python code, just run it against the aprx-rf.log, example:

$python aprx_lcd.py /var/log/aprx-rf.log

I have it running as a daemon by creating a startup script in /etc/init.d/. Sample can be found in the above file in my google drive.

Have fun!







No comments:

Calling MS SQL Stored Procedure from ABAP

One of the few things sometime coming up in your ticket request. Calling stored procedure from ABAP to remote SQL server.  How do we send th...