Raspberry Pi/Projects/Wallboards

From r00tedvw.com wiki
Jump to: navigation, search

Contents

Overview

Project was tasked to create a replacement solution for a grid of 6x1 100" projector screens displaying a shoretel call center queue and details.
New office space does not have a NOC, only an 8ft ceiling, and the call center cubicles are surrounded by a glass wall to the outside, allowing lots of sunlight. This would prevent projectors from being used.
The cubicles are setup in cubes, with the desks facing the center of the cube. This makes it so that analysts are facing different directions.
The shoretel application on runs on Windows.
It was thought that the shoretel API may be able to be utilized, but unfortunately it alone does not provide enough access to information and direct calls against the SQL Database would be needed. With this discovered, it was decided the development work would be too great.

Requirement

Create 4 clusters of 6 monitors, 3 facing one way and 3 facing the other, that hang from the ceiling using mounts (similar to an airport or trader setup) above 4 cubicles all facing towards the analysts. On the walls, mount (4) large LCD screens.
The 6 monitor clusters would be close to the analysts and provide detailed information about specific call queues while the large LCD screens would provide a graphical representation of the total queue count in graph format.
The outside monitors of each row display the same information while the middle ones display different information.

Problem

The classical method of sending signals to these monitors would be to utilize 5 strand RGB cables to each monitor and run them back to repeaters to duplicate signals. This has the drawbacks of an excess of cabling needed, signal repeaters which can be unreliable, and no way to individually customize each screen if desired.

Solution

Use a raspberry pi 2 for each monitor, driving the signal from the hdmi out. The raspberry pi would then VNC into a windows VM running the required software and displaying the call center information. This would allow the existing network infrastructure to be used as only a network connection and AC power is required per display. Wireless could have removed the network connection requirement, but wasnt considered reliable enough for a continuous 13hr+ per day connection.

Configuring the Raspberry Pi 2

At the time of this writing, the OS choices for the raspberry pi 2 were limited to noobs, raspbian, and ubuntu.

  • Noobs - wasn't considered
  • Ubuntu - was command line only unless you wanted to install a GUI yourself following unofficial instructions
  • Rasbian - the best choice as it had the groundwork needs, was very well supported, and ran smoothly on the RPI2

Installing Rasbian

Unfortunately using the linux/mac way of writing the image with dd did not work. The image wrote, but the pi would not read and card or boot. Instead I used the Windows method.

  1. Format the card using the SD Association's Formatting tool. Select the correct drive letter, change "Format Size Adjustment" option to ON so that the entire size is formatted and utilized.
  2. Download the distribution image desired from the raspberrypi.org downloads page
  3. Extract the .img file from the compressed .zip
  4. Using the Win32DiskImager select the .img and drive letter of the SD card, then click write.

First boot

You'll be prompted to select a few options on first boot. Make sure you select these:

  • Use full SD card space
  • Change desktop to default load
  • Set timezone
  • Set keyboard layout, I chose Microsoft Internet Keyboard and English (US) and it successfully mapped all the keys, even problem ones like | and #.

update

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

set date&time

Check to see what is setup

~$ date
Mon Feb 16 09:18:15 EST 2015

Depending on the outcome, pick what you need to fix it from below:

Set time zone

run the following then just follow the prompts

~$ sudo dpkg-reconfigure tzdata
Set the date&time
~$ sudo date newdatetimestring

newdatetimestring is in this format: nnddhhmmyyyy.ss

  • nn= month (01 -12)
  • dd= day (01-31)
  • hh= hour (00-23)
  • mm= minute (00-59)
  • yyyy= year (2XXX)
  • ss= seconds (00-59)
Example - set to March 19, 2014 @ 20:49
~$ sudo date 031920492015.00

Remove black borders

By default the Raspbian image places black borders around the display, so if you are running a 1080p monitor, this is not ideal as you don't have access to all the desktop space.
Remove them by editting /boot/config.txt

~$ sudo nano /boot/config.txt
Find #disable_overscan=1 and remove the pound (#). If disable_overscan=0, change it to 1

Now reboot the device to apply.

~$ sudo reboot

Set Resolution to 1080p

Make sure you have the pi hooked up via hdmi to a screen that supports 1920x1080, preferably as a native resolution. We used HP 24uh (#K5A38-60001).
From a remote ssh session (not on the raspberry pi directly) do the following:

First check to see what you're running. You may already be running the desired resolution:

~$ tvservice -s
state 0x12001a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive

If not, discover the modes the screen is reporting supported

~$ tvservice -m CEA
Group CEA has 9 modes:
          mode 1: 640x480 @ 60Hz 4:3, clock:25MHz progressive 
          mode 2: 720x480 @ 60Hz 4:3, clock:27MHz progressive 
          mode 3: 720x480 @ 60Hz 16:9, clock:27MHz progressive 
          mode 4: 1280x720 @ 60Hz 16:9, clock:74MHz progressive 
 (prefer) mode 16: 1920x1080 @ 60Hz 16:9, clock:148MHz progressive 
          mode 17: 720x576 @ 50Hz 4:3, clock:27MHz progressive 
          mode 18: 720x576 @ 50Hz 16:9, clock:27MHz progressive 
          mode 19: 1280x720 @ 50Hz 16:9, clock:74MHz progressive 
          mode 31: 1920x1080 @ 50Hz 16:9, clock:148MHz progressive

Set the pi to use the preferred 1080p resolution (most monitors support 50-60hz - UK/Europe uses 50hz, US uses 60hz)

~$ tvservice -e "CEA 16"
Powering on HDMI with explicit settings (CEA mode 16)

This is where you must be remoted into the pi via ssh. If you are not, you'll get a black screen and be unable to do anything else.
Check to see what you're running now.

~$ tvservice -s
state 0x12001a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive

Reset the overlays.

~$ fbset -depth 8 && fbset -depth 16

Install x11vnc server

This package will allow you to VNC into the raspberry pi WHILE you already have an existing desktop session setup. If you try using vncserver, this will simply launch another instance of the desktop, not the existing one. In my case when I tried to use vncserver while the raspbian desktop was already running I would only get a black and grey screen, along with a black X of a mouse cursor.

~$ sudo apt-get install x11vnc
create passwd

Now we need to create the passwd file needed to vnc into this raspberry pi

~$ x11vnc -storepasswd
Enter VNC password: 
Verify password:    
Write password to /home/pi/.vnc/passwd?  [y]/n y
Password written to: /home/pi/.vnc/passwd
configure autostart

Create the folder for the desktop config

~$ mkdir /home/pi/.config/autostart

Create the desktop config

~$ nano /home/pi/.config/autostart/x11vnc.desktop

Populate the config file

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Exec=x11vnc -forever -usepw -display :0 -ultrafilexfer
StartupNotify=false
Terminal=false
Hidden=false
reboot and test
~$ sudo reboot

Once the RPI2 reboots try from another computer to VNC into it by IP and the password that you defined.

Install xtightvncviewer

Now we need to install the viewer which will be connecting to the VM and displaying it's desktop.

~$ sudo apt-get install xtightvncviewer -y

Launch vncviewer

Note: if you haven't created the VM yet or don't have another machine setup with VNC, you may not be able to test yet.
As a test, launch the viewer. You'll need to type this in directly on the pi for it to launch, I haven't figure out how to remotely do it through ssh, but it is possible.
Since we created a passwd file using x11vnc, if its the same password, you can simply reuse that file. If not, I've included an option section below on how to create this passwd file.

vncviewer [options] [host] [passwd file location]
example:
~$ vncviewer -shared -fullscreen -noraiseonbeep 10.45.9.157 -p /home/pi/.vnc/passwd

Since we used full screen and I cant figure out how from the pi, to kill this process, from a remote ssh session

~$ killall -v vncviewer

Optional: Create passwd file with different password

The command we need to do this, vncpasswd, only comes bundled with vncserver, so we'll need to install that package

Install vncserver
~$ sudo apt-get install tightvncserver -y
Create passwd file

Since we want the raspberry pis to automatically boot into a VNC session, we need to create a passwd file that contains the password for the VNC session. If you don't want to specify a password for clients connecting to the VNC server you can configure it that way, but the risk should be obvious. I also am not using user accounts, just a password.

~$ vncpasswd
Using password file /home/pi/.vnc/passwd
VNC directory /home/pi/.vnc does not exist, creating.
Password: 
Verify:   
Would you like to enter a view-only password (y/n)? n

Configuring VMware ESXi 5.1 VM

I'm not going to go through the process of actually creating a Windows virtual machine as it's fairly straight forward and unnecessary to cover IMHO. What I am going to go over is showing you how to configure the VM to have a display resolution of 1920x1080 since by default it cant go over 1600x1200. Technically 1600x1200 is greater than 1920x1080, but until you make the following changes you cannot select 1920x1080 as a display option.
Instructions obtained from VMWare: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1003

Edit VMX file

  • Make sure to poweroff the VM first.
  • open the .vmx file for the VM in a text editor, I prefer to ssh into the vmware box and use nano.
  • change the video ram size. This must be evenly divisible by 65536 for Windows VMs
svga.vramSize = "20971520"
  • Add Width and Height maxes
svga.maxWidth = "2560"
svga.maxHeight = "2048"
  • Save the VMX file and power on the VM. Once loaded in Windows, you should see a few new display resolutions, including 1920x1080.

My Windows VM was running Windows 7 Pro, x32, fully patched as of 3/20/2015.

Auto Start & init.d

Working on trying to get the VNC viewer to autostart on the local machine, but still be able to be controlled by a remote ssh session that can stop/start/restart it. The main problem i'm finding is that I have to specify the display the application is going to open on, due to the remote ssh, and when restarting it, going back to a shell prompt without having to hit CRTL+C or close the window.
Update: A couple of cowokers made some suggestions that have really helped.

  1. add > /dev/null 2>&1 & to the end of my startup command. This resolved the shell prompt issue described above.
  2. change killall -v vncviewer to killall -9 vncviewer and it cleans up the output only showing the echo. Could have probably done the same with > /dev/null


Only thing still broken is the restart function. It stops the process, but goes directly back to a shell prompt without starting it.

init.d script

Create a script within /etc/init.d:

~$ sudo nano /etc/init.d/vncviewer
 
 #!/bin/sh
 ### BEGIN INIT INFO
 # Provides: vncviewer
 # Required-Start: $remote_fs $syslog
 # Required-Stop: $remote_fs $syslog
 # Default-Start: 2 3 4 5
 # Default-Stop: 0 1 6
 # Short-Description: Start VNC Viewer at boot time
 # Description: Start VNC Viewer at boot time.
 ### END INIT INFO
 
 USER=pi
 HOME=/home/pi
 vnchost='10.45.15.84'
 
 export USER HOME
 
 case "$1" in
  start)
    sleep 10
    echo "Starting VNC Viewer"
    #Setting display
    export DISPLAY=:0
    #Insert your favoured settings for a VNC session
    setsid /usr/bin/vncviewer -shared -fullscreen -noraiseonbeep $vnchost -p /home/pi/.vnc/passwd > /dev/null 2>&1 &
    ;;
 
  stop)
    echo "Stopping VNC Viewer"
    #Setting display
    export DISPLAY=:0
    killall -9 vncviewer
    ;;
 
  restart)
    $0 stop
    $0 start
    ;;
   
  status)
    if pidof -o %PPID vncviewer > /dev/null; then
         echo "vncviewer is running"
         exit 0
    else
         echo "vncviewer is not running"
         exit 1
    fi
    ;;
 
  *)
    echo "Usage: /etc/init.d/vncviewer {start|stop|restart|status}"
    exit 1
    ;;
 esac
 
 exit 0

Add permissions to execute

~$ chmod 755 /etc/init.d/vncviewer

Enable dependency based boot sequence

~$ update-rc.d vncviewer defaults

Add to Cron Job

Add the following script as a cronjob file

~$ sudo nano /etc/cron.d/vncviewer
# /etc/cron.d/vncviewer

# Start VNC Viewer every weekday morning at 7:00
00 7 * * 1,2,3,4,5 root /etc/init.d/vncviewer start > /dev/null 2>&1

# Stop VNC Viewer every weekday evening at 19:00
00 19 * * 1,2,3,4,5 root /etc/init.d/vncviewer stop > /dev/null 2>&1

Make it executable

~$ sudo chmod +x /etc/cron.d/vncviewer

Stop VNCViewer via Menu shortcut

reference
To create a menu shortcut that can be used on the raspberry pi to stop vncviewer using the windows/menu key and selecting it from the menu list. The below will place it into Accessories category.

Create a new desktop file under /usr/share/applications/

~$ sudo nano /usr/share/applications/StopVNCViewer.desktop

Paste the following into it:

[Desktop Entry]
Type=Application
Version=1.0
Name=Stop VNC Viewer
Comment=Stop VNC Viewer
Name[en_CA]=Stop VNC Viewer
Name[en_GB]=Stop VNC Viewer
Exec=sudo /etc/init.d/vncviewer stop
Icon=debian-reference.png
Terminal=false
Categories=Utility;
 

Restart the lxde environment

~$ sudo lxpanelctl restart

If you get an error: Cant connect to display: (null) do this:

~$ export DISPLAY=:0

The above assumes you have a display connected via HDMI to the raspberry pi and you are ssh'd into it rather than directly connected.


Checklist

File/Script Required Location
Password File
/home/pi/.vnc/passwd
Desktop Config
/home/pi/.config/autostart/x11vnc.desktop
Init.d script
/etc/init.d/vncviewer
vncviewer cron job
/etc/cron.d/vncviewer
vncviewer stop desktop shortcut
/usr/share/applications/StopVNCViewer.desktop
monitor on/off scheduler
/etc/cron.d/raspi-monitor-scheduler
xset disable screen sleep/blanking
/etc/rc.local

#run script to disable screensaver, screen blanking, screen exposure, standby, suspend, and energy star features.
sleep 5; export DISPLAY=:0; su - pi -c "/home/pi/xset.sh &"

ntp
/etc/ntp.conf

# pool: <http://www.pool.ntp.org/join.html>
server per1-ops-ntp1.sys.silversky.com iburst
server per1-ops-ntp2.sys.silversky.com iburst

# Local users may interrogate the ntp server more closely.
# restrict 127.0.0.1
# restrict ::1

change default password
~$ sudo passwd pi

Enter new UNIX password:

change hostname
~$ sudo nano /etc/hostname

newhostname

~$ sudo nano /etc/hosts
127.0.0.1 newhostname

lynx installed
~$ sudo apt-get update && sudo apt-get install lynx -y
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Ubuntu
Oracle Linux
AWS
Windows
OpenVPN
Grafana
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
MetaSploit
Zoneminder
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
Toolbox