Seasonal change for the day clock

Today was a lovely summery day in old Blighty.  It was good to generate some vitamin D, but I guess that was our summer over for another year.  If you blink then you miss it.

It reminded me that my day clock needed updating. The old autumnal leaves I posted originally back in December no longer seem appropriate. So today I added a rolling background image that changes with the seasons. There is a different image for each time of year: Spring, Summer, Autumn and Winter.

Do please check it out.

The old Autumnal version. Do click it to see what's new.

More groovy patterns for Raspberry Pi

Following on from the last post about groovy patterns for Raspberry Pi, I present my latest program, another random walk.

It is a random walk similar to last time, however with this one there are three degrees of freedom (rather than horizontal and vertical) and rather than a line, the object displayed in a coloured 3D box.
This code is for BASIC V running under RISCOS on the Raspberry Pi. Copy the code, or download directly.

The code:

   10 REM Blocks
   20 REM T Street
   30 REM 2017-05-21
   40 :
   50 MODE 19
   52 delay = 0
   55 colcyc = 0
   60 angle1 = RAD(45): angle2 = RAD(20)
   70 size = 16
   72 LIMIT = 50
   73 DENSITY = 40
   80 xo=500:yo=500
   90 x = xo: y=yo
  100 dir = RND(5)
  110 PROCsetdir
  112 lc = 0
  114 dc = 0
  120 REPEAT
  140   PROCbox(x,y,size,angle1,angle2)
  141   t=TIME:REPEAT UNTIL TIME>t+delay
  150   x = x + dx: y = y + dy
  151   lc = lc + 1
  160   IF RND(6) = 1 THEN PROCchangeDir
  170   IF x<0 OR x>1000 OR y<0 OR y>1000 OR lc>LIMIT THEN
  180     x=xo:y=yo
  181     colcyc = colcyc+2: IF colcyc > 127 colcyc = 0
  182     lc = 0
  183     dc = dc + 1
  190   ENDIF
  191   IF dc>DENSITY THEN
  192     dc = 0:CLS:x=xo:y=yo:lc = 0
  193   ENDIF
  210 END
  220 :
  230 DEFPROCbox(x,y,s,ar,au)
  240 REM draws a box at coords x,y
  250 REM where the coords are the lower left corner
  260 REM and s is the size of box
  270 REM and ar and au are angles
  280 MOVE x,y
  290 LOCAL up, right
  300 up = s*SIN(au)
  310 right = s*COS(ar)
  320 REM front side
  330 GCOL 2+colcyc
  340 MOVE x,y+s
  350 PLOT 85,x+s,y
  360 MOVE x+s, y:MOVE x, y+s
  370 PLOT 85, x+s, y+s
  380 REM right hand side
  390 GCOL 1+colcyc
  400 MOVE x+s+right, y+up: MOVE x+s, y+s
  410 PLOT 85, x+s, y
  420 MOVE x+s+right, y+up: MOVE x+s, y+s
  430 PLOT 85, x+s+right, y+s+up
  440 REM top
  450 GCOL 1+colcyc
  460 MOVE x+right, y+s+up: MOVE x+s, y+s
  470 PLOT 85, x, y+s
  480 MOVE x+right, y+s+up: MOVE x+s, y+s
  490 PLOT 85, x+s+right, y+s+up
  491 GCOL 0
  492 MOVEx,y:DRAW x+s,y:DRAW x+s,y+s:DRAWx,y+s:DRAW x,y
  510 :
  520 DEFPROCsetdir
  530 CASE dir OF
  540   WHEN 1
  550   dx = 0: dy = size
  560   WHEN 2
  570   dx = size: dy = 0
  580   WHEN 3
  590   dx = 0: dy = -size
  600   WHEN 4
  610   dx = -size: dy = 0
  620   WHEN 5
  630   dx = -(size*COS(angle2)): dy = -(size*SIN(angle2))
  635   WHEN6
  636   dx = (size*COS(angle2)): dy = (size*SIN(angle2))
  660 :
  670 DEFPROCchangeDir
  680 dir=RND(6)
  690 PROCsetdir
  710 :

Weird things spotted in Whitby today

I went to Whitby today.

Whitby is a lovely town on the North East coast of England. Whitby is a place where you can be who you want to be. Whitby is home to the famous Lucky Duck; was the place where Count Dracula first arrived in England; and is home to the superdecade games chatbot - Mac.

You will see many strange things in Whitby. Today I saw some, and managed to get a few on camera.

Kleptoparasitism is a thing. This is how gulls feed. Just because you bought the chips doesn't mean that the seagull respects your property. I saw this gull trying to break into someone's car. When it realised that it couldn't peck through the roof, it decided to try and eat the aerial instead. Then it saw my chips and wanted some. It didn't get any. I am not sure why this fellow looks like it has a mustache, it just does.
There are many junk shops in Whitby. This one is selling a sarcophagus. The shop was closed, but there was a phone number to ring if you wanted to enquire about anything. I want to ask how much this costs, because, you know, you need somewhere to sleep at night.
Errr, what? I don't know what the actual flip this is. Moving on....

This shop selling LPs from some of the worst vermin of society.
Taken from a poster by the authorities, encouraging us not to feed the vermin of the sea - the rats with wings, the aerial-munchers, the chip thieves. Is it just me, or does it look like that photograph of Theresa May? You know the one....
....Do NOT feed (or vote for unless you can afford to sell your house to pay for your health care).

Groovy patterns for Raspberry Pi

In a spare moment whilst I was waiting for some food to cook, I decided to play with the BASIC on the Raspberry Pi. I'm using the brilliant RISCOS for the Pi which comes with BASIC V and about a gigabyte of RAM.

I decided to create a 'random walk' in an attempt to create something that would look like an abstract map of a city. I am quite pleased with the results.

Pictures first, and then the code.

It's supposed to look sort of 3D, sort of.

It really pelts along on my Raspberry Pi
When the line wanders off the screen it starts again in the middle of the pattern with a slight offset and a new colour. Lines sometimes quit and start again (controlled by the variable LIMIT%, and after a while the pattern will refresh (controlled by the DENSITY% variable).

Here is the source code for RISCOS BASIC V, which will require only minor modification to run in BBC BASIC for Windows, or on a BBC Master.

Copy the code below, or download the file directly.

   10 REM Draws a 'city scape'
   20 REM T Street
   30 REM 2017-05-10
   40 MODE 19
   60 colCycle%= 0
   70 GCOLRND(4)+colCycle%
   80 REPEAT
   90   refresh%=FALSE
   99   REM Origin
  100   xo = 500 :yo = 500
  109   REM start at origin
  110   x = xo :y = yo
  119   REM distance moved each step
  120   dx=0:dy=0
  130   m = 16
  139   REM counts number of steps
  140   c = 0
  150   l=0
  160   LIMIT% = 400
  170   DENSITY% = 32
  180   MOVE x,y
  190   REPEAT
  200     c=c+1:l=l+1
  210     x=x+dx
  220     y=y+dy
  230     DRAW x,y
  240     r = RND(4)
  250     IF r=1 dx = 0:dy=m
  260     IF r=2 dx = m:dy=0
  270     IF r=3 dx = 0:dy=-m
  280     IF r=4 dx = -m:dy=0
  290     IF x<0 OR x>1000 OR y<0 OR y>1000 OR c>LIMIT%  THEN
  300       xo = xo+2:yo=yo+2
  310       x=xo
  320       y=yo
  330       c=0
  340       MOVE x,y
  350       GCOLRND(4)+colCycle%
  360     ENDIF
  380       refresh% = TRUE
  390     ENDIF
  400   UNTIL refresh%
  410   colCycle% = colCycle% + 4: IF colCycle% > 128: colCycle% = 0
  420   CLS

Remote desktop for Raspberry Pi

Avid readers of this blog will know that I am a big fan of the RISCOS pi operating system for Raspberry Pi. I mainly use it for the nostalgia factor, however I also keep a set of note on it in addition to some programming.

I also have a need for the Linux distribution as well.  I currently regularly use Raspbian flavour of Linux for the following tasks:

These are all jobs that I want to have running permanently, however it started to annoy me that I had to quit Raspbian in order for the device to boot into RISCOS.  The solution was to get a second Raspberry Pi 2 to use as a dedicated RISCOS Pi and leave the first device for uninterrupted Linux stuff! This caused it's own problems, of course, as I only have room for one monitor, one keyboard and one mouse. Swapping the devices over when I wanted to quickly check on something on the server was becoming irritating and so the obvious solution is to install a remote desktop.

If you were not aware, a remote desktop allows you to run one computer from another computer. You literally see the desktop of one computer in a window on a second machine. This is incredibly useful for doing things with Raspberry Pi wherever the use of keyboards, mice and monitors are a problem. For example, you might want to put the Raspberry Pi in a remote location in your house or garden to monitor temperature, or take photos as aliens pass over your roof. Maybe you want to set the machine up as a burglar detection and capture system. Maybe your Raspberry Pi is the central brain of your doomsday machine or robot butler and having a monitor and keyboard attached is just soooo nineteen nineties. Either way, controlling your Pi from another computer or tablet is really cool.

Your choice of software for performing a remote desktop depends on your current distribution of Raspbian: you could try xrdp, or VNC.


I have used xrdp on a number of Pi devices at both work and at home. These instructions should work if your device was installed before 2017.

1. First install the xrdp software onto your Pi. Navigate to the terminal and type: sudo apt-get install xrdp
2. Follow any on-screen instructions.
3. Once completed restart your device with sudo restart
4. You will need the IP address of your device on your home network. If you don't know it you should be able to find it from either your home router's admin page, or type the command: ifconfig You are looking for a line that reads something like: inet addr:

5. Once you are happy that xrdp is ready for your Raspberry Pi you should be able to connect from your second computer.  In Windows 10 select Cortana and type "Remote Desktop". This should launch a program called "Remote Desktop Connection".

Finding the Remote Desktop in Windows 10. For earlier versions of Windows, it will be found in your Start > All programs > Accessories folder.

6. Type in the IP address of your Raspberry Pi from part 4 (for example, mine is
7. Enter your username and password. You should now find that you can now see your Raspberry Pi desktop.

Enter your username and password at the prompt. If you haven't changed them already, then your username should be 'pi' and the password is 'raspberry'

If you get connection problems, then you probably need to follow the steps for VNC below.


1. Navigate to your Terminal in Raspbian and type: sudo raspi-config
2. A menu should appear. Find “Interfacing Options” and make sure that VNC is enabled.
3. Reboot the Raspberry Pi.
4. Whilst your Pi is rebooting you can install the VNC Viewer client software on your second computer. I downloaded the portable version from the RealVNC website for Windows, however other versions are available for other machines.
5. Once you have this client running you should be able to enter your IP address and connect.

If everything has gone to plan then you should be seeing your Raspberry Pi desktop on your other computer. Very handy for controlling your computer from another room.

Another really good feature is that VNC will allow you to transfer files from your computer onto the Raspberry Pi. To do this, first click on the icon in the top left corner. Then select "File Transfer" from the menu. I use this to maintain various files on my home server. For example I have a set of notes written using Zim. These notes are written on my PC and keep track of various things that are useful for both RISCOS and Raspbian (such as all the instructions on this blog article). As soon as I learn something new about the Raspberry Pi, I make a note of how I did it and then upload it to the server. As they are kept on my server I can access them from any of the machines on my home network, including the RISCOS device. Very handy indeed!

Today we celebrate two years in space

On the first of May two years ago we launched Project Poxima the world's first internet based space mission.

Project Proxima is a hypothetical, light-speed space mission to the Proxima Centauri star system. The aim is to create a teaching tool that helps explain the vastness of interstellar space (it's big).

Today Proxima has traveled nearly 19 trillion km - that's about 47% of the today distance.

A lot has happened in the time since launch: perhaps most notably are the rise of Trump and the British referendum on Brexit. Most interestingly, however, that since launching the Project Proxima mission, scientists have discovered an earth-like planet in orbit around the Proxima Centauri system.

You can get involved in the mission by following on Twitter, or tracking the progress on the website.

You can also become an official supporter and sign up for email alerts.

Want to read more about Project Proxima?

Castle Defender is a brilliant new game for the BBC micro

Every now and then a new game is developed for vintage computers. Built by computing enthusiasts these games are often better than the original offerings from the time that the machines were first popular, or include titles and ideas that come from the modern age.

Castle Defender is the BBC micro's first ever tower defence game, and it is really very good. Programmed by Chris Bradburne with graphics by John Blythe, this game is superbly well written and designed. The graphics are stunning and the game play is addictive. I have been playing all morning, with admittedly, a pathetic high score of only 40% to show for my efforts.

A hoard of orcs and goblins storm my castle defences on the BeebEm emulator.
The aim of Castle Defender is to protect your castle from the waves of computer controlled 'nasties'. You build towers at strategic points along the way to shoot your enemies to death. There are three different types of weapons which can be upgraded as you earn more gold. Indeed, upgrading your weapons is the only way you will succeed at this game.

There is an initial steep learning curve in Castle Defender. At first the cursor key controls seem a little counter-intuitive, and you will possibly long for a touch screen. The best approach is to only use the left and right cursor keys to navigate the battle field. The second lesson you will need to learn is how to read the display at the bottom of the screen. Some enemies have shields which make them almost impossible to kill unless you have weapons that can deal with shields. Choosing the appropriate mix of weapons is essential to surviving each wave of nasties in Castle Defender.

Snakes! I hate snakes, Jock! I hate 'em! Come on! Show a little backbone, will ya!
There are four levels of superb high-resolution MODE 1 graphics, with each level getting progressively more 'evil'. You can skip levels by pressing the corresponding key 2,3 or 4 at the start of the game, although if you do the game wont track your high score. The animation is very smooth and the enemies make a satisfying 'pop' when they die.

It really is a joy to see developers creating new games for vintage machines, particularly when the results are such superb quality releases. One geek experience point is awarded each to Chris Bradburne and John Blythe.

You can download a copy of this game for your BBC micro or BBC master computer, or run it on your PC in an emulator such as BeebEm.

Zap that nasty! The loading screen of Castle Defender.
More modern games for vintage computers are available on the Homebrew Heroes Facebook page.

Well that's all from me today. I'm off to squish some 8-bit orcs...

Some weather apps

Yesterday's post started out about the Raspberry Pi Sense Hat, and ended up looking at the Barometer app for Lumia 950. Today, I'll look at a couple more useful weather apps for your Lumia 950.

I have been using GPS Thermometer Free from Jappi-Soft. This app uses your current location at matches it with publicly available weather station data to show the outside temperature for your location.

GPS Thermometer Free on Lumia 950
The paid version includes a live tile with adverts removed. Both versions include a choice of accent colours and displays. Bizarrely, several people in the comments section of the app were disappointed because the app doesn't display the inside temperature of their homes. These people have clearly misunderstood how this app works. I will reiterate: It finds the nearest weather station to you and displays the temperature as measured by that weather station on your screen.

Sun and Moon
I love this app. Sun & Moon by Ronca is a simple app that gives a representation of where the sun and moon are currently located in their daily cycles.

Sun and moon on Lumia 950 showing the current position of the sun as though you were facing South on a cloudless day.

It also shows the sun rise and sunset times and the expected hours of sunlight. Sadly, the app does not cope with the annoying habit we Brits have of setting our clocks forward one hour in summer, so you you also need to add one hour onto the times displayed onscreen.

Perfect Weather
This is one of the most beautiful weather apps I have seen for Windows 10. Perfect Weather is a universal app, which means it is available for both your phone and PC, or any other device running Windows 10. It defaults to your current location, however you can set it other locations as well. Your display will show the current weather conditions, temperature, wind speed and direction, sun rise and set times, air pressure, moon phase, moon rise and set times. In effect it does everything the other two apps do plus more. Sliding your finger across the display will show an animation of the weather for that day. If you want to pay for the full version you will get a choice of background themes which include a Star Wars theme, presumably so you can see what the weather is like onTatooine  (presumably hot during the day, and cold at night).

Perfect Weather Universal showing the weather in Fantasia after The Nothing had finished doing its work.
Part of my Lumia 950 homescreen in all its Windows 10 goodness.

Is there a difference in air pressure between your head and toes?

It has been a lovely day in England today, with highs of 20 degrees (that's 68 F) and a gentle breeze. It has been the sort of weather for relaxing in the sun with a cool drink and a sun hat, and maybe a good book, because it is not often we get the chance to produce some vitamin D in this country. But I couldn't just sit around all day. During the peak of the midday sun, I retreated to the relative safety and coolness of my geek cave and tinkered with my Raspberry Pi Sense Hat data logger.

The 8-by-8 LED matrix on the Sense Hat, which is useful for anything your imagination can conceive. 

The Raspberry Pi Sense Hat data logger uses the brilliant Sense Hat to log temperature, pressure and humidity from its many sensors. You can grab my code from the link above, or read about other Sense Hat projects, and if you have a Raspberry Pi then this is an brilliant add on device that will guarantee hours of fun.

It was this tinkering that made me ponder the question raised in the title of this post.

Is there a difference in air pressure between your head and toes?
Assuming that you have toes on the ends of your feet (as I do), and not growing out of your forehead (as I don't), then there should be a difference in air pressure between these two points due to the difference in height between them (assuming that you are standing vertically). More to the point I wondered whether it was possible to measure this difference. Sadly, Raspberry Pi is not maneuverable enough to lift off my desk (so many things plugged in) which led me to look for barometer apps in the app store.

I soon found Barometr by SeNSSoft for my Lumia 950.

Air pressure at ground level

Air pressure at head height.
And there you have it. The answer is 'Yes', about 0.2 hecopascal (or about 0.1 hecopascal if your name is Frodo).

The best feature of Windows Creators update

So last night I updated my main work horse, the 'beast' i7 Windows 10 machine to the latest update - the so-called 'creators' update.

The download took over an hour on my home network and the whole process was left to complete for several hours overnight. If you are thinking of updating then do so when you wont need to use your machine for maths homework, or general world domination.

What's new?
The new stuff is few and far between, to be honest, and I suspect that most people will either miss it, or not notice or need it at all.

There's the new Paint 3D app that you will get whether you like it or not. I am not sure that I need to create three-dimensional artwork, and my main go-to for digital art is SketchBook for Windows in all its 2D glory. I still remember the days when the best app for my IBM 286 was the Paintbrush application in Windows 3.1. I firmly believe that if all world leaders got together over a copy of Paintbrush, drew a doodle and then used the flood fill tool to colour it in, then the world would be a better place.

In the previous update Microsoft added functionality to Edge browser to let you draw on webpages. In the Creators update you can now draw on the Maps app, which no doubt will be of some use to the lost and confused. I've already drawn a big circle around my house and then sort of coloured it in a bit. Oh, well, moving on...

There are a load of new updates for Edge browser. I have been impressed with Edge from the beginning and it looks like this browser is getting ever closer to being a very good experience. It will at least help wean me off my destructive Chrome habit. Seriously, I am fed up of Chrome hogging system resources and failing to load pages.

The new night light setting allows you to change the amount of blue light your screen emits at night. This is because some studies have suggested that blue-light affects sleep. You can set it in synchronicity with the setting and rising of the sun for your location. I am not overly convinced that blue light has an effect on my sleep though. I am usually asleep like a baby at night, and if I am going to have sleep problems it is because I have woken up at 3am with a brain buzzing with more thoughts and worries than Macbeth. I have turned on the night light feature, but I will turn it off again if it doesn't look right; or if I need to stay up late coding, then I'll wear shades, increase brightness and turn the high-contrast settings on.

Which feature do I actually like?
There is one new feature that I have been long anticipating and that is that live tiles on your start menu can now be conveniently grouped together into folders. This is exactly the same as what you have been able to do on the Windows 10 phone and is incredibly useful for gathering tiles together and neatly packing them away.

Windows 10 live tiles on Lumia 950, now available for desktops running Creator's update.
To use this feature just grab a live tile and move it over another tile that you wish to join together.

Well, that's all for now. No doubt I will be back when I have discovered something else, either way I will be back posting something geeky for all you nerds to laugh at soon.

Hacking a hurricane plant

Monstera deliciosa, Hurricane plant, or Swiss Cheese plant, call it what you will, they are beautiful plants that take little effort to care for and add a tropical vibe to any geek's dungeon. I've had this one for at least ten years after it was propagated from an earlier parent plant (long ago donated to the Art department of a local technical college).

Yesterday I decided to rescue my plant from the sorry state it had got into over winter. I keep mine in the conservatory where in summer it gets plenty of sunlight and stays warm enough over winter.

Hurricane plant after winter in the conservatory.

The first thing I did was to remove all of the dead leaves. Then I trimmed the aerial roots. I noticed that a number of the aerial roots (which usually attach themselves to nearby rocks and trees) were attempting to make an escape through the carpet. Thankfully there was minimal damage.

Next step was to remove the old string I had used to tie the plant to its support and replace with something more sturdy. I use Toolzone Garden Twist Tie Support Wire which provides a very strong bond between plant and support without damaging the plant.

Hurricane plant with some better support
I then removed some of the young plants that were growing from the base of the Hurricane plant. One of the fun things about this type of plant is that it is very 'hackable'. Any of the shoots providing they have at least two leaves and one aerial root can easily be propagated. You simply need to 'hack' parts of the plant away from the main plant and within a few days they should be growing on their own.

I now have two young plants from the parent plant. These plants should ideally be kept in a sunny location away from direct sunlight and given a moist compost. I used a recycled plastic bottle with drainage holes cut into the bottom which should allow me to see the root system as it develops over summer.

Young plants hacked from the bottom of the parent plant

A password for RISC OS

Recently I set up my Raspberry Pi to boot into RISC OS Pi, and I also showed you how to set a password for your Raspberry Pi for when it boots into Raspbian.

Although it is possible to set a password for your RISC OS Pi computer, horrible things happened last time I tried, and that resulted in a reinstall. I am not going to try again.

Instead I have written a BASIC program that performs the same operation. The file is set to run as soon as the computer boots and it is not possible to escape from the program until the correct password is entered. Although it is not the most secure of systems, it will prevent all but the most determined of attacker.

If you wish to follow these instructions, then they are split into the following sections:

  1. The code
  2. An explanation of the code
  3. Setting the file to run at boot time
The code

   10 REM Password protection
   20 REM T Street
   30 REM Version 2.0
   40 REM 2017-04-02
   50 :     
   60 pass$ = "fish"
   70 :    
   80 welcome$ = FNreadWelcome
   90 MODE 18:
  100 ON ERROR IF ERR = 17 RUN
  110 COLOUR 120
  120 PRINTTAB(0,1)welcome$
  130 ok% = FALSE
  140 guess$ = ""
  150 WHILE NOT(ok%)
  160   PRINTTAB(0,3)"Password : "STRING$(LEN(guess$),"*")" "
  170   g = GET
  180   IF LEN(guess$)=0 THEN PRINTTAB(0,5)STRING$(19," ")
  190   CASE g OF
  200     WHEN 8,127
  210     IF guess$<>"" THEN guess$=LEFT$(guess$,LEN(guess$)-1)
  220     WHEN 13
  230     IF guess$ = pass$ THEN OSCLI("DESKTOP") ELSE PRINTTAB(0,3)"Password : "STRING$(LEN(guess$)," "):
          guess$ = "":
  240     OTHERWISE
  250     IF LEN(guess$)<60 THEN guess$ = guess$ + CHR$(g)
  260   ENDCASE
  280 :     
  290 DEFFNreadWelcome
  300 LOCAL file%, welcome$
  310 file% = OPENIN(":0.Scripts.welcome")
  320 IF file% = 0 THEN = "RISC OS Pi, Welcome"
  330 WHILE NOT(EOF#file%)
  340   welcome$ = welcome$ + CHR$(BGET#file%)
  360 =LEFT$(welcome$,78)


You can either type the code directly into your BASIC editor in RISC OS, or download a copy of the file from OneDrive.

  • The password is set on line 60. 
  • Line 80 reads a custom welcome message from a text file set in line 310. You will need to provide a text file with your welcome message.
  • Line 110 should be omitted whilst you are developing and testing. It prevents the program from exiting on pressing of the "ESCAPE" key.
  • Line 310 reads a text file with your custom welcome message. For example you might want to provide a rude message for your little sister. You will need to provide this text in a text file called 'welcome'. You must also provide the full path to the file in line 310. Here I have it in a folder called 'Scripts' in my root directory.
  • Line 320 provides a default welcome message should the file not exist.  Note that only the first 78 characters of the welcome message are used by the program - so keep it short.

Setting the program to run at boot

Once you are happy that the program is running, save it and then add it to the programs that run at boot.  To do this select the '!configure' icon with a double left-click. Then single click 'Boot', then 'Run'. Drag the BASIC 'password' file into the 'Run at startup' window and click 'set', and then 'set' on the boot sequence.

This program will defeat all but the most determined of attackers. It will not stop someone from accessing the BASIC program itself once you are logged in. Although this program will deter the casual nosy parker from accessing your RISC OS machine, you should not rely on it for system security.

Still reading? How about some more Raspberry Pi stuff?

Getting my pi on the network

I have recently been setting up a Raspberry Pi and documenting the process here.

In previous posts I have been dealing with the RISC OS setup. Today I moved over to Raspbian. This post will deal with:

  • Getting the Pi to see my home network hard drive.
  • Setting up the Pi as a home server.
  • Changing the system password.

Getting the Pi to see the network hard drive
I have a 2TB USB hard drive on my home network. I use this to share music, movies and other media between computers in my home. You can read my full article about getting a USB hard drive to work on your network, however I have summarised the steps for Raspbian below.

  • You need to mount the network drive into the Raspbian file system.  To do this you need to have cifs-utils installed.  My Raspberry Pi 2 came with this pre-installed.  You can check whether it exists or not by running the following command: dpkg -s cifs-util

  • Should you need it, you can install cifs using the command sudo apt-get install cifs-utils

  • Next create a directory on your pi for where you want to mount the network drive: sudo mkdir -p /media/network/public

  • You need to edit the etc/fstab file in order to mount the network drive. You may need to give yourself permission to do this, so navigate to your /etc folder and type chown pi: fstab (where pi is your username).

  • Now open the etc/fstab file in your text editor and add the following single line:

   // /media/network/public cifs defaults,rw,username=pi,password=yourpassword,domain=domain 0 0

Note that the first part is //IP ADDRESS OF ROUTER/directory name of network folder. If your network folder has any spaces in the name, eg "My Documents", then replace the spaces with \040, eg My\040Documents.

The second part is the path to the folder you created in part 3. You will need to put in your own username and password .

  • Now mount the drive using sudo mount -a

Once complete, you will see your network drive appear as a folder in your file manager.

Raspberry Pi file manager showing network drive

Setting up the Pi as a home server
The following steps will allow your Raspberry Pi to serve dynamic web pages to other devices on your network.

  • First install the full LAMP stack with sudo apt-get update and then sudo apt-get install apache2 php5 php5-mysql mysql-server
  • This will install all the software that you will need to run a home server. You may be prompted to enter a password so do add a suitably secure password at this stage. Once you are happy with your password (at it is one that you will remember) the rest of the process may take a few minutes.
  • When the install finished you should navigate to the /var/www/html folder. This folder will contain all of the files that your server will use.
  • To check that your server is working, Apache should provide a test page. Using another computer or phone type the IP address of your web server on your home network. Mine is and you may be able to get this information from your home router page or using the command ifconfig. If all is well, you should get a confirmation page.
Apache confirmation page as viewed in Chrome browser under Windows 10

  • You can now replace this file with your own home page. Should you find that you do not have permission to access files in your webserver, you can use the Linux chown command to change ownership permissions. The syntax is: sudo chown pi: item where pi is your username and item is the name of the file or folder you wish to access, for example: sudo chown pi: index.html will give you ownership access to the file. It may still mean that you can't edit the file, so navigate to the file in your file manager, right click and bring up the 'properties'. Then change the 'permissions' to 'change content: anyone'.
Changing the system password
Now that your Raspberry Pi system is running a web server and has access to the network drive, you will probably want to set the password for access to the Raspberry Pi system. Your Pi may boot directly into a password entry when it boots, however many new installations of Raspbian skip this step so as to make using the machine as painless as possible for new users.

  • Find the main menu, and navigate to 'Preferences' and then 'Raspberry Pi Configuration'.

Finding the password preferences in Raspbian
  • You will be prompted to enter your old password before you can change it. If you are using the default user 'pi', then the default password is 'raspberry'.
  • Make sure that you un-check the box that says Login as user 'pi'.
Hit the 'change Password...' button to change your password. Then make sure you un-tick the box shown. This is what has been letting you log in automatically to the Raspberry Pi, but it also lets your little brother get in and see all your stuff too!

Well, that's all I have for today.  If you are still awake, then you might be interested in some more Raspberry Pi related posts.

Life hack 004

How do you remember the number of days in a month?

Do you just know it? Do you recite a poem to help you? Do you consult your calendar?

I use the following method.

Hold your hands out palms facing up and put your little (pinky) fingers together. Now recite the months in order starting with the index finger of your left hand. Move alternatively from the tips of your fingers to the area between each finger where two fingers join your hand. When you reach the little (pinky) finger of your left hand then you should have counted 'July' and moved on to the little finger of your right hand and counted 'August'.

Every time a month corresponds to the tip of your finger, then this month has 31 days. All the others either have 30 days, or is February, and you just need to remember that February is special.

Image credit: Evan Amos licensed under the Creative Commons Attribution-Share Alike 3.0 Unported 

More life hacks