Raspberry Pi TV server using TVheadend

I have a projector out in the theatre room, however, this same room does not have any coax run for TV reception. Nor does the projector have a tuner for Digital TV. Thus the idea for the RPi TV streamer! I could have easily gone to the local tech shop and purchased a tuner and ran some coax, but I already have an android device hooked up to the projector, why not try and stream TV to it locally in the house. My own IPTV service of sorts.

I do want to give a bit of a shout out to CWNE88, (Go follow him if you get a chance!) This is the guy that got me started streaming TV via the Raspberry Pi, however he concentrates a lot on multicast streaming and to be honest, most of us do not have the infrastructure to handle multicast traffic on our LAN. So I had to find an alternative option that actually worked. (dvblast works great…if you have suitable switches/routers to handle multicast) Anyhow, during my research, I stumbled across TVheadend. I learned pretty quickly that it could be installed on a Raspberry Pi and be used to stream tv via HTSP. (Home TV Streaming Protocol) HTSP is a TCP based protocol and works in a unicast type fashion without killing your home network.


This is the hardware you will require:

  • Raspberry Pi 3 B+ (This is what we tested with)
  • USB Extension Cables
  • Good quality 5v power supply for RPi
  • USB TV Tuner (We used Avermedia Volar Green HD @ $29ea)
  • Splitter (We used a 3-way splitter to really push the RPi3B+)
  • F-type adapters
  • USB to Ethernet Adapter (Optional)


Prerequisites

I am going to assume you know how to get Raspbian “Stretch” Lite onto your Raspberry Pi. If not check out the “Prerequisites” of this post here. It will walk you through, downloading the image, using Etcher to put the image onto an SD card, setting up the RPi via Raspi-config, and enabling SSH. Once you have completed those steps, come back here and continue.

The end state of the “Prerequisites” is to have access to your Raspberry Pi via SSH and have the command line up and in front of you.


For those confident on the RPi

For those of you who want to skip straight to the chase, the code below outlines all the commands issued to the RPi to install TVheadend. I will then take you step by step through these commands below:


Step 1: Update/Upgrade the Raspberry Pi

First things first, you need to ensure your Raspbian repositories are up to date. Run the Following commands:

sudo apt-get update

sudo apt-get upgrade
Select ‘Y’ and go get a coffee. This process can take 5-10 minutes.


Step 2: Install TVheadend server

Now that your Raspberry Pi is fully up to date, you need to run the following commands:

sudo apt-get install dirmngr

This command may not need to be run, however, for me, TVheadend would not install without it.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61

More info about installing the GPG keys can be found here.

echo "deb https://dl.bintray.com/mpmc/deb raspbianstretch stable-4.2" | sudo tee /etc/apt/sources.list.d/tvheadend.list

Again, more info on where to get the correct repo for the RPi ishere.
Check and make sure the correct one is used. This can update at times.

sudo apt-get update

In a nut-shell, we are telling ‘apt-get’ to grab any updates from the repository we added above. This will then allow us to install TVheadend because it now knows where to ‘grab’ it from.

sudo apt-get update

In a nut-shell, we are telling ‘apt-get’ to grab any updates from the repository we added above. This will then allow us to install TVheadend because it now knows where to ‘grab’ it from.

sudo apt-get install tvheadend

Select ‘Y’ and allow TVheadend to install. If you tried to run this command without doing the steps above, you would run into errors.

During the install, you will be asked to set an administrator username and password. Be sure to set this correctly and remember. You do not get two chances to enter the password. I learned this the hard way!

If for some reason, you did stuff up the username and password. Uninstall tvheadend with sudo apt-get purge tvheadend and sudo apt-get autoremove Then reinstall tvheadend again.


Step 3: Log into TVheadend

Now that your Raspberry Pi is fully up to date, you need to run the following commands:

Open up a web browser and enter the IP address of your Raspberry Pi. Also, use the port number ‘9981’. For example http://192.168.1.168:9981 (Your IP address for the RPi will be different.) Type ifconfig in the terminal screen to confirm.

When you first open Tvheadend, you will get the Wizard which will step you through setting up the tv tuners. Hopefully, you left them plugged in from the start. If not, plug them in and restart the Raspberry Pi. Go back into the web browser and log back into TVheadend.


Step 4: Configure TVheadend for streaming

The configuration for TVheadend settings is coming soon. Thanks for your patience…

I have no doubt, however, if you got this far, you will be able to bumble your way through the configuration. This was the easiest part. I then used VLC to watch the streams. You can get these links from inside Tvheadend.



Video: Example Hardware Configuration

 

 


Streaming and graphing real time data with the Raspberry Pi

So you have a fancy little sensor/contraption and its working great, the system is portable maybe even in a waterproof case or is mobile with no room for a display. However, how do you know the quality of your data or if the system is working without carrying a display or connecting up an SSH session? A black and white terminal impresses no one and is a terrible way to view trends in data.

There is an answer and it is fantastically flexible. You turn your Raspberry PI into a wireless access point and web server. Then with a little HTML, JavaScript, JSON and the chart.js library, you have a clean and dynamic interface for your project.


The particular project in this example uses the following hardware:


When assembled and strapped to a buoy anchored in the swan river it is capable of logging and analysing the motion and frequency of waves. This data is collected as part of the research for Woodside’s River Lab run in partnership with UWA’s Oceans Institute. Here you can see the real-time data stream from the buoy in a lab environment.


The Sensor

The BNO055 sensor performs all of the internal calculation and compensation to output clean acceleration and heading information, however as a demonstration to students and visitors the data is hard to visualise when it must be copied and charted from a CSV file. To improve the accessibility of the data and increase its value this tutorial will utilise several scripting & markup languages and several key libraries:

  • Python
  • HTML

  • CSS
  • JavaScript


Configure the Raspberry Pi

To configure the Raspberry Pi and the website there are several steps. Keep in mind any existing configuration or modifications to a vanilla Raspbian Jessie install may have unforeseen ramifications to this tutorial. Thankfully for my fingers many of these steps are already well documented, the links below will take you to the tutorials I used for some of these steps.

  1. Install Apache Web Server
  2. Configure Raspberry Pi as an Access Point
  3. Modifying your python script
  4. Configuring your script to run on boot
  5. Writing a webpage with chart.js

Having configured your Raspberry Pi as a hot spot web server as per tutorials 1 & 2 above, you should be able to load your web page on a laptop or mobile phone connected to the access point according to the IP address you configured in the second tutorial. If you followed the tutorial verbatim this is 172.24.1.1 although in my application I configured my /etc/network/interfaces AND /etc/dnsmasq.conf files with the address 192.168.0.1 as that is common across other hardware we develop.


Modifying your python script

To improve the portability of our data and leverage existing data handling tools built into python and JavaScript we need to output our sensor data as a JSON file. It is a simple and human readable file format for structuring data reminiscent of a dictionary/list within many languages. Python has some built-in functions that make it easy to output a dictionary as a JSON file. In this example, we want to create one file that details the current sensor reading as well as the calibration state of the sensor.

Most importantly, our JSON data is written to the directory for our web server /var/www/html/whatever.JSON  This means our web server can share the file when it is requested by a client. Any JSON file can be placed and requested natively via http://192.168.0.1/whateverTheFileNameIs.JSON this is great for viewing configuration information and system states without the additional effort of writing and formatting a full web page.

JSON can be viewed directly in the browser with no html required. Great for checking system states

Running the script on boot allows for truly headless operation. Although some form of visual feedback that the code is running, such as flashing an LED, will save any head scratching should the Pi fail to boot or script fail. To run the script on boot we will be modifying the /etc/rc.local file again with another line.

 (sleep:10;python /whatever/the/file/path/is/script.py)& 

As all operations within the rc.local file are already executed with privileges you will not need to include sudo in the command. Full copies of the source code used in this example can be found here.

A word of caution. As you are writing & reading the same file concurrently your code must be tolerant of not being able to access the file on occasion.

Now we have everything configured on the raspberry pi and our data is streaming we can start to build our chart.js data interface.


Andrew Van Dam

An electronics expert based in Australia dedicated to creating great tools for the maker community.


Before and After with Adobe Lightroom

On our recent trip/honeymoon to Koh Samui, I thought I would conjure my inner photographer. It’s fair to say that I still have a lot to learn. The camera I had was a Canon 80D. (Yes not a full frame camera, but I primarily purchased it for the video functionality.) However, saying that it was pretty cool getting down to the beach and having a go at mashing the buttons and seeing what came out at the other end. The results were actually pretty average….as expected. Practice makes perfect hey! Anyhoo nothing a bit of adobe lightroom can’t fix!

I’m definitely no expert on Adobe Lightroom, however, a couple hours messing around and the following pics were ‘Enhanced’.

Drag the slider to reveal the edited image.


This is my very first attempt at a long exposure shot. Trying to draw out all the light I could. To the naked eye, it was pitch black down at the beach, except for the lights of the restaurant. It was difficult to check settings/change settings on the fly as I was doing it due to low light.


To my eye, the green grass did look as good as the Adobe Lightroom edit. I guess I still have a lot of work to do on the camera settings. It was very bright and I was a little bit hungover…


I tried to do something a bit different here. The edit was supposed to highlight the face of the statue and make it stand out more. How do you think I went? any tips? Maybe I could have blurred our the background.


This is what happens when you are really hungover, laying on a very comfortable cushion chair and have absolutely zero motivation to do anything. Yep, take photos of trees and the sky for practice! In the Lightroom version, I tried to bring the green and blue out, however, I think the white in the balloon has become a bit green.


Last one promise! The idea here was to try and dray some of the brown back out of the rock face and the greens into the shrubs. It worked ok I think. Still some work to do.


Well, after all of that it is clear I still have a lot of work to do on the whole “Camera Settings” and “Technique side of photography. Would it be correct in saying that a good photographer should not need to edit his/her photos at all to make them better?


Inspecto Roboto: A dirty robot, just how we like it.

Our resident electronics expert, Andrew has been busy in the man cave this weekend. After reporting some dampness inside his house he decided to take matters into his own hands. The outcome: ‘Inspecto Roboto’! Andrew has pulled apart his racing drone and a few other bits and pieces to hack together a pretty sweet inspection robot for under the house. Check out his build below. And don’t forget to check out some of his other cool projects on his website.

 

Check out the Video in HD here.


Some of the Key components

  • Lynx motion Tri-Tracks chassis
  • 2 x 12V geared DC motors
  • LM298 motor controller drivers

  • 4s LiPo battery pack
  • LED light bar
  • Servos

  • Taranis hobby RC transmitter
  • FRsky receiver
  • Teensy 3.2



The 'Inspecto Roboto' - A confined space inspection robot.

My house has a bit of a moisture problem and I wanted to inspect the floor crawl space to see if there was an obvious fault. It is a horrible cramped environment that whilst I can just wiggle inside the rat carcass at the door confirmed my doubts about venturing any further. So I decided to tackle the problem with robotics!

This was a weekend build and whilst I just used parts lying around I had a lot of nice spares and old projects to work with. Essentially this was a hybrid system using parts from an old racing drone & a lynx motion robotics kit.

Locomotion was a lynx motion Tri-Tracks chassis. It has a nice set of rubberized Tracks as well as an acrylic frame, two 12V geared DC motors and other associated hardware. A basic LM298 motor controller drives each set of tracks from a 4s LiPo battery pack tucked inside. The camera system was from an old racing drone with an FPV display to make driving it around easier. The servo allows for tilting the camera up, panning is just turning the robot on the spot. Finally, a large LED light bar from a vehicle was installed up against the front with some additional acrylic pieces to act as bushes and help retain it in place. The light is controlled via a relay as it is convenient to switch it off when unrequired as it draws about 12W.

The controller was a Taranis hobby RC transmitter paired with an FRsky receiver and a teensy 3.2. The teensy decodes the signals & operates the motors, lights & servo. I have written about using these transmitters with microcontrollers before (Here) and they are a great option for long-range and reliable communication which xBees & other serial radios often struggle with.

The whole system was a bit of a hack but as someone who often spends forever ‘gilding the lily’ on a project until they grow bored of it and don’t finish it, this was a fun and pleasant change.


Andrew Van Dam

An electronics expert based in Australia dedicated to creating great tools for the maker community.


Get access to your PI ZERO W without a keyboard, mouse or monitor

So you purchased a Raspberry Pi ZERO Wireless and like me, did not realize that you would have no way to actually access the small form factor computer, because it does not have any standard USB ports. You actually require an OTG cable to attach any peripherals to the PI ZERO… well I have a pretty easy fix for you. It involves building the SD card using ETCHER (As seen here) or check out the links below. Adding a config file for the built-in wireless (Assuming you have a PI ZER W) and turning on SSH. If you can achieve this you will then have unobstructed access to your new PI ZERO wireless.


What do you need?

  • PI ZERO W
  • Micro USB cable for power
  • 2.1A Power supply



Step 1. Setup SD card and download your image.

Download Raspbian Stretch Lite and use Etcher to get the image on your SD card. Grab your copy of Raspbian from here. The prerequisite steps here will walk you through Etcher. We will run the ‘Lite’ version on the PI ZERO because it does not have the processing power of the RPI3. Also, there is no point loading the GUI if we do not intend to use it for that purpose.

Note: Once etcher is complete, you may need to unplug/plug your SD card back in. Etcher may unmount the drive for you when it is finished. Also if windows spit up some errors asking to format the drive. Do not do it!


Step 2. Add two files to the PI ZERO SD card to allow wifi and ssh to connect on power up

The first thing we need to do is create two files in the root of the SD card. When you plug the SD card back into your computer, look for the drive called “boot”. You need to create two files. Once called “ssh” and another called “wpa_supplicant.conf” Please note that the file called ‘ssh’ has no file extension, and wpa_supplicant.conf has a file extension of ‘.conf’

The ‘ssh’ file can remain blank, we do not need to add any config to it. This will simply enable SSH on the PI ZERO. However the ‘wpa_supplicant.conf’ file will require us to copy and paste this config onto it.


Step 3. Put the SD card into your PI ZERO and power it up

Put the SD card into the PI ZERO and power up the PI. It will take approx 30sec to a minute for it to power up, get wifi connectivity, grab a DHCP address from your router and enable the SSH service. The problem we have now, however, is that we do not know the IP address of the PI ZERO for us to SSH into.

To find the IP address of the PI ZERO, we are now going to use ‘ANGRY IP’ Scanner on our local computer. You can see a run-down of how to find your RPI IP address here also.

If you don’t want to check out the link above. Then Go download angry IP and run it up. It is pretty easy to use and will ping every active device on your network to tell you if it is UP or DOWN. The hardest part is identifying the correct Pi on the network. If you are like me, you may have more than one.


Step 4. Now that we know the IP address of our PI ZERO, lets try SSH into it.

Open up ‘Putty’ and enter the IP address into the required field. Make sure the SSH radio button is selected. Generally, port 22 is suitable for SSH. (This is the default port.) Then click ‘Open’ at the bottom.

So long as the PI ZERO has wifi connectivity you should now be able to SSH into your PI. I would now start to update the build/packages and also look at changing the hostname so that it can be identified easier on the network.



The easiest way to build a virtual machine

Building a virtual machine can be a bit of a daunting task. However, in this video, we use ‘Virtualbox’ to make it super simple. Virtualbox is a free software title and has a bunch of features that rival other virtualization platforms. The video below gets you up to the stage of installing the operating system. We purposely did not cover this step because all operating systems are different. In our scenario, we use Ubuntu Server, as that is what we will be deploying our VPN server on. However, you may want to use windows 10 or OSX as your OS.



Some additional information and handy links

TIP 1:

If you intend to use USB 2.0 and USB 3.0 devices with your virtual machine from the host machine then be sure to install the Expansion pack that is separate to VirtualBox. This expansion pack includes tools such as Support to USB 2.0 and USB 3.0 devices, VirtualBox RDP, disk encryption, NVMe and PXE boot for Intel cards. You can download it here: https://www.virtualbox.org/wiki/Downloads

TIP 2:

After the setup of the image, you can dismount the image file. Virtualbox should un-mount the image automatically, however, if it does not and you end up back at the OS setup, un-mount the image file and reboot the VM.



How to setup VPN on a mini travel router

In this scenario we want to use a mini travel router to act as a VPN client so that when we connect any device to it we know the data will be safe and traverse via a VPN. This kind of setup has a few benefits. The first being the fact that we only need to load one VPN config onto the router and any device that connects to it will use the VPN. This saves us time in setting up our phone, PC or tablet with the VPN config. We can assume that when connected to the travel router we are using the VPN.

The second is portability and travel. Using the travel router in a hotel or a restaurant means that our data is safe and secure. (Assuming you connect to the local wifi with the travel router in bridge mode.)

For this demo we have decided to use the GL-AR300M Mini smart router. This router acts as an OpenVPN client which is what sets these small devices apart from any others. Not all travel routers have this functionality.


Signing up to a VPN service

The first thing we need to do is sign up to a VPN service. Yes we could run our own VPN server, but whats the point when you can get top class servers and better speeds for a few dollars a month. Not all VPN services are alike. Some keep logs, some don’t, some allow P2P traffic, some don’t (Few VPNs have been able to prove they don’t keep logs….but from a security point of view, a VPN with no logs suits us the best.) We also want to look at where the servers reside and what services we can put over the VPN. For example we do not want to connect to a server in Europe if we are located in Australia. However the Australian server may not allow P2P traffic or torrenting. These are just a few of the things to consider when signing up.

We use IPvanish, it is a reliable, no logging VPN services which we have no issues with. Feel free to give it a go. Or do a quick google search and you will be inundated with services to use.


Where to obtain the config files for OpenVPN?

As we are using the GL-AR300M and it uses the OpenVPN protocol we must search our VPN provider for an OpenVPN configuration and certificate. Without this we cannot connect securely to the VPN service. Most services will have a location and the files will be split into servers. Pick the server you require and download the OpenVPN config and certificate. In out case we downloaded every single OpenVPN config for all servers. We then extracted the config we wanted (A Melbourne based server) and created a .zip file with only that config and the certificate.


Loading the config onto the travel router

Depending on how the OpenVPN config is delivered to you, there may be an additional step to create a zip file with the certificate and the config. At times the OpenVPN config file can include the certificate. But generally for VPN services a separate VPN certificate is used.

Log into the GUI of your router and located the OpenVPN tab. From here we can either upload the OpenVPN config or our ZIP file containing the config and the certificate. Once installed, we can then go ahead and activate the VPN profile. You will see a log at the bottom which indicates if/when it is connected and how much data is passing over the VPN. You can also look into using other settings to confirm that the VPN is being used.

You may be greeted with some VPN authentication. You only need to do this once and it is most likely the same login that you use for the VPN service. For IPVanish it will be the email that you registered with and the same password you use to log into the website.

Once Authenticated, the VPN should be good to go, simply click the ‘enable’ checkbox and ‘apply’ the settings. You should then see the VPN begin to connect. If you get errors in the log at this stage it will be an error with the certificate, OpenVPN config or your Authentication. It is possible to load up multiple OpenVPN configs. Use the dropdown box to select the server/config you want to connect through then click apply.


Some assumptions we have made...

This tutorial assumes that you have already connected your travel router to a hotspot with internet ie. Hotel, Maccas, Home. Obviously this is the link that we will tunnel through with our VPN service. There are some settings to ensure that internet does not work without a VPN connection. This ensures that the VPN is being used at all times. Also we set the DNS to use Google DNS. (8.8.8.8 as primary and 8.8.4.4 as alternate.)


Confirm VPN is working

One way to confirm that your internet traffic is travelling through the VPN is to use the https://ipleak.net/ website when you are connected. You should see that ‘your’ IP address is that of the VPN server you have selected. Also can check to make sure the DNS servers being used are masked.


How to setup OpenVPN on a RaspberryPi

Just last week I was setting up IP cameras at home and connecting the irrigation controller to the network and I was opening my network up to the internet WAY too much. (I was port forwarding all kinds of ports.) So to mitigate opening up to the internet so much I decided to set up a VPN tunnel that I could easily connect to which would allow me access to my local network. In a nutshell, instead of opening numerous ports on my router for every device I wanted remote access from, I opened up 1  singular port for the VPN and used OpenVPN software on my phone to connect back. Once connected it behaves as if I was at home and connected locally.

This post will go through the basics of setting up a simple VPN server on a cheap raspberry pi. This example uses the older RPi 2, which is more than sufficient for accessing a few IP cameras and other devices remotely.


The Hardware you will need to gather

  • RPi 2 or 3.
  • Ethernet cable
  • HDMI Cable

  • Keyboard/Mouse
  • 8Gb SD Card


The Software titles you may want to download


PREREQUISITE SETUP - Because we need to get ourselves ready!

The first step is to prepare the SD card for the PI. A 4 or 8Gb SD card will be suitable for the PiVPN installation.

You will first need to download the latest Raspian Lite image (We do not require the GUI for PiVPN) and a copy of Etcher. Etcher will allow you to install and prepare your SD card. It is super easy to use.

Select Image > Select SD card (Make sure you select Correct Drive) > Click Flash.

  1. Select your copy of Raspbian Lite

2. Select the correct drive you want to install the image on. Be sure it is the correct drive as all data will be formatted first.

3. Select Flash – You may get a windows prompt to elevate permissions to administrator.

4. Assuming no errors were found, you can now take the SD card and insert it into the Pi.

How to setup SSH for remote access from our PC

We have chosen to run the Lite version of Raspbian because we do not require the additional overheads of the GUI. The VPN server will sit hidden away and we will connect to is via SSH if we need to. The problem is that SSH is not enabled by default. Thus we require the HDMI cable, a monitor and keyboard to change this first.

Insert the SD card we just made into the Pi and connect the HDMI cable to your monitor. We now need to power up the Pi. You should see the Pi initialize and on first run it may reboot once. The first thing you will have to do is log into the Pi. The default login is:

  • Username: pi
  • Password: raspberry

Viewing the Pi via the HDMI cable and using the connected keyboard and mouse in a PITA, This is why we are setting up SSH, so we can go back to our computer and do all the configuration from the comfort of our home PC.

At this stage we need to enable SSH. To do this type:

Sudo raspi-config

  1. Select “P2 SSH”

2. Select “YES” to enable SSH

3. You will get a confirmation saying SSH is enabled. From this point. All our configuration will be done via Putty. Putty is a SSH/Telnet Client that allows us to connect to the Pi via the SSH protocol. This is common for accessing linux machines. You can get Putty here: http://www.putty.org/

How to find the IP address of our Pi so that we can SSH to it

You should still be logged into the Pi, go back to the command line and type:

ifconfig

We need this IP address so that we can log into the Pi via SSH. Look for eth0 and browse across until you see ‘inet’ This is the IP address we require. In this case the Pi IP address is: 192.168.1.154 – Write this down or remember it.

Open Putty and SSH into the Pi

Enter the IP address of the Pi from the ‘ifconfig’ command. Then Click OPEN. You may be asked to accept some authentication keys. You only need to do this once. You will now be greeted with a similar login screen to previous.

Login as per usual.

Username: pi

Password: raspberry

If you find that some of your keyboard strokes are not the same as mine, you may need to go back into Raspi-Config and change the localization settings or Keyboard options. It also can not hurt to Extend the size of the file system. This will allow the Raspbian build to utilize the full size of the SD card.


PiVPN INSTALL - Now that we are setup, it's time to install and setup!

Now to installing PiVPN. If you are looking at installing PiVPN, then you have probably already been to the website. I just want to make mention that installing software like this could be dangerous if it is not from a trusted source. Basically we are telling the pi to run a heap of commands that are located on the internet. Be sure to check the source first to ensure it is reputable.

The command we are going to run is:

curl -L https://install.pivpn.io | bash

If you have not run an “apt-get” update today the first thing that the software will do is run this for you. This ensures all packages are up to date before installing. After the install process you will see the following configuration screens:

  1. This will install OpenVPN

2. At this stage you should be thinking about making the address the Pi was given static. Or logging into your router and “binding” the DCHP address it was given to the MAC address of the Pi. This will allow the Pi to hold the lease and never change.

3. This will change the address. Remembering when it commits the change, your SSH session will drop and you will have to re-establish the session on the new IP address. For now I am going to leave it as 192.168.1.154 as I have bound that IP to the MAC of the Pi on my router.

4. Indicating that you could get IP conflicts if you dont either bind your IP to MAC or exclude that IP from DHCP.

5. This screen is asking you to choose a user to hold your ovpn configs.

6. If you had other users setup then you would be able to select them here. It is generally good practice to Change the users away from the default username and password. For now we will stick with the default.

7. Because this is our only open facing port, we really should keep all software up to date including security patches. Why not do this automatically? Unless you have some configs that you don’t want messed with. Automatic patches can have a tendency to mess with the compatibility of software at times.

8. As per the last screen. Do it! or make sure you keep on top of it manually.

9. UDP will suffice unless you have any additional configs that require TCP.

10. If you don’t want anyone sniffing your VPN out on the default port, feel free to change this default port. However be sure to port forward the new one on your router so that the VPN can be accessed from outside your network. Also remember this port for any config changes that may need to be made.

11. A second confirmation.

12. Choose the encryption type for your server. 2048bit encryption will suffice in most instances.

13. The This screen if indicating the types of keys that will now be generated.

14. Because the Pi has very little processing power it can take 30-45 minutes for it to create the 2048 bit certificate/key. Go get a coffee! If you had of chose 4096 encryption then you would get the option to download some assistance files from the internet. Otherwise generating a 4096bit key on a Pi would take a VERY long time.

15. This screen allows you to set your WAN IP address or set a DDNS account. These can be changed after the fact via the config files however because we have a static address at home, I can leave it as the WAN IP. (I have blanked out some of the IP on purpose.)

16. Here we can set the DNS for our VPN, if you are unsure, just set it to the Google DNS address. (8.8.8.8 Primary, 8.8.4.4 Alternate)

18. Everyone loves a good reboot! No time like the present.

19. Just in case you were not sure from the previous screen. Remembering that your SSH session will drop during the reboot. Simply Re-connect to the same IP address after a few minutes.

At this stage it can’t hurt to upgrade the Raspbian image. Run this command:

Sudo apt-get upgrade

This is one of those administration tasks that should be done regularly to keep the Pi image in good working order. Unless obviously you are against keeping software up to date, or you have something specific happening in which you cannot afford for it to be affected by updates.


CREATE A USER - This is how we add clients/ Users to OpenVPN

We now need to configure the server to accept connections from the client devices or computers. To do this we setup a client openvpn configuration file. (.opvn file to be exact) This client file is loaded onto the device that wants to connect to the VPN tunnel. It stores the config and encryption keys to access the VPN.

  1. If you run the command:

pivpn help

You will be greeted with the list of commands that we can now run on the Pi to configure the clients and do other administration tasks.

2. Run the command:

pivpn add

This will start the process of creating a client configuration file. You will need to set a password at this point. Ensure you do not forget it, as you will be required to add it on the Client VPN software when we try to connect.

3. That is it for creating the .opvn client config file. It can now be found as indicated at: /home/pi/ovpns


MOVING THE CLIENT CONFIG - we need to move this config file to our device

In this example we are going to move the configuration file to a windows PC that we want to be able to access the VPN and the local network. We must now use some of the additional software to move or grab this config we just created. In this case we decided to use Filezilla as the Pi image already has SFTP enabled by default.

  1. Open Filezilla FTP client. The configuration details that you need to enter in the top for “Quickconnect” are:

Host: 192.168.1.154 (or put sftp:// it will do this automatically when we select port 22 later)

Username: Pi

Password: raspberry

Port: 22 (SFTP default port)

2. When you hit “Quickconnect” you should see a successful directory listing in the right hand navigation pane. Navigate your way to the ovpns folder (Located in the Home directory, if for some reason it did not default to that) Then identify the client1.ovpn config file that was created earlier. Download this file to your desktop by clicking on it and dragging it to the left pane. Ensure you identify the area you are dragging it to as that is your local computer.


CLIENT CONFIG - We need to setup our client now using that file!

We now have a copy of the OpenVPN config file transferred to our client computer. We will need to go ahead and install the OpenVPN client software located here: https://openvpn.net/index.php/open-source/downloads.html

Step through the standard hoops for installing a windows application.

  1. After the OpenVPN software has been installed the Client1.opvn config file needs to be copied to the OpenVPN config folder located here: C:\Program Files\OpenVPN\config (For Windows)

2. Run the OpenVPN software. Most likely is will open to your taskbar.

3. Right-Click the icon in the task bar and select “Connect”

Enter your password that we set when we added the client to the Pi VPN server.

4. Once connected you should see the OpenVPN client taskbar icon turn green and the status screen should look like the above.

The VPN server should have setup your routing tables now so that you can access anything inside your local network automatically.

Give it a shot, shoot a ping through to your local router.

What you may also notice is that the VPN tunnel has been assigned a 10.0.8.# address. The VPN server runs its own network for the tunnel with its own DHCP. When another client connects they are allocated another address on this same range. The server looks after the bridging of this network to your own local network.


TapDoc (BETA)

After playing with NFC and RFID a bit in the last year I realized that the technology is really hamstrung to only a few use cases. Primarily Access Control systems and payment systems. No one has really used the technology for much more. Maybe some active tracking solutions, but really the use cases for NFC are pretty scarce.

The problem with NFC/RFID is that the tags themselves cannot really store too much usable information and storing off site can sometimes be an expensive exercise. The idea of TapDoc is to leverage consumer devices and common cloud platforms to make the technology more usable and accessible.


TapDoc

From here we did a bit of brainstorming to see what we could come up with to utilize the technology a bit differently. Thus TapDoc was born. (I have this feeling though I may need a new name….) In its basic form, TapDoc allows a user to associate files/documents to a NFC tag and place the tag onto an item or in a designated area. In its more advanced form, TapDoc allows a user to create “Pathways” These pathways are a predetermined order of basic tags. Once a pathway is created a user must scan the NFC tags in the order that was set. If your still confused, check out the info below.


TapDoc Apk

Obviously TapDoc is in its very infancy, however if you would like to give it a try feel free. Any feedback would be greatly appreciated.


Choppy Preview Playback in Adobe Premier Pro

Over the last couple of weeks I have been playing with Adobe Premiere Pro with varying results. The biggest problem I have run into is the preview of a sequence becoming choppy after a few seconds of playback. After reading MULTIPLE forum posts and articles on this matter I still have not found a complete solution. What I plan to do is take note here what I have tried and what has been suggested to me. Feel free to comment with any further tips. On a Side note, I am working with Adobe Premiere Pro CC 2014.


1. Changing Playback Preview Settings

If you click on the sequence you are using then navigate to the top “Sequence” Menu item, select “Sequence Settings” and navigate down to “Video Previews”. You will notice that it is stuck on “I-Frame” and is greyed out. You need to change the “Editing Mode” to “Custom” and then you can select anything other than I-Frame. What you also need to do is change the resolution down low to something like 640×360.

This technique has been reported to work, however I am still having a few issues with it. After you have set these settings you may still need to delete any previews that have been generated and delete the cache.


2. Change Renderer to Software only

In case your GFX/GPU is not upto task, you can try using “Software” only as the Renderer. Go to “File”, “Project Settings”, “General” and select the “Video Rendering and Playback” drop down. Switch to “Mercury Playback Engine Software Only” Click the image to see the exact settings.


3. Render the Sequence

After a bit of reading it seems that those with inadequate hardware (me included) will need to render the clips that you have inserted into your sequence. From what I can tell this “rendering” process pulls all your clips together and brings them down in size/resolution etc etc and makes the preview playable. If anyone wants to enlighten us further as to exactly what is happening here then please feel free.

To get this done you will need to use the “in” and “out” markers. (Shortcut keys ‘I” and “O” funnily enough) Once you have selected the section of your sequence to be rendered using the markers, you then can press “Enter” and the process will begin. I had a few issues with pressing enter as it was just playing that section of the sequence for me. So instead I go to “Sequence” on the top ribbon bar and click “Render In and Out”. This will begin to render your sequence between the markers you set.

You will then notice that the line above the clips turns green and you should then get much better playback in the preview window. This does not effect your final export or rendering of the clips.


4. If editing from a laptop, disconnect your dock or USB 3.0 Display Link Cable

So, I think I may have solved one of my problems. Today I decided to do a bit of editing on the couch and noticed a massive improvement in the preview window. But how can this be? I have not made any changes to the settings. I decided to head back to my desk and plug into my port extender which uses ‘USB 3.0 Display Link’ to connect the monitor….(Massive Light bulb moment!) I decided to then change my monitor properties to “Clone” mode instead of “Extend”. I noticed straight away that the choppiness still appeared on my larger monitor through the USB 3.0 display link, but it was not nearly as bad on the laptop screen. Of course I had been using the larger external screen the whole time with premiere pro. Saying all of this, it has not fixed it perfectly yet, but we are getting closer to complete resolution.