Raspberry Pi – Dirty Optics https://dirtyoptics.com Jack of all trades, Master of none Thu, 08 Oct 2020 13:19:57 +0000 en-US hourly 1 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
Edit files on your Raspberry Pi the easy way https://dirtyoptics.com/edit-files-on-your-raspberry-pi-the-easy-way/ https://dirtyoptics.com/edit-files-on-your-raspberry-pi-the-easy-way/#comments Tue, 03 May 2016 12:03:06 +0000 https://dirtyoptics.com/?p=48457 For us Linux “late-adopters” it can be a daunting task? f carrying out a routine file transfer to our Raspberry Pi from our Windows PC.?However, the learning curve is not so great? There are plenty of easy tools for? achieving this feat. If you have not been introduced to Notepad++ then we will give you a quick introduction. We will also educate you on a small plugin inside of Notepad++ that allows you to run a lightweight FTP client. This client is really only suitable for your scripting files or editing configuration files but you will learn the basics of how FTP works and then have the skills to upgrade to a more robust FTP client for moving other files onto the Raspberry Pi.

  • Install Notepad++ on your windows PC.?https://notepad-plus-plus.org/
  • Download Putty. Link Below
  • Ensure your Raspberry Pi is plugged into your network via Ethernet (cat5)
  • Power up your Pi
  • Ensure your LAN has DHCP enabled…most routers will have this set as default.

If you already have your raspberry pi on the network and you know its IP address then that is half the battle. Alternatively, if you have just finished installing Raspbian and you are not sure what to do from here then do not panic!! Check this article to find your IP address. https://dirtyoptics.com/find-raspberry-pi-ip-address/Method 1: Notepad++ (My Favourite!) Navigate your way to https://notepad-plus-plus.org/?and download the latest release for Notepad++. Install as per any other windows application and run it up. You will notice it looks very similar to the generic windows text editor however it does allow for some syntax highlighting. A handy little editor also if you are just starting to dive into Python and other coding languages.

Once Notepad++ is open, navigate to: Plugins / NppFTP / Show NppFTP Window. (If you do not see NppFTP you may need to go to the plugin manager and install it)]Once you have the NppFTP window open you will need to create an SFTP profile for your RPI. Please note that when SSH is enabled on your Pi it also opens up port 22 for you to utilize SFTP over the SSH connection. (Well that’s my understanding anyhow!).

  • Insert Pi IP
  • Port 22
  • Select SFTP
  • Username: pi (If left as default)
  • Password: raspberry (If left as default)

After you have set it up, click close/save. Find and click the connect button in the NppFTP window and connect to the profile you just set up. After a few seconds, you should?be able to view a “windows like” file tree of your Pi. You can also double-click on any text file and edit directly in the Notepad ++ editor. When you click “save” it will automatically upload that file back to the Pi. Particularly useful when editing Python code and you want to run directly on the Pi. This can be dangerous at times if updating important configuration docs. Ensure you back them up first.

Method 2: Using SSH/Terminal and ‘Nano’ Editor If you are feeling adventurous, and want to use SSH to edit configuration files then strap yourself in. For the ‘un-initiated’, Linux commands differ heavily from the standard Win DOS commands. You will notice some similarities but for the most part, it’s a bit of a learning curve. We are not going to cover absolutely everything here but the basics for editing files whilst you are in a terminal session. (Accessing you Pi directly)

The first thing you will want to ensure is that your RPI is powered up, Plugged into your network and you know the IP address. Assuming you have installed Raspbian onto your Micro SD and inserted the SD card prior to powering up we can then begin to access the Pi via SSH. (SSH = Secure SHell). This is pretty much a standard way of accessing your Raspberry Pi if you do not have a monitor available. SSH is enabled by default as part of the Raspbian build.

You will now be required to download and open a small terminal program called ‘Putty’ (There are other, but this is the most popular) http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html run the putty.exe from your PC and input the following information.

  • Hostname/IP Address – Insert your RPI IP
  • Port 22
  • Select SSH

Now that you have logged into your Raspberry Pi via SSH its time to start Nano. Nano is a Linux command line text editor. It is pretty simple to get running and use. It can be run in two different ways.

sudo nano

This will create a blank text entry. The correct syntax to follow is:

sudo nano /path/to/filename

If you use a path that is not valid or it cannot find the file you want to edit, then a blank entry will be created.

If you wanted to edit the Raspberry Pi config file, then the command would look like:

Now that you have accessed the config file with nano, you can go through and make your changes. Use the arrow keys to navigate through the text file, and the usual backspace/enter to move things around.

It would be wise to make a backup file of this configuration first.

Once complete, hit CTRL-X to exit, then Y to save. It will overwrite the old file with your new one.

  • Download and try WinSCP to transfer images and larger files.
  • Setup an FTP server on the?Raspberry Pi.
  • Utilize a standalone FTP client to connect to the Raspberry Pi. (Filezilla/CuteFTP etc etc)
]]>
https://dirtyoptics.com/edit-files-on-your-raspberry-pi-the-easy-way/feed/ 9