Home > Personal Life, Technology > Raspberry Pi CTA Tracker Kiosk

Raspberry Pi CTA Tracker Kiosk

 

img_6610-1

I purchased a Raspberry Pi 3 about a year ago and finally got around to creating a fully functional CTA bus/train tracker out of it.

Parts Needed

Raspberry Pi
http://amzn.to/2lp5YOf 

Micro SDHC Cards
http://amzn.to/2kYn04N

Screen
http://amzn.to/2kTArTK

Cable (Cable that came with screen was defective)
http://amzn.to/2ltoJvX

Keyboard and Mouse (any will do, but I like this)
http://amzn.to/2kNfUO5

CTA Tracker URL:

Create your specific CTA Tracker URL and save it for later
http://www.transitchicago.com/developers/diybtform.aspx

Caution – Linux Sucks

Linux will be a PAIN IN YOUR A**.  I’ll just go ahead and say that right now.  Notice how there is no question about it? You will get frustrated.  So just be prepared for that. And you will need google to find answers I missed or have changed since publication of this post.

Every time a new version of a Linux distribution is created, all the blogs and support forum answers found by google go out of date. I dealt with that countless times while setting my device up. “Oh this will fix it!” nope, that was 2 versions ago.

Your distribution may also be full of bugs.  The distribution I had originally included bugs which didn’t allow my screen-sleep-disabling to work. I only figured this out when searching for documentation on the ‘xset’ command.  Someone wrote something that said there was a bug and a workaround. Apparently the developers didn’t want to fix the bug for quite some time.  Luckily it was fixed a year after I started this project.  And I only stumbled upon the distribution update command (see later in the blog post) randomly, not looking for it specifically.

Plus different Linux Distributions do things differently. So be carful that what you find is for your distribution of Linux.

It’s quite exciting when you find something that works! You will be constantly frustrated when nothing works (this will be the majority of the time). I think I visited 60 different sites to figure this all out. It’s lovely that everything goes out of date so fast. Hopefully you find this, and it all works without any problems!

Linux Commands

Here are some linux commands that you should know.

  • sudo: Super User DO (do something as administrator)
  • nano: Edit a text file
  • reboot: Restart the computer (use with ‘sudo’ to do it instantly [sudo reboot])
  • cp: Copy [from path/file] [to path/file]
  • cd: Change working directory
  • ls: List files
  • apt-get: update list of packages
  • #: used to comment out lines in a text configuration file

Install Raspbian

I downloaded Raspbian and followed the standard instillation procedures for the Micro SDHC Card (follow guide linked on site):
https://www.raspberrypi.org/downloads/raspbian

Network

After instillation, configure your wireless network.

It is much easier to do a lot of this stuff over SSH on a nice big monitor, mouse, and keyboard (assuming you are using a small wireless one for the Pi).

You will need to know the IP address of the Raspberry Pi. You can either set it statically on the Raspberry Pi (See this guide), or find out what lease it got from the router. I logged into my PFSense Router to find the IP Address that was leased to the Raspberry Pi. While there, I set that address up as a static lease mapping.

My Raspberry Pi’s address was 192.168.0.24

SSH

Open the Raspberry Pi Configuration Wizard:

In terminal type:

sudo raspi-config

Once you’ve changed your password, go to option 8 (Advanced Options), and then option A4 (SSH) and enable.

Go to another computer, open a terminal, and try to SSH in.

In other computer’s terminal type:

ssh pi@192.168.0.24

Agree to login with unknown authenticity:

yes

Provide Password (below is default Raspberry Pi password:

raspberry

The remaining terminal commands can be done on the Raspberry Pi itself or an SSH logged in session.

Midori Browser

You can use any browser you want, but I like Midori because it’s light-weight and starts up very quick.  If you want another browser,  you will need to find out how to install that somewhere else.

In terminal type this to update the list of software versions that are available:

sudo apt-get update

Wait till completion, and in terminal type this to install Midori:

sudo apt-get install midori

Other browsers that work

Configuration

To disable the screen saver and energy saving modes, we will need to edit some configuration files.

To save in ‘nano’ editor, press ‘CTRL+O’ to Write Out the file, ‘ENTER’ to confirm location, and ‘CTRL+X’ to exit.

In terminal type:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Your file should look something like this.  Use the arrow keys to move cursor positions. You are welcome to delete the ‘xscreensaver’ section instead of comment out stuff.

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@point-rpi
#@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank

On the Raspberry Pi desktop, click on the start menu, go to INTERNET,  RIGHT-CLICK Midori, and Add to desktop. This will create a shortcut on the desktop.  Next we will copy the shortcut to the auto start location, and change working directories.

In terminal type:

sudo cp /home/pi/Desktop/midori.desktop /home/pi/.config/autostart/midori.desktop
cd /home/pi/.config/autostart/

Now we need to edit the new file. We will put in our tracker URL in the ‘Exec’ location so it starts at that page. You also noticed I removed all of the other languages.

In terminal type:

sudo nano midori.desktop

File should look like this

[Desktop Entry]
Version=1.0
Type=Application
Name=Midori
GenericName=Web Browser
Comment=Lightweight web browser
X-GNOME-Keywords=Internet;WWW;Explorer
Categories=GTK;Network;WebBrowser;
MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/geo;image/svg+xml;
Exec=midori -e Fullscreen -a http://www.transitchicago.com/diydisplay/?s1=4998&n1=%2377+Belmont+East+%40+Halsted&s2=5966&n2=%238+Halsted+North+%40+Belmont&s3=41320&size=smal$
Icon=midori
Terminal=false
StartupNotify=true
X-Osso-Type=application/x-executable
X-Osso-Service=midori
X-Ayatana-Desktop-Shortcuts=TabNew;WindowNew;Private

Save the file and then reboot!

In terminal type:

sudo reboot

References

https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=122444
https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/
https://github.com/elalemanyo/raspberry-pi-kiosk-screen

All Done!

fullsizerender

The Raspberry Pi Tracker a my front door entrance

Old stuff that may work.

Upgrade your linux distrubtion

sudo apt-get dist-upgrade

This may overwrite configuration files.  I allowed mine to do so after I spent over a day changing stuff and nothing was working.

Force the screen to stay on

sudo nano /etc/lightdm/lightdm.conf

Add the following lines to the [SeatDefaults] section:

# don't sleep the screen
xserver-command=X -s 0 dpms

Start browser from LXDE Autostart

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Add the following lines

@chromium --noerrdialogs --kiosk http://www.page-to.display
Install X Server utilities

This comes with the most reason Raspbian, I think. If not, install it.  You can try ‘@xset s off’ in terminal to see. If you don’t get an error, its installed! if not, install it.

apt-get install x11-xserver-utils
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: