As we near the end of the year, I thought I would delve into my ‘box of things’ to create something apt for the festive season;  I came up with Christmas Lights.

What I used

  1. Raspberry Pi (with Raspbian ‘Wheezy’ operating system (OS) on an SD card)
  2. Micro USB cable power supply
  3. Arduino
  4. Breadboard
  5. 8 x 5mm LED’s
  6. 8 x 330Ω resistors
  7. 10 Jumper wires
  8. Either an Arduberry or a Cable A to Cable B USB (to connect the Raspberry Pi to Arduino)
  9. Edimax wifi adaptor ( If wanting to use Raspberry Pi without physical connection to the router )
  10. Ethernet cable ( If network settings have not already been configured on the Raspberry Pi or you do not have a wifi adaptor )
  11. Laptop/PC


I wanted to create an application that combined the use of my Raspberry Pi with my Arduino; the use of the Raspberry Pi would act as my mini computer whilst the Arduino would be utilised for the output.  I also wanted to use my Raspberry Pi headless i.e. with no keyboard, mouse or monitor.  Therefore I used virtual network computing (VNC) from my laptop to connect to my Raspberry Pi.


I am making the assumption that the OS has already been loaded correctly onto the SD card and inserted into the Raspberry Pi and that the initial setup of the Raspberry Pi has been completed.  As I have a MacBook, these instructions are tailored to a computer with a UNIX environment.

What I did

1.   Configure Raspberry Pi Network Settings

As I connect my Raspberry Pi to the same network each time I use it, I decided to configure the network connection within the wifi protected access (WPA) client and supplicant on my Raspberry Pi; this enables me to get going quickly each time I turn my device on.

To do this, I initially needed to connect the Raspberry Pi directly to the router using the ethernet cable and be able to ssh into the device to be able to configure the correct settings.  However, in order to ssh, I needed to find out what IP address the Raspberry Pi was connecting to.  By running the following command through terminal on my MacBook, I was able to see the different connections:

arp -a

One of the connections showed:

raspberrypi ( at 74:da:38:54:8c:ae on en0 ifscope [ethernet]

where is the IP address.  The default username on the Raspberry Pi is ‘pi’, so I was able to ssh by running:

ssh pi@

When connecting to the host for the first time, you might see the following:

The authenticity of host ' (' can't be established. 
RSA key fingerprint is e3:68:b6:5b:27:37:85:57:f6:90:34:81:ae:3b:66:23. 
Are you sure you want to continue connecting (yes/no)?

You should type ‘yes’ in response.  It will then proceed to add the IP address to the list of known trusted hosts.

The default password on a raspberry pi is ‘raspberry’, so when prompted, this should be typed in.

Now that I was connected to my Raspberry Pi, I was able to proceed with editing the WPA settings.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Inside of the conf, make sure that there is the following making sure to replace {WifiName} and {WifiPassword} with your wifi connection settings:

trl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


You should now restart your Raspberry Pi safely using:

sudo reboot

2.   SSH into the Raspberry Pi

On restarting, you should disconnect your device from the ethernet cable and plug in the wifi dongle if you wish.  On startup, you should now be able to SSH into the device through your wireless wifi connection.  A reminder of the commands are:

arp -a
ssh pi@

3.   Housekeeping and Installation of Software

I used the advanced package tool (APT) in order to install software onto the Raspberry Pi.  For a bit of housekeeping, the following should be run:

sudo apt-get update 
sudo apt-get upgrade

N.B There will be much output from these commands in the terminal.  I was then able to install a VNC server and the Arduino IDE onto my Raspberry Pi:

sudo apt-get install tightvncserver
sudo apt-get install arduino

4.   Start VNC server


The first time that this is run, a password will be required to access the VNC desktop.

5.   Start VNC session

vncserver :0 -geometry 1920x1080 -depth 24

6.   Check out the VNC desktop

You need to go to a web browser and type the following as the URL replacing {ipaddress} with the IP address you identified earlier when SSH’ing into the Raspberry Pi :


In this example, I would direct my browser to vnc:// .  A pop up may appear; you need to specify your IP address as your VNC server and your password is what you have set in step 4.

Now that the setup of the Raspberry Pi has been completed, the configuration of the Arduino can be carried out.

7.   Plug Everything In

Christmas Lights Circuit

Diagram from SparkFun

Christmas Lights Setup

8.  Write Code

You should navigate to the Raspberry Pi desktop and open the ArduinoIDE.  In a new sketch, type the following:

int ledPins[] = {2,3,4,5,6,7,8,9};

void setup()
  for(int i = 0; i <= 7; i++)

void loop()

void oneAfterAnotherLoop()
  int delayTime = 100; 
  for(int i = 0; i <= 7; i++)
    digitalWrite(ledPins[i], HIGH);
  for(int j = 7; j >= 0; j--)
    digitalWrite(ledPins[j], LOW);

9.   Upload to Arduino

The Arduino needs to be connected to the Raspberry Pi.  This was done using a cable A to cable B USB.  To upload the code to the Arduino, you need to make sure that you have specified what board you want to upload to.  Under Tools, navigate to Board and select the type of Arduino you own.  I selected Arduino UNO.  You also need to choose a serial port under Tools –> Port.  You are now ready to upload via Sketch –> Upload

10.   Watch the magic!

Christmas Lights