Headless Pi Zero VNC setup

After setting up a few pi zero’s with VNC without a monitor, here’s the process I follow that may be helpful if you are trying to do similar. I’m no expert but this works for me ūüôā

Hardware
sd card reader
pi zero+psu
wifi dongle+adapter if required
pc/laptop (I’m using a pc with ubuntu 16.04)

Software
Raspian image – https://www.raspberrypi.org/downloads/raspbian/
Etcher – https://etcher.io/
SD card formatter – https://www.sdcard.org/downloads/formatter_4/
Continue reading

Raspberry Pi – adding a cron job to run get_iplayer automatically

Finally getting round to automating my get_iplayer on my pi PVR with cron.

First find where your get_player PVR runs from by typing the following into the terminal

echo $PATH get_iplayer --pvr
my output was: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games get_iplayer --pvr

I had previously tried using:

cd ~/get_iplayer; ./get_iplayer ‚Äďpvr

but this failed to work, so I recommend the echo path output string.

Next to write the cron job (adding the output file log location)

* 2,14 * * * PATH=./usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games get_iplayer --pvr  >>/home/pi/cron_log.txt

The 2,14 refers to 2am and 2pm, so the command will run at these times. See this wikipedia entry for further explanation and examples. Also note the “.” after the “=” this is required. The second part refers to the process you want to run (eg: run the PVR) and finally the “>” is where to save the output log to.

So now to add the cron job, open the terminal and type

crontab -e

The nano text editor should then open, the just add the line above to automate the PVR and save the output to /home/pi/cron_log.txt so you can check to see that everything is working as expected as the terminal window will not show the processes running. The double “>>” will ensure the new programmes are apended to the file rather than overwriting the file each time the process is run.

Now wait for 2am or 2am and check the log (alternatively set the time for a few minutes in the future to check its all working).

My previous post about get_iplayer here

More info about get_iplayer available on Square Penguin

 

 

New HDD – transfer data with rsync

A new Samsung 4tb external HDD has arrived to replace the almost full WD1tb HDD that is attached to a raspberry pi and serves up media to the network with minidlna and grabs iplayer programmes with getiplayer. So with 950gb(ish) of data to transfer from the old drive to the new drive I used rsync.

I did use another pc to transfer the data as it would have taken ages with the pi as both usb’s and the network are on all one SMSC9514 chip – but it would work.

First things first, I used Gparted to format the drive to EX4, a native linux file system. Then I connected up both drives and run this command in the terminal:

sudo rsync -rvtP¬† “/media/bertha/WD 1TB/” /media/bertha/samsung_4tb

Commands as follows:

-r, --recursive             recurse into directories
-v, --verbose               Increase verbosity
-t, --times                 Preserve times
 --progress                  Show progress during transfer
 -P                          equivalent to --partial --progress

Adding -n for a dryrun to check everything is a good idea!

-n, --dry-run               Perform a trial run with no changes made

Lots of great guides online to prep the rsync command – this one is great

It transferred the data at approx. 30Mb/s and took 8 hours or so. I will get another soon to keep a backup of the data and again use rsync to sync the data with a daily cron job.

Raspberry Pi and get_iplayer

get_iplayer is a great piece of software that downloads bbc iplayer programmes to a local hard drive it also runs great on a raspberry pi. To set-up I followed these instructions: http://raspi.tv/2014/get_iplayer-raspberry-pi-update

Once installed open the terminal and run

get_iplayer --cat films

This will then return all the films currently available on iplayer, then to download, note the Number and run:

get_iplayer --get 1582 --modes best --type=tv --file-prefix="<nameshort>-<.senum>-<.episodeshort>" --output "/media/WD/tv/films"

Continue reading

HDMI Switch for Pi

I have a monitor that is connected to another pc and a pi, up until now I have had to swap cables when I wanted to use the pi/pc and it was getting tedious.

As I read that some don’t play nicely with the pi, I was assuming that it might be tricky to find one that works – however this duronic hdmi switch works perfectly (even the auto switching) with the pc and pi. The only issue is the blindly bright blue LED – seen below covered with a square of post it.Connected as follows:

PC-DVI--------------HDMI-[switch in]
Pi-HDMI-------------HDMI-[switch in]
[switch out]-HDMI---------DVI-[monitor]

Raspberry pi B+ and volumio

We spent Christmas with my parents and wanting to take some xmas music along, I decided to give volumio a go to setup a mobile/tablet/pc controlled music player with a raspberry pi.

Picture of the set-up

Equipment

  • B+W Zeplin speaker dock (using the 3.5mm input)
  • Raspberry Pi model B+
  • music files located on Lexar usb stick in .flac format
  • SD card with the Volumio OS installed – download from here: http://volumio.org/
  • USB extension cable with cheap USB soundcard attached (extension cable as sound card is too bulky to fit next to the usb stick) – ¬£2 or so from eBay
  • USB Wi-fi stick – digitazz
  • power supply for pi

The new B+ pi has an additional 2 USB ports, better power management and cable connections on only two sides.  Great for volumio as I needed 3 USBs (soundcard, music and wi-fi).

Continue reading

Raspberry PI

I picked up a raspberry pi to experiment with, here is the board in all its glory:

Its a tiny credit card sized linux computer, find out more info here. Its the Model B version with networking and with a CPU running stock at 700mhz.

I also picked up a case from Mod my pi and a 16gb Intergral class 10 SD card. Its powered by a micro usb PSU providing at least 700mA so I found an old¬†blackberry charger that seems to be working fine. Once the HDMI cable and a logitech wireless keyboard and mouse I was ready to started playing. I downloaded the new operating system software from the Raspberry Pi website NOOBs (new out of box software) which includes a few different OS’s to choose from. I stuck with Raspian first which installed reasonably quickly and booted fine. Then I overclocked the pi to 800mhz (a “modest” overclock) by amending the config file to provide a bit of extra speed – this will not void the warranty and is super quick.

I am hoping to use it as a small energy efficient file server a bit like this.