Category : Beginner

Raspberry Pi WiFi Configuration

This article is about how to configure Wi-Fi on your Raspberry Pi without using the desktop GUI

It only takes a minute or so and is basically just entering your Wi-Fi settings into the configuration file.

Let’s get started…

We’ll need our Pi up and running and you’ll want to make sure we have all the latest updates, so open a terminal (or SSH connection to it) and make sure you’ve run the following commands:

sudo apt-get update
sudo apt-get upgrade

Now plug in the USB Wi-Fi plug. To check that it has been recognised you use the command:


You should see your Wi-Fi adapter listed. An easy way to check is to run the lsusb command with the adapter unplugged and again with it plugged in (you should see an extra device listed).
Next we want to configure the device so that it connects to our Wi-Fi network. To do that we’ll need to edit the /etc/wpa_supplicant/wpa_supplicant.conf file, so type:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

You’ll see there are only 2 lines in the file (assuming you haven’t already entered any Wi-Fi configuration. So now we add our Wi-Fi details – namely the SSID (network name) and the PSK (password). The format is to add those details as follows:


Obviously replace myssid and mypassword with your actual values. Below is one I create with sample values.


Now close and save the file (CNTL+X, Y, ENTER), and reboot and your Pi should connect to Wi-Fi.


Hope this has been useful. Leave a comment below and let me know…

Raspberry Pi FTP Server

In this project we are going to set up a FTP server using vsftpd. This is one of the fastest and most secure FTP server for Linux.

This will take us around 10 minutes to complete and is solely consists of typing commands to install and configure software.
By the end of this you will have a FTP server running on your Pi that you (and authorized others) will be able to connect to and upload/download files.

Lets get started…

We’ll need our Pi up and running and you’ll want to make sure we have all the latest updates, so open a terminal (or SSH connection to it) and make sure you’ve run the following commands:

sudo apt-get update
sudo apt-get upgrade

Now we’ll want to install the vsftpd package:

sudo apt-get install vsftpd

When this is complete (it takes a minute or two) we will have the software installed and need to move on to configuring it. To configure it we need to edit the vsftpd.conf  file in the /etc/ folder. As this file is in the /etc/ folder we’ll need to be sudo to do that, so enter the following:

sudo nano /etc/vsftpd.conf

All the options are set to their defaults initially, but there are a few we want to change:


Setting this to ‘YES’ allows us to run the software as a daemon


This setting needs commenting out, or the service will fail to start. Simply add a # character at the beginning of the line


Setting this to ‘YES’ allow other users to log in without have to enter a username / password first, but they will only have ‘read’ access (because of the following settings). Obviously, set this to ‘NO’ if you don’t want unauthenticated users being able to access your server / files.


Setting this to ‘YES’ (by removing the # character at the start of line) allows authenticated (not anonymous) users to upload files to our server.


Setting this to ‘NO’ (or omitting it from the configuration by adding a # character at the start of the line it is on) prevents anonymous users from uploading files – we don’t want any old user uploading files to our server (and maybe maliciously using up all the storage, or worse)

ftpd_banner=Welcome to the Pi Starter FTP server

You can set this to any text value and that text will be displayed to users when they successfully login. Make sure you remove the # character from the start of the line.

Excellent, we should now be fully configured and ready to start the ftp server, so we do that by entering the following command:

sudo service vsftp start

We should now have a fully working FTP server. You can test this out by running something like CuteFTP, or FileZilla on a remote machine and connecting to your Pi. Here’s an example of my FileZilla client connected to the Pi, and a Windows (PowerShell) command line connection to it


Hope this has been useful. Drop me a comment if you got it working.

Time-lapse Video with a Webcam

This project will show you how to use a standard webcam to create a time-lapse video recorder – great for watching the whole day go by in a few minutes.

For this we’ll need a Raspberry Pi, a USB webcam (and a portable power source if you want to position it somewhere outside)timelapse_stuff
I’ll be using a Pi B+ running the latest version of Raspbian Jesse, a USB Wi-Fi dongle, a Microsoft Lifecam HD and an Anker portable battery pack.

First up you’ll want to get powered up and logged in, with the USB webcam connected. To check the webcam is recognised just type lsusb


You can see that my webcam is Device 005 on Bus 001 and is from Microsoft Corp.  So great we’re in business, now we need some software to control the webcam. For that we’ll be using fswebcam – this is a great package with tons of features, but we’ll only be using the basics. To install it just type sudo apt-get install fswebcam


You can try it out by typing fswebcam –r 1280×720 –no-banner image.jpg (the –r 1280×720 tells it what resolution to use for the capture, the -–no-banner tells it not to display the time banner and image.jpg is the name of the file to save the image in.


You can view this image now on the Pi if you have a monitor attached or by grabbing a copy of the file (FTP, SFTP etc) onto another machine.
Now we have this working we’ll also need some software to convert all the image captures we take into a movie, for this we’ll use avconv which is part of the libav-tools package, so let’s install that by typing sudo apt-get install libav-tools


That’s all the software we need, it is just a matter of orchestrating things. We’ll need to:

  1. Capture a webcam snapshot to a file (with a sequential number as the filename)
  2. Sleep for X seconds
  3. If we don’t have enough snapshots yet go back to step 1
  4. Merge all the snapshots together into a time-lapse movie file
  5. Delete all the snapshot files

To write the script that does all this type nano and enter the following:

DATE=$(date +”%Y-%m-%d_%H%M”)

while [ $COUNT -le $MAXCOUNT ]; do

FILENAME=$(printf “%05d.jpg” “$COUNT”)

# take the snapshot
fswebcam -r 1280×720 –no-banner $DIR/$FILENAME

# pause for a bit
sleep $INTERVAL;


# now make the movie
avconv -r 5 -I $DIR/%05d.jpg -vcodec libx264 -r 30 timelapse_$DATE.mp4

# and tidy up the files
rm -f $DIR/*.jpg

Final bits required are to create the timelapse folder – type mkdir timelapse and make the script we wrote executable – type chmod +x

We now have a script that will take a snapshot every 10 seconds (INTERVAL) until we have 30 of them (MAXCOUNT) and then combine them all into a movie for us. Be warned that this will take some time (30 time 10 seconds to get all the shots and then around 10 minutes of processing to combine them) but the result will be a cool time-lapse movie.
Feel free to adjust the INTERVAL and MAXCOUNT to record for longer period and with different periods between shots.

Getting Started with a Pi Zero

Managed to get hold of a Pi Zero ? Here’s how to get started with it…

The Pi Zero only has a single micro USB port for connecting peripherals. That can make it a little tricking when trying to get things set up. There’s a few bits that you will need to go along with your Pi Zero in order to set it up and get it going :

First up you’ll want to load the latest version of Raspbian on to your micro SD card (instructions here), then you’ll want to insert the micro SD card into your Pi Zero, making sure it’s pushed all the way in.


Next, connect up the micro USB OTG (On The Go) connector to the wireless keyboard/mouse dongle and insert that into the middle of the three connectors.


Lastly, for this bit, connect up the mini HDMI cable to the monitor and then connect the micro USB power cable.

The Pi Zero should now boot and you’ll see the text boot sequence log flashing by on the monitor. Depending on which version of Raspbian you are using you will either get a shell (text based console) or the screen will blank and then start up the desktop. If it boots to the desktop, then open xTerminal, if it boot to the shell then your good to go.

What we need to do now is to configure the Wi-Fi settings. To do this enter the following :

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

This will open the existing file which will likely only have 2 lines in it. Underneath those lines you will add your Wi-Fi details. It looks like this:


Replace MYSSID and mypassword with the actual values for your Wi-Fi network.

You can multiple of these ‘network’ sections if you have multiple Wi-Fi access points that your Pi Zero will access. Just make sure that each of them has a unique id_str.
When you have added your details hit CNTL+X, then Y and then ENTER to quit and save the file. Now you can shutdown the Pi Zero and we’ll do a little ‘plug and play’

When it has shutdown pull out the wireless keyboard/mouse dongle (it may leave the OTG adapter in there, no problem). Now plug in the USB Wi-Fi adapter to the OTG and make sure it’s plugged into the Pi Zero. Reapply power (unplug and plug in again) and it should boot up as usual, but will now automatically connect to Wi-Fi.


You can now access it from a remote machine via SSH. Open your SSH client and connect to raspberrypi.local (note: you need to have iTunes or other Apple software installed on the remote machine for it find the Pi using .local) Assuming all that has worked you’ll have a SSH connection to your Pi Zero and can tinker as needed. You can also, at this stage, remove the mini HDMI and run ‘headless’.

Great, we’re done, one Pi Zero set up with Wi-Fi, running headless, ready for some project.