zoola.jpg

header.png


Home
IWH Software
My projects
Retro stuff
Random stuff
About me
Contact me
Admin login




Adventures in Pi

Part 1
I am a bit of a geek, only very slighly mind!

I have five Raspberry Pi's at home...

The images below show a Raspberry Pi if you didn't know what one was...

Basically it's a credit card sized computer that runs Linux, and not an edible fruit filed pastry based enclosure.

The first one is the third generation Model B, which is known unsurprisingly as the Raspberry Pi 3, which is running OpenElec as a media centre in the lounge.
The second one is the Model B+ which is also running OpenELEC as a similar media player in the bedroom.
OpenELEC is just a way of running the KODI software on the Raspberry Pi, there are other options called Xbian which is what I used to run on the Pi in the lounge, and is OK but the updates keep killing it, so it needs a re-install occasionally. The last option is OSMC, I've never tried it.
Both of the Pi's were setup to stream content from my NAS and the internet, nothing out of the ordinary to see there. BTW, on the bedroom media player I use a Wi-Fi dongle, which runs at full speed while plugged into the Pi itself. Anyone who knows anything about Raspberry Pi's and Wi-Fi dongles will know this is unusual. The dongle came with a smart tv and is unbranded, however for the technically minded, lsusb reveals it's a Ralink Technology, Corp. RT5572 Wireless Adapter, and the manufacturer ID is Wistron Neweb.
Search for the term Vezzy 200 on eBay to find it.


The third Pi is the interesting one...

It's a Raspberry Pi 2 and it started out as a headless torrent box, which when I activated port forwarding in my router, and added the transmission app to my phone became able to be controlled remotely, PyLoad for direct and hosting site downloads quickly followed.
Being able to start (legal) torrents and other files downloading at home whilst being somewhere else was great!

But by this time my NAS was starting to get a bit tired, the hard disc was getting noisy and it's insistence of spending nearly 10 minutes scanning all the media stored on it every 15 minutes, slowing down any file transfers was getting boring, so I added an external hard drive to the Pi via a cheap USB hub with a 2A phone charger soldered into it. After installing and setting up Samba for local access and vsftpd for remote access, began the slow task of transferring several hundred Gigabyte's of accumulated crap files across the network...

Several days later, I finally managed to erase the original NAS. But a new problem had arisen in that the other Pi's used DLNA to access the content on the original NAS which this Pi didn't have, a quick Google search later and miniDNLA was installed, using the Pi for DLNA sharing was better than using the NAS's openshare partition as I can make the media shares read only, to stop those meddling kids deleting stuff and also set the media scanner update frequency to once a day as the stored media doesn't change very often, I can manually start a scan via an option on the web page if I need to.

I then decided to tackle a separate and ongoing problem with the wife printing her camera phone photos in the local Asda. You may or may not know that the Bluetooth on those photo kiosks is painfully slow, so I wondered if it was possible to set up a Bluetooth dongle to accept files, and by way of a web page mount a flash drive and copy the received files to it so the wife can use that to get her photos printed. Turns out it is possible, just not that easy, as you have to use PHP within HTML to run bash scripts as root. Getting the USB key to mount via HTML code was the biggest headache, I spent a good couple of evenings trying to figure that one out!

The next project was to use the old empty NAS as a backup drive, I use the myshare partition as its not publicly available on the network and isn't monitored by the media scanner. this was an easy task once I figured out the rsync command and bash scripting, and by using cron, backups are automated every morning at 3am.

The last problem I had to solve was my public IP address randomly changing, meaning I had no FTP or SSH access to the network at home, until I got home to find out what it had changed to. A simple bash script pulls the external IP address from a hidden PHP script on this site and sends it to another PHP script on my webspace which saves it. This happens every time the device is booted and every morning at 2am, so I can login to my site and get my home IP address whenever it changes. I'd rather not use the DynDNS service on my router, I like to have complete control over everything.

So from one Raspberry Pi, I am running...

Shared network share folders, one each for all the family with password protection and separate read only Music, Video and Pictures shares. Finally an open Bluetooth and password protected file download shares

Remote FTP access

Remotely controlled torrent and file download software

Remote SSH and SFTP access

DLNA server

Automatic incoming Bluetooth file transfer

A webserver with a page that runs bash scripts to achieve various tasks including mount a flash drive, copy files to it and unmount it

Automatically backup itself and the external drive to another NAS

Automatically send my public IP address to my webspace via FTP

It also has the ability to send me emails if there's a problem


And the server loads at rest are usually somewhere around 0.05 0.01 0.01!

The next projects are to automatically backup my webspace to my old NAS, and add a web cam or two that can be used as security cameras...

Stay tuned...

Gallery

Pi images

In these images you can see the original 256MB Model B in its clear case before the upgrade to the Model B+ in the black case, and also before the upgrade to the current Pi2, in a similar case, also the original NAS is visible with the external drive for the Pi on top. This is all sat on top of the family PC, so it's close enough to the router to use Ethernet cables. (I don't have a spare room or cupboard I can use as a server room) If you look closely you can see the join in the cable where the 2A phone charger is soldered in for the USB hub, the Pi is powered from another 2.1A PSU so power supply issues aren't a problem.

Please excuse the dust!!!

Web server screenshots

When you're connected to my network, navigating to home.local (or http://192.168.1.210) you can control some of the functions you would usually do over SSH. Here are some screenshots of this, including the web based clock screensaver.

Part 2
The Raspberry Pi home server has had some updates...


I've been a bit busy!

Now I'm using the composite video output to provide an image to my TV, so it doesn't mute the audio on the AV input that's connected to my Bluetooth audio receiver, when the TV thinks there is no video signal available, it displays an patronising message telling you to check the connections then call a number for help with setting up your new tv, unfortunately muting the audio signal at the same time.
Normally the Pi would blank (but not switch off) the video signal after a period of inactivity, this meant a blank screen on the AV input, which was boring, however this can be disabled with a simple script edit.

So far this meant displaying the normal Pi tty1 boot screen, but another script i created that gets started at boot blanks the screen and prints some instructions so the more technologically challenged members of my family can follow the instructions and connect their devices to steam music through the TV.
The original plan was to display a PNG image using the framebuffer (/dev/fb0) using fbi or fim loaded at boot from another script, and while this worked OK, it bumped the load averages to well over 1.30, this was very noticeable during other operations, and completely unacceptable.

The point of running the Bluetooth receiver through the TV is so the TV can be used as a audio switcher for the amplifier connected to it, via a DAC (Digital to Analogue converter) as the TV only has digital coaxial audio out and the amp only had analogue audio in. This means whatever comes out of the TV speakers, comes out of the amp speakers. Including the XBIAN KODI media centre Pi, Roku stick, Bluetooth receiver, normal digital TV and the DVD/CD player. I don't like to use the phrase "Idiot proof", but it is idiot proof.

I've updated the webserver with more options and features, added a password protected administrator page with options I'd rather everyone didn't have access to, like restart device, mount and unmount drives and list what's in the download folders. Also splitting the home page across three different pages from a new home page.

Gallery

Updated web server screenshots

Here are some screenshots of the updated website.

I've added pictures to liven up the site and changed all the links to be underlined only when the mouse hovers over them, and some help pages with instructions on how to setup and operate some of the equipment.
Also all the family's personal shares are now password protected, as well as mine.

I looked into adding cameras for security but it's a bit too processor intensive for the humble Pi, I like to keep my load averages below 0.05. This is the reason why I decided to scrap the nice PNG image for simple white text, however I can make the text all sorts of different colours by respawning tty1 and automatically logging in with pi user, although I haven't done this yet.

And I haven't worked out how to backup a remote FTP server, rsync doesn't support remote FTP servers (i found that out after battling with it all evening) so I'm still having to manually back up this site.

I am going to add a second USB drive to use for the daily backups, and use the original NAS for weekly backups, or put it at my parents for off-site backups, once I convince them to get internet...

The fourth Pi is the original Model B with 512MB's of RAM, this is running the Twitterbot for another of my projects, The Ford Fiesta, and the last Pi is the very first Model B with 256MB's of RAM, which is now a VPN server so I can remotely access my network over an encrypted tunnel.

Want to know how it's done? Go to Raspberry Pi Guides

© 2020 IWH Software (Ian Hill)