Introduction: LLDPi - Raspberry Pi Network Tool (Colorado State University)

The LLDPi project is an embedded system made from a Raspberry Pi and LCD that can retrieve LLDP (Link Layer Discovery Protocol) information from neighboring devices on a network such as the system name and description, port name and description, VLAN names, and IP management address. In this tutorial we will go over the necessary steps to put together a LLDPi system made up of the following parts:

1x Raspberry Pi 2 B (Or newer) + microSD memory card:

1 x Elecrow 5-inch TFT LCD HDMI Display:

Alternatively you can use this display:

1 x Shutdown circuit (use with button):

1 x 3A UBEC (DC-DC voltage regulator):

1 x Battery Charging module:

4 x 18650 Batteries:

1 x Female Power Jack Socket:

1 x Rocker Switch:

2 x short micro USB cables:

cable connectors:


Spool of 3-D printing filament to print an enclosure for the RamPi *(You will need access to a 3-D printer)

11 x 1/4" machine screws (to hold everything in place)

microSD adapter to read/write from PC with Monitor, HDMI cable, Keyboard & Mouse to setup Raspberry Pi

Step 1: 3D Print Case

To save some time I put this as the first step because 3-D printing will probably be the longest step in this process.

After you have found your favorite color of printing filament that is compatible with the 3-D printer you are going to use, then download these 4 files and start printing them. I used ABS which can cause warping and inconsistent results so you may have to experiment to find the right material.

You might need to apply a scale factor to print these at the right size

(I had to scale the objects down to 0.1%.)

Step 2: Install Raspbian on SD Card

You will need to have a firm understanding of Linux to be able to make a LLDPi.

Go to the link below and download the latest version of Raspbian with Desktop.

Use your computer to write the OS image onto the microSD card. Unzip the Raspbian file and go to the following link to view instructions specific to the OS you are currently using to install the image.

Now we should be able to plug the microSD card into the Raspberry Pi 3 and boot it up. Make sure the raspberry pi is hooked up to a monitor and keyboard and has an internet connection when going through this guide.

Step 3: Setup Raspbian on the Raspberry Pi

First we will make sure that the keyboard works properly by specifying which locale to use. Run the following command, where $ is the command line prompt, don't type it in.

$ sudo raspi-config

This should now take us to a screen where we can edit the Localisation Options, it should be the fourth on the list. Now we want to select Change Locale, go down the list and hit space bar on the locale named en_US.UTF-8 UTF-8 and set it to default on the next screen. We also need to change the timezone by going back into the Localisation Options and select Change Timezone and set it to America / Denver

Now we need to go into Boot Options, Desktop / CLIDesktop Autologin in order for the pi to autologin when booting up. Let's go into the Advanced Options and select Expand Filesystem to use the entire SDcard. We might also want to change the user password by selecting the first option, Change User Password. It is highly recommended to write the password down, don't forget it! The default password is raspberry. Then hit Finish to exit. The Raspberry Pi might need to reboot for the changes to take effect. Now open a terminal and run the following command and select this set of options when prompted,

$ sudo dpkg-reconfigure keyboard-configuration

Generic 105-Key (Intl) PC

Other ->then-> English (US)

The default for the keyboard layout

No compose key


Our next step is to update and upgrade Raspbian to the latest version. To do this simply open a terminal and type,

$ sudo apt-get -y update && sudo apt-get -y upgrade

If the last command doesn't finish properly or gives a message about a broken package, then we might need to reboot and re-run the command. Wait until that finishes running and then execute the following the commands,

$ sudo apt-get -y update

$ sudo apt-get install -y vim tshark tcpdump ethtool gawk

When asked "Should non-superusers be able to capture packets?", hit Yes.

Step 4: Configuring the LCD

The next steps will be to configure the LCD display to work with the Raspberry Pi. Turn off the Raspberry Pi, mount the LCD display and power it back on so that it matches the pictures above. Make sure the HDMI ports line up like shown in the picture and plug in the HDMI connector.

Next, we need to execute the following commands to download and install the driver for the LCD display.

$ git clone

$ cd Elecrow-LCD5

$ chmod +x Elecrow-LCD5

$ sudo ./Elecrow-LCD5

and type y to reboot. After the device finishes rebooting, we will also need to make changes to the display orientation.

$ sudo vim /boot/config.txt

and look towards the end of a file for a line like


and change it to


Reboot the Raspberry Pi, wait until the Raspberry Pi boots up again and open up a terminal. And run the following command to install a way to calibrate the touch screen.

$ sudo reboot

$ sudo apt-get install -y xinput-calibrator xinput xserver-xorg-input-evdev

The X and Y axis of the touch screen need to be swapped so we execute the following commands to finish adjusting the screen.

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0



If there ARE errors after executing the commands above then you can try making these changes to the driver files used by the Raspberry Pi. Depending on which Raspberry Pi you are using for this LLDPi there might be some slight differences with setting up the LCD drivers and/or other settings. When setting this up with a Raspberry Pi 3, there was a problem with the LCD using the following config file


When it should have been using this config file for another driver evdev


To fix this run the following commands,

$ sudo mv /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf

$ sudo reboot

Then try running the commands to swap the X and Y axis again.

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1

$ xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0

If this still does not work then you will need to look for another way of getting the touchscreen configured properly.


If the commands DO work and the touchscreen works properly then proceed to edit the following file to have these 4 lines of code.
$ vim /home/pi/.config/lxsession/LXDE-pi/


xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1

xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0

exit 0

Don't forget to give the script the appropriate file permissions.
$ sudo chmod 755 /home/pi/.config/lxsession/LXDE-pi/

The next command will ensure the app starts and axis are swapped correctly every time the Pi boots up.

$ sudo vim /home/pi/.config/lxsession/LXDE-pi/autostart

Append the following 2 lines,



Step 5: Build the Circuit

Get the soldering iron ready, grab the cable connectors, and begin building the circuit that will allow the 18650 batteries to power the LLDPi. Start with the female power jack socket and solder some cable connectors to attach it to the input end of the UBEC. Then we need to get a male micro usb cable and have it attached to the other end of the UBEC like shown in the picture. The UBEC should have the pin set how it is shown in the close up picture. Then grab the set of 18650 batteries, connect them in parallel and solder a cable connector ready to connect to the battery charging module. Arrange what you have made so far of the circuit into the case along with the batteries.

Before going any further, make sure everything is running as expected so far. If everything functions then it's ready to assemble!

Step 6: Put It All Together

Now screw the battery cover on to the case. The battery charging module should have the UBEC connected through the micro USB, and the batteries on the other side through a pair of cable connectors. The other USB cable on the battery charging module will lead to the shutdown circuit. Get the rocker switch prepared with a cable connector that'll be paired to the shutdown circuit. The shutdown circuit will also have 2 other wires to the raspberry pi for signaling a shutdown sequence, as well as supply power through the other larger USB to the raspberry pi, as shown in the last couple pictures. The larger USB being used in the picture is needed because it supplies 2.1 amps while the other only supplies 1 amp.

If you are having trouble getting the components to fit inside the case, you can try removing the battery cover and stacking the hardware there.

Follow this link to get directions on setting up software and hardware to give the raspberry pi a graceful shutdown switch.

After getting everything setup for the graceful shutdown circuit, make sure you slide the rocker switch into the slot on the side of the case before securing the raspberry pi down with screws, then fit everything into the case ready to add the already-working LCD and put the cover on the case with the screws.

Step 7: Coding the LLDPi Application

Now that we have configured the hardware we can proceed to work out the code that will create a GUI and gather all the information we need. The files with the code necessary for this application are located at the bottom of the page. You should download them and make sure they are in their correct respective directory paths, as shown below.

Make sure to change the file names with a .txt extension to a .sh extension.

$ mkdir /home/pi/LLDPi

$ cd /home/pi/LLDPi

$ touch /home/pi/LLDPi/

$ touch /home/pi/LLDPi/

$ touch /home/pi/LLDPi/

$ touch /home/pi/LLDPi/

$ touch /home/pi/LLDPi/

***Might need to run this to make the scripts above executable

$ chmod 755 filename

$ touch tshark.cap

$ sudo chown root:root tshark.cap

$ touch tcpdump.cap

$ touch displayLLDP.txt

$ touch progess


[Optional] This will make a convenient icon at the Desktop screen that the user can double-click to start the LLDPi Application. Edit the following file to create the icon and make sure it has the following contents.

$ vim /home/pi/Desktop/LLDPi.desktop

[Desktop Entry]


Comment=RUN LLDPi Script




*If you have a picture to use as an icon then add a line to the LLDPi.desktop file that reflects the directory path to the picture,



Give the scripts a test run by checking the output of ./ or by clicking the icon on the main screen

$ vim ~/.bashrc

Add a line like the one below at the end of ~/.bashrc to start the LLDPi app at boot time. /home/pi/LLDPi/

And that should be it, the RamPi should be complete and ready to try out.