Monday, April 7, 2014

Install Raspberry Pi without Monitor, Keyboard or Mouse

This guide walks you through how to set up your Raspberry Pi without connecting a TV or computer monitor to it at all only by the means of using an ssh tunnel and a computer. This guide is tailored for using Ubuntu linux, however other operating systems can do the same in a slightly different way.

This method can be very useful for those who do not have access to a HDMI TV or computer monitor where they could do the initial configuration for their Raspberry Pi.

This guide is based on using Raspbian Wheezy OS version 2013-12-20.

Installing on an SD Card

The steps are described at elinux.org nicely, however I would like to point out a few things here.

  1. Obtain a copy of the latest (or desired) version of raspbian.img from
    http://downloads.raspberrypi.org/raspbian/images/
    In this article I will be referring to 2013-12-20-wheezy-raspbian.zip
  2. wget  http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-12-20/2013-12-20-wheezy-raspbian.zip
  3. unzip 2013-12-20-wheezy-raspbian.zip
  4. Note: for me the SDcard was /dev/sdb. You can check yours by e.g. running gparted with

    sudo gparted

    and checking the devices. Makes absolutely sure you are using the correct one!
  5. WARNING! The command "dd" will be used here that can cause major data loss if used incorrectly. "of=/dev/sdb" must be correctly given as output destination. If you choose the wrong drive, it may overwrite everything on your computer's hard disk. In my case the command was

    sudo dd bs=1M if=2013-12-20-wheezy-raspbian.img of=/dev/sdb

    dd -calls dd file copying formatting tool
    bs=1M - Tells what block size to use. This is important!
    if=xxx - Input file
    of=xxx - Output file (again where the command will write)
  6. Flush write cache with

    sudo sync 

WARNING!
When using "dd" please make sure what you are doing. Selecting an incorrect device will lead to data loss.


Note that I have used the second latest Raspbian image as I had issues with the 2014 version with libc6, so I have decided to downgrade. You may try the latest version of course.

At this point you should be done and read to boot your Raspberry Pi for the first time. However, I would like to show how you can set up internet access right away without the need to connect the Pi to a screen. This will allow you to ssh into the device at first boot and configure from there.

Configuring Internet Access

This part depends on whether you want ethernet or wifi internet access. First, mount the newly formatted SD card's 2'nd partition, sdb2 in my case, so

sudo mkdir -p /mnt/raspberry
sudo mount /dev/sdb2 /mnt/raspberry

Open the network configuration file with

sudo nano /mnt/raspberry/etc/network/interfaces

And make it look similar to this

auto lo

#Wired interface, ethernet connection
iface lo inet loopback
iface eth0 inet static
#address 192.168.0.25
#netmask 255.255.255.0
#gateway 192.168.0.1

#Wireless interface (Wi-Pi)
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.25
netmask 255.255.255.0
gateway 192.168.0.1
wpa-ssid YOURWIFISSID
wpa-psk YOURWIFIPASSWORD

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

Save file with CTRL+O and exit with CTRL+X.

Explanation

These settings give a static local IP address to your Pi both to the ethernet (cable/wired) and wireless interface. A static address is useful as this will let you connect to the device always with the same IP address instead of having to search for it on the local network. If you have your Pi connected to your home router with a cable and do not use WiFi, then you don't need to configure the WiFi configuration part.

Assuming you have WPA2-PSK WiFi encryption the wpa-ssid and wpa-psk fields are correct and should be filled in with your network's credentials [2]. If you have other type of WiFi encryption on your local network, please refer to https://wiki.debian.org/WiFi/HowToUse to find the correct settings.

Of course, if your home network is different then you have to adjust the appropriate fields. The above settings are just a sample that you can use.

You are done with the most important configuration part, now the SD card can be inserted into the Pi and booted for the first time. Remove the card from your computer with

sudo sync
sudo umount /mnt/raspberry

Remove SD card and plug it into the Pi.

First Boot

If you did everything correctly, your Raspberry should boot without a problem. Wait about a minute before you would try to ssh. Then you can

ssh pi@192.168.0.25

(192.168.0.25 based on the interfaces configuration file I posted above)

Now you are presented with the terminal login. Log in with the default username and password:
username: pi
password: raspberry

The first thing you probably want to do is open raspberry config and do a few things. You can do this over an ssh tunnel with

sudo raspi-config

Raspi-config screen over an ssh tunnel

Based on what you want to do with your raspberry you can set up a range of things. What I have set up for mine:
  • Set custom hostname
  • Set GPU memory allocation to 16 as I will use the device without GUI and therefore won't need much RAM for the GPU
  • Expand partition (The image file copied to the SDcard is sized for smaller 2-4 GB card. So if your card is bigger, you should expand the partition on it to make it usable)

Add a new user instead of the default pi with

sudo adduser YOURUSERNAME

Give the password twice and fill out the additional information. Then give root permissions to this user by editing the following file

sudo nano /etc/sudoers

And look at the end of the file and append the line

#includedir /etc/sudoers.d
pi ALL=(ALL) NOPASSWD: ALL
YOURUSERNAME ALL=(ALL) NOPASSWD: ALL
This pretty much sums up the most important steps you should take when installing new a Raspberry Pi. The rest is up to you what you want to do with your device.

I like this method, because it spares me the hassle of connecting my Raspberry to a TV, attaching keyboard etc. to configure it. I also keep a second SD card installed as a backup that is just a clean install with ssh access. I had problems before with file system corruption and a quick SD card swap has saved  a lot fo problems for me.

References

[1] - http://elinux.org/RPi_Easy_SD_Card_Setup
[2] - https://wiki.debian.org/WiFi/HowToUse

Thursday, April 3, 2014

Heat Sinks on the Raspberry Pi



The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It is a capable little computer which can be used in electronics projects, and for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming. [1]

This post will discuss the need and usefulness as well as short installation instructions of heat sinks for the Raspberry Pi. Information is related to the Raspberry Pi Model B (512 MB RAM)

 

Is it necessary?

 

The question often comes up, is it necessary to use some sort of cooling on the Pi or is it fine as it is?

From an engineering perspective it is most likely not necessary to use an additional heat sink. A product for sale should normally work "as is" without any major source of failure or a need from the consumer to do changes to the product. Maybe that is only my perspective in general, but the point has been made.

The ARM11 processor powering the Raspberry Pi Model B is used in a range of mobile devices that do not have any cooling, except for passive cooling heat sinks maybe. Forums and other sources say [2] that heat is not an issue with these chips until about 100 degrees Celsius (212 Fahrenheit). It is very unlikely that one would get to such temperatures under any sort of normal usage.

Why Use a Heat Sink then?


Thermal view of the Raspberry Pi Model B (Source)

It is a personal choice to use a heat sink on the Raspberry, but as mentioned above it is absolutely not necessary. So what might influence you to buying a heat sink for your Raspberry?
  • Hot environments and overclocking
  • The looks of the device and peace of mind, knowing it will not overheat
  • Continuous heavy load and overclocking
  • Because you want to do it

Normal Operating Conditions

During normal usage my Raspberry in its original case is operating in the range of 46-48 C, based on my own measurements. This is slightly less than the temperatures of 51-53 C measured by Thomas [4] for an enclosed idling Raspberry Pi. Possibly due to the fact that I am reading off the values via a software whereas he was using thermal imaging.

Either way, these values are well within the operating limit and shouldn't cause any issue any time soon. However, I would sleep better if I knew that there was some sort of extra heat removal method on my Raspberry when I'm not at home and this little thing is working at full load.

Overclocking

Overclocking is the process of increasing the clock rate of the Raspberry Pi's processor. By default it is running at 700 MHz, however even from the default firmware this can be increased to 800 MHz or even further to 1 GHz.

Overclocking increases the speed of the processor, however it also means a higher energy consumption and therefore more heat generated. The temperature of a processor has nothing to do with the performance of the processor (speed), but rather its lifetime. At higher temperatures a processor is more likely to fail compared to one operating at lower temperatures, refer to image below. 
Semiconductor lifetime with increasing junction temperature (source [3])

Hence it is of best interest to keep CPUs at as low temperatures as possible.

I am still running my Raspberry Pi at the original 700 MHz and do not plan to overclock any time soon. If I will need an increased performance I would look into it, but for now I do not see the point for my usage profile.

Which Heat Sink to Use and Where to Put It?

I went for Aluminium heat sinks (from eBay) which were exactly the right size and made for the Raspberry Pi. For easy application I chose the ones that have some thermal paste sticker on the back, so it is literally as easy as peeling off the back and aligning it properly on the chip.

Aluminium heat sinks ready to be glued onto the chip

Aluminium heat sinks applied to the Raspberry Pi

I would say position or aligning the heat sinks (which way the fins are facing) is barely going to affect the already small efffect they make. If you have an air flow over the Pi then from a heat transfer point of view it is more efficient to have the fins parallel to the air stream so that it moves between the fin and removes more heat. Nevertheless, do not worry about this as it will not make a significant difference, especially if you are using the Pi in a standard room condition without overclocking.

Be careful when position and dropping the glued heat sinks onto the board as they stick fast and removing-reapplying them may reduce the contact surface between the heat sink and the board. Apply pressure gently to make them stick nicely, but avoid damaging the board.

Conclusion

If you want to put some heat sinks on your Raspberry Pi because you are worried about it "burning out", then you probably do not need heat sinks. In some of the above mentioned use scenarios you can consider, but chances are it will not make much of a difference.

If you love tinkering with tech, want to learn a little about the RPi and are curious, then go ahead, It isn't much work nor does it cost a lot of money, but you will have a slightly more customized Raspberry Pi.

References

[1] - http://www.raspberrypi.org/faqs
[2] - http://blog.oscarliang.net/raspberry-pi-heat-sink-do-you-need-it/
[3] - http://www.interfacebus.com/Integrated-Circuit_Derating_Guide.html
[4] - http://www.tooms.dk/?page=http%3A//www.tooms.dk/Tblog/Showblog1.asp%3FY%3D2012%26M%3D9


Wednesday, April 2, 2014

Ubuntu One File Services Shutting Down!

Canonical has announced today shutting down the Ubuntu One cloud storage and music storage system. The company said that they cannot compete any more with other service providers giving away free 25-50 GB of storage. As a consequence further releases of Ubuntu, starting with 14.04 LTS, will not ship with the Ubuntu One file services.

However, as the blog post states
"The shutdown will not affect the Ubuntu One single sign on service, the Ubuntu One payment service, or the backend U1DB database service."

Important Dates to Keep in Mind

April 02 2014: It is no longer possible to buy additional storage or music files
June 01 2014: Services will be unavailable (User data still available for download)
July 31 2014: All files left in the cloud will be deleted


Please read the official blogpost here: http://blog.canonical.com/2014/04/02/shutting-down-ubuntu-one-file-services/ for more information about the details.

Make sure to backup all the data you have in Ubuntu One file storage!