Raspberry Pi – Dirty Optics https://dirtyoptics.com Jack of all trades, Master of none Sun, 11 Oct 2020 14:31:05 +0000 en-US hourly 1 How to Monitor a Raspberry Pi Remotely https://dirtyoptics.com/how-to-monitor-a-raspberry-pi-remotely/ https://dirtyoptics.com/how-to-monitor-a-raspberry-pi-remotely/#respond Sun, 11 Oct 2020 13:51:18 +0000 https://dirtyoptics.com/?p=54921 I’m working on a project that houses a bunch of Raspberry Pi computers in multiple remote locations. I wanted to be able to monitor the “Health” of the hardware in these remote locations. The metrics I was hoping to capture are Up-time, CPU temps, CPU usage, Memory and disk usage, etc.. as you may have noticed, I also have a love/hate relationship with Grafana, which made it the only choice for displaying these metrics in a user-friendly way.

Prerequisites:

1 x VM running Ubuntu 20.04 – I tested using a Cloud Compute server on VULTR, but you could use any VM that is on the same network as the RPi.

1 x RPi – As long as the RPi is on the same network it will be good to go. I tested over a VPN and it worked also.

Software Stack:

Influxdb – As usual the time series database.

Grafana – My favorite program for displaying this kind of data.

Telegraf – A plugin server agent for collecting and passing hardware metrics such as CPU, Temps, RAM, Storage, etc…

Install InfluxDb on VM/Host

Install Grafana on VM/Host

PLEASE READ: Now that our host/server has Grafana and InfluxDb Installed. We need to install Telegraf on the RPi that we wish to fetch metrics from. Don’t worry, we will come back and configure Grafana/InfluxDb Shortly.

Install Telegraf on Raspberry Pi (RPi)

Configuration – Telegraf on RPi

Telegraf.conf

PLEASE READ: Now that we are done configuring the Raspberry Pi, it’s back to the VM/Host to configure influx and grafana.

Configuration – InfluxDB on VM/Host

Configuration – Grafana

Navigate to your Grafana Install: http://<server-ip-address>:3000

Login: default login is admin:admin

Please change the username and password straight away.

The first step is to add the Influxdb data source:

Grafana Datasource

The second step is to import the Dashboard – We used this dashboard from the Grafana Library:

https://grafana.com/grafana/dashboards/10578/reviews Props to Jorge

To import the dashboard, navigate to DASHBOARD > MANAGE > IMPORT

Insert 10578 into the field and click ‘Load’

Grafana Import Dashboard

 

 

 

 

 

Make sure you then select the datasource to associate with the dashboard.

Grafana Import Dashboard

 

 

 

 

 

You should now be greeted with a Dashboard that is connected to the RPi.

Dashboard Complete

 

The rest is now up to you! Add multiple RPi’s. You can switch between them at the top of the Dashboard.

A big thanks to Dorian Machado and his article. Also Jorge de la Cruz and his Dashboard! These guys did the real heavy lifting.

]]>
https://dirtyoptics.com/how-to-monitor-a-raspberry-pi-remotely/feed/ 0
Infographic – Linux for Dummies! https://dirtyoptics.com/infographic-linux-for-dummies/ https://dirtyoptics.com/infographic-linux-for-dummies/#respond Fri, 21 Aug 2020 01:25:35 +0000 https://dirtyoptics.com/?p=54728 Having grown up with Windows it pains me to try and learn all the intricacies of the Linux operating system. However, the pro’s for running a server based on this architecture is great. The cons are that I must learn a bunch of new commands to try and get things done. And yes, I have printed this out and have it as a quick reference guide next to my pc. I hope it can help you also. Let me know if you think I should add/subtract anything. Happy to update as necessary!

infographic basic linux commandsinfographic basic linux commandsinfographic basic linux commands

 

]]>
https://dirtyoptics.com/infographic-linux-for-dummies/feed/ 0
What is Home Assistant? https://dirtyoptics.com/what-is-home-assistant/ https://dirtyoptics.com/what-is-home-assistant/#respond Tue, 12 Nov 2019 11:57:35 +0000 https://dirtyoptics.com/?p=54449 Home Assistant is an open-source home automation platform that is powered by a massive community of makers, tinkerers, and DIY enthusiasts. The software itself runs on numerous hardware and software platforms including the Raspberry Pi, Tinkerboard, Odroid, and Intel NUCs. You can even run the Home Assistant OS (HassOS) from inside a virtual machine if you wish. I run an Intel Nuc with multiple VM’s. One of which is the HassOS and to be honest I do not remember ever having to turn the VM on/off or reset. It has been solid as a rock! At first, I did install Home Assistant on the Raspberry Pi to test with but decided that I did not want another piece of hardware lying about and opted for the VM. I have not looked back since. For a full list of hardware and (VM Images), check out the HassOS installation section here.

So what were my first thoughts about Home Assistant? Well, the installation of HassOS on the hardware of choice is actually the easy part. The Learning Curve for configuration of the devices you want to add to Home Assistant was easily the most challenging. My aim for this post is to help you out a bit with the on-boarding. Here are my top tips for an easier onboarding experience to Home Assistant:

What are (Device) integrations?

Ok, so now that HassOS is installed we navigate around the software and easily start to get confused about what the heck we are meant to configure. If you head over to this webpage, you will be greeted by sheer volumes of possible devices and hardware that Home Assistant allows you to control. For example, your goal may be to use Home Assistant to Automate some lighting. Under the “Light” tab you will see 76 different integrations. Ranging from IKEA Tradfri smart bulbs through to the more common LifX and Phillips Hue integrations. These integrations pages are basically guides or configurations that you must follow to allow Home Assistant to control the devices.

What is YAML?

YAML stands for “Yet Another Markup Language”. It is a human-readable, data serialization language. It is commonly used for configuration files and yes, we use YAML for the configuration of our Integrations! In a nutshell, YAML is not a programming language, but a configuration language. It certainly is not hard to pick up and if I can manage to nut it out, then I’m sure you can too.YAML configuration exactly like above, be it a very simple example, the idea is the same throughout. Of note is the configuration.yaml document. The majority of all your integrations will end up inside this file, or similar .yaml files. YAML does follow a certain syntax, I would suggest having a read through the Home Assistant YAML page prior to diving in.

What are Entities?

Each individual device you add to Home Assistant via an Integration and Entity ID. (Yes, every single item, device, switch and automation, even non-physical items can have entities!) When you first install HassOS and run it, you may find that some devices are automatically found on your network are assigned an entity. As long as you remember that an entity represents a particular device then you cannot go wrong. For example, you may have 15 Phillips Hue Globes on the network, (Via a Bridge) each globe will have its own entity. It is this entity that defines the particular device. example “light.lounge” represents the Phillips Hue light in the lounge and you will need to reference that in your configuration integration.

Love Lace UI

You will hear the term ‘Love Lace UI” thrown around the forums and web a fair bit. This User Interface is somewhat newish to Home Assistant and is the main user interface that we see on the startup of Home Assistant. Everything we do generally speaking is via the Love Lace UI. A Demo of the Love Lace Ui can be found here.

The User Interface is made up of a few components:

  • Cards – These are a bit like tiles that can be laid out in the UI to display different information. HA has 24 predefined cards. The HA community, however, has many more. I use cards to display switches which I can tap to turn lights on and off. I also use cards to show the current weather forecast and check the temperatures around the house. One card even lets me view the IP CCTV cameras I have around the house.
  • Customization – The customization section allows you to change the layout of the cards to suit the view you want. You can add tabs and change the layout as you see fit. If you decide to run the Love Lace UI on a tablet, then you may need to customize the look and feel.

Well, I hope I have not scared you off or bored you to death, but these are the things I wish were explained to me a bit better before getting stuck into Home Assistant. Stay tuned for more on Home Assistant!

]]>
https://dirtyoptics.com/what-is-home-assistant/feed/ 0
How to configure TVheadend server https://dirtyoptics.com/how-to-configure-tvheadend-server/ https://dirtyoptics.com/how-to-configure-tvheadend-server/#respond Mon, 19 Nov 2018 02:55:23 +0000 https://www.dirtyoptics.com/?p=52239 Recently, I have had a few requests for a ‘How To’ configure the TVheadend server. This article will cover off on the basics to get you up and running. If you want to review the hardware requirements then check out the build post here. When you first open TVheadend via your web browser it can be a bit overwhelming which settings to choose. I have broken it down below into the ‘wizard’ setup and then some manual configuration. I have also listed the steps involved to stream the feed onto the internet so you can view externally!

How to configure TVheadend via the wizard

If you are unsure how to get to the web GUI for TVheadend, I would suggest a quick review of this post. Particularly looking at step 3. In a nutshell, you need to use a web browser to configure TVheadend. Go to the IP address you set on your device. If it is your first-time use, you will not get a login screen, however, you should get the wizard to come straight up. If for some reason you canceled the wizard, you can find it by clicking ‘Configuration > Start Wizard’

Open up a web browser and enter the IP address of your TVheadend Server. Also, use the port number ‘9981’. (For example http://192.168.1.168:9981) This will bring up the TVheadend Web GUI. On the first startup, you will be presented with the setup wizard.

Select the web interface language and the EPG language if different. In most cases, you will only need to select the web interface language. Click next.

This section allows you to set ‘allowed’ networks to use the server. You can insert 0.0.0.0/0 to allow all networks, or you can use something like 192.168.1.0/24 to allow anything on that network to access the server. This is a personal preference. You might also notice an open IPV6 entry separated by a comma. This is also acceptable. You can add multiple networks this way. Add an admin login, keep this super strong, especially if you plan to stream content via the internet. If you plan to allow other users into the network, then set them up here also.

The next section will give you an insight into how many adapters the server has picked up. You should see all of them plugged in. If not, then check your connection to the tuner (USB) and ensure the RPi operating system has loaded the drivers. Some TV tuners may not be picked up by Linux. Network 1 always defaults to IPTV, disregard this and continue to your adapters/tuners. Assign each adapter to a network. In my case, it is DVD-T which is Digital Terrestrial TV in Australia.

Because terrestrial television is transmitted on different frequencies dependant on your location, you need to select a profile that matches the location you are in. This will tell the tuner to look at these frequencies. Go ahead and select the correct profile for your area.

This next screen will begin to scan for all services available for the area that you selected. If you accidentally select the wrong location, then you may run into issues. Also, ensure that your TV antenna is connected at this stage. Some of the tuner details can be found in the window behind the wizard. We can revisit this screen later to fault find signal quality issues.

Now that we have found the desired TV channels, we need to map out all the tags and channel names/numbers. This can be done automatically by selecting the 3 check boxes. It is possible to re-sort these at a later date. For now, it is easier to allow TVheadend server to sort it out.

Congrats, your server is now set up! Be it at a basic level, you should now be able to consume some IPTV. The next section will cover off on some ways to do this!

Watch a stream with VLC

Now that you have done all the hard work, its time to consume some IPTV. This section will outline how to view a channel with VLC. If you have not downloaded VLC, then you will need to do this first. https://www.videolan.org/ For those of you who are not aware, VLC is a media player that is very popular and compatible with a LOT of different media types. We can use VLC media player to open our TVheadend streams.

Open up the TVheadend web GUI and navigate to the channel you want to watch. Click on the small ‘info’ button on the left-hand side of the screen. This will open up a modal window with which you can grab the stream.

Select the ‘play program’ button. This should initiate a download. This file is basically a .m3u which can be opened by VLC. VLC will then be pointed directly to the stream you selected.

Open the downloaded file with VLC.

Your stream should then begin to play in VLC.

]]>
https://dirtyoptics.com/how-to-configure-tvheadend-server/feed/ 0
Raspberry Pi TV server using TVheadend https://dirtyoptics.com/raspberry-pi-tv-server-using-tvheadend/ https://dirtyoptics.com/raspberry-pi-tv-server-using-tvheadend/#comments Fri, 17 Aug 2018 12:33:57 +0000 https://www.dirtyoptics.com/?p=51831 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

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

After running the second command, select ‘Y’ and go get a coffee. This process can take 5-10 minutes depending on how old the initial image was.

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 is here.
Check and make sure the correct one is used. This can update at times.


sudo apt-get update

In a nutshell, 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. (See Screenshots below!) 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

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 RPi IP address.

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 post is here.

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.

Update: Apple/iOS App

If you want to consume some TV from your iOS device, I can confirm that the tvhclient app works a treat. No nonsense setup, easy channel browsing. It can be used in conjunction with the VLC app to stream video easily.

Update: Video Hardware Configuration

Gallery:

]]>
https://dirtyoptics.com/raspberry-pi-tv-server-using-tvheadend/feed/ 34
A Brief History of the Raspberry Pi https://dirtyoptics.com/a-brief-history-of-the-raspberry-pi/ https://dirtyoptics.com/a-brief-history-of-the-raspberry-pi/#respond Wed, 08 Aug 2018 04:11:19 +0000 https://www.dirtyoptics.com/?p=51723 Who would have thought a US$35 computer would change our lives so much. The Raspberry Pi foundation has changed the way we learn, teach and innovate by bringing a hardware platform that is cheap enough for the ‘average joe’ yet powerful enough to drive some of our most ambitious ideas. I have no doubt in my mind that I have left some info out here. Please feel free to leave a comment below to educate me a little bit! happy for input. I’ll keep updating this timeline as new releases come out. Thanks.

Some additional credits for the pics and info:Adafruit.com, Raspberry Pi Foundation, elinux.org

]]>
https://dirtyoptics.com/a-brief-history-of-the-raspberry-pi/feed/ 0
Get access to your PI ZERO W without a keyboard, mouse or monitor https://dirtyoptics.com/get-access-to-your-pi-zero-w-without-a-keyboard-mouse-or-monitor/ https://dirtyoptics.com/get-access-to-your-pi-zero-w-without-a-keyboard-mouse-or-monitor/#comments Sat, 09 Jun 2018 15:25:17 +0000 https://www.dirtyoptics.com/?p=51164 So you purchased a Raspberry Pi ZERO Wireless and like me, did not realise 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.), 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 you need:

  • PI ZERO W
  • A micro USB cable for power
  • 2.1A Power supply
  • PUTTY (For SSH) – https://putty.org/
  • Angry IP Scanner – http://angryip.org/download/
  • Text Editor (NotePad++ or equivalent) – https://notepad-plus-plus.org/download/
  • Raspbian Image – https://www.raspberrypi.org/downloads/raspbian/

Step 1. Setup the 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 RPi. 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, let us 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.

]]>
https://dirtyoptics.com/get-access-to-your-pi-zero-w-without-a-keyboard-mouse-or-monitor/feed/ 1
How to setup OpenVPN on a RaspberryPi https://dirtyoptics.com/setup-openvpn-raspberrypi/ https://dirtyoptics.com/setup-openvpn-raspberrypi/#respond Sat, 18 Nov 2017 07:52:25 +0000 https://www.dirtyoptics.com/?p=49170 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 Pi VPN 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.

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 is a pain in the arse, 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 any PC.

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

Sudo raspi-config

Select “5 Interfacing Options” > Select “P2 SSH” > Select “YES” to enable SSH

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 the 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 set up, 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 start the OpenVPN install.

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 don’t 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 a 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. 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)

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

18. Just in case you were not sure of 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 set up 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 set up 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 taskbar 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 set up 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.

]]>
https://dirtyoptics.com/setup-openvpn-raspberrypi/feed/ 0
PiFrame – Surfboard https://dirtyoptics.com/piframe-surfboard/ https://dirtyoptics.com/piframe-surfboard/#respond Wed, 11 May 2016 23:54:10 +0000 https://dirtyoptics.com/?p=48592 The idea behind this was to create an aesthetically pleasing frame for an old screen that I had lying around. No chance was I going to create a standard boring square frame and hang this on the wall. It has been done before… A few weeks prior to making the surfboard frame I had seen a really nice piece of static wall art with a massive photo framed into a surfboard. It looked unreal and was the inspiration for this surfboard PiFrame.

Parts List:

  • Suitable wooden panel approx 18-20mm thick. (I used 1800×600 Panel, 18mm thick)
  • An old LCD monitor (Preferably with buttons including power on the bottom or back. not on the front.)
  • A Solid wall mount (I used a small VESA mount extendable arm – yes it holds the weight fine….)
  • RPI2 with Raspbian installed.
  • 5v PSU – (I used good quality Meanwell enclosed PSU)
  • HDMI cable
  • USB wifi module
  • 240v IEC cable – Y cable with two inputs.

The Frame

For the Initial board, I decided to use the workshop CNC router to speed up the process. The first thing we did was decide upon the shape for the board. The classic thruster shape seemed like the best choice as we could scale it down to fit the 1800×600 wooden panel easily. After drawing up the basic board shape in solid works I moved the drawing over to Aspire. We use Aspire to create our tool paths for the CNC. We then measured the outer edges of the monitor without compensation. The LCD monitor needed to press fit nicely into the wooden panel.

Cutting out the basic template is pretty quick and easy with the CNC router. After we have the basic frame, a quick sand all over using 80grit and 120 grit sandpaper…..then some wet and dry. A base coat of blue paint was applied and a light wash of white. Another quick sand to give it the ‘weathered’ look and a coat of clear varnish have the frame ready to seat the LCD monitor and electronics.

The Hardware

The cut-out for the LCD into the frame was just about perfect and the monitor pressed in nicely, at this stage we didn’t really even need to secure it to the screen as it was a very nice fit. (You may want to affix the frame to the monitor!) Mounting of the hobby enclosure was through 4 x self-tapping screws. Just make sure you do not punch through the front of the frame. The electronics hobby box was a bit of a mash together as you can tell, but if you spend a bit more time on it, I’m sure you can mount everything a bit nicer than what I have.

For the wall mount, we decided that the most flexible option was the LCD monitor swing arm. You need to be careful with the weight on these things, however, after a bit of experimenting, we found that the short arm was perfect and stable enough to hold the weight of the LCD, the frame, and the electronics.

The Software

  • Raspbian OS on RPi
  • Sign Up for an account at DAKboard.com (This is a BETA web configuration I used to display items in the frame)
  • Install Chromium web browser on the PI. (A perfect browser for Kiosk mode – see Dakboard.com for install)

I stumbled across a little web site that specializes in turning a monitor into a useful device that is actually aesthetically pleasing. It involves setting up an account and setting the Pi’s web browser to kiosk mode and loading the page in full screen. Once loaded it can show data such as Date, Time, Weather, iCal calendar entries, and link to dropbox or Flikr to display HD background photos. Not a bad setup, but I stress that it is in BETA and has a few bugs. I believe there are other projects floating about that can do similar. (Post them in the comments, I’m keen to explore other possibilities.)

What Next?

Let me know if you want a detailed article on all the installation steps including the step-by-step install of the software. Please comment below.

]]>
https://dirtyoptics.com/piframe-surfboard/feed/ 0
Raspberry Pi HAT design files https://dirtyoptics.com/raspberry-pi-hat-design-files/ https://dirtyoptics.com/raspberry-pi-hat-design-files/#comments Wed, 11 May 2016 13:09:37 +0000 https://dirtyoptics.com/?p=48631 I have embarked on a journey to create a Raspberry Pi HAT for a little project of mine and I wanted to share a couple of things that I think may help you speed up your development time in the future. As of 11/5/16, I have tested out the DXF importing it into KiCad and using as the edge cut profile. The blank PCB’s test HATS we had made up fit nicely on the RPi2. As I push further on this journey I’ll continue to post any design files that I feel could help you with future iterations.

I can confirm that this fits onto the rPi3 also.

RPi HAT Files

]]>
https://dirtyoptics.com/raspberry-pi-hat-design-files/feed/ 1