Recently I was tasked to develop some software to Raspberry PI. For those who are not familiar Raspberry PI is a single-board computer with a size of a credit card although it is little bit thicker. So better comparison will be to say that it has a size of a computer mouse. Project Raspberry PI was starter in 2006 with idea to develop small and cheap computer to teach programming and basic computer science in schools. But it has grown so much that today it is used in many other areas. Raspberry PI actually is a foundation responsible for developing hardware and software. There are some vendors that build and sell hardware and accessories.
So what hardware is on that single board and what software runs Raspberry. First there are couple of models Raspberry. The most recent one is Raspberry Pi 2 Model B. It has the following hardware:
900MHz quad-core ARM Cortex-A7 CPU 1GB RAM 4 USB ports Full HDMI port Ethernet port Combined 3.5mm audio jack and composite video Micro SD card slot 40 GPIO pins Camera interface (CSI) Display interface (DSI) VideoCore IV 3D graphics core
Because it has an ARMv7 processor, Raspberry can run the full range of ARM GNU/Linux distributions, including Snappy Ubuntu Core and as well as Microsoft Windows 10. But official supported operating system is called Raspbian. As name suggest it is based on Debian. Here is the download page of Raspbian. And here is the full list of products that you can download. And Raspbian comes with a lot of pre-installed software. It even has Oracle Java SDK 8.0. So you can start developing and running Java just after initial setup. Of course it comes with Python and other software packages. And because Raspbian is based on Debian you can use apt-get to install nearly all packages available on Debian. As Ubuntu is based on Debian too. It should be easy for Ubuntu users to start running and developing for Raspberry. If you need more info you can check their FAQ section.
Where to buy and what do you need to buy
First thing first. You need to buy it from somewhere. As Raspberry is non profit foundation they do not develop it and sell it. But they have list of re-sellers where you can buy it from. You can check http://swag.raspberrypi.org/. There is also some official sellers listed on FAQ section. But you can search Google and most probably there will be some online stores in your country that sells Raspberry. And that’s the way I bought mine. There are some accessories that are sold separately. Also there are some starter kits which contains everything to start using it. But they are expensive and often include keyboard and mouse which you will need only a few times. Or at least I needed it only after the setup to configure IP address of my Raspberry. So I bought only a Raspberry and a plastic case for it. Here how it looks compared to mouse and with case.
What do you need to run Raspberry
Raspberry needs of Micro SD card to run, which is not sold with board. You need to buy it additionally and to save operating system on it. Note that not all SD cards are compatible with Raspberry. Minor number of SD cards have problems running operating system. Also note that you need at least 2 GB, or better at least 4 GB Micro SD card. It is recommended also SD card to be from the high class. With other words to have a good write and read speed. On this link you can check whatever you card is compatible or not. I had one Toshiba Micro SD card. It’s capacity is 16 GB and write/read speed is 40Mb/s. And I can confirm it runs perfectly.
You need also power supply. You can use your phone of better tablet charger. I used from one old tablet Toshiba which outputs 5V and 2A. According to specification everything above 1.5A should be enough. But 2A is better as can provide more power for processor.
Also you need network cable to attach Raspberry to your home network. When boot it uses DHCP to obtain IP address and you can connect via SSH. But by default SSH is not enabled. So you need keyboard, mouse, HDMI cable and monitor to do initial setup. After that you can access it via SSH.
Install Raspbian on Micro SD card
First you need to download operating system. My choice was Raspbian which is official operating system. Download Raspbian from here. There is also Noobs version of installer which you can use to install other operating systems. Although on their site they suggest to start with Noobs I would suggest opposite. Download Raspbian and forget about Noobs.
Once downloaded you need to write it to Micro SD card. I used one old multi card reader which supported different card size and formats. So I put card into multi card reader. And put it into USB slot my Ubuntu.
Installing Raspbian to Micro SD card is exactly the same as installing Ubuntu from USB stick. You follow the same steps described in article.
1. Download Raspbian.
2. Unzip it.
3. Put Card reader into USB slot.
4. Open terminal.
5. Type dmesg to see to which device USB was assigned.
howopensource@ubuntu:~$ dmesg [21704.383412] USB Mass Storage support registered. ........................ [21705.387475] sdb: sdb1 [21705.390321] sd 6:0:0:0: [sdb] No Caching mode page found [21705.390362] sd 6:0:0:0: [sdb] Assuming drive cache: write through [21705.390406] sd 6:0:0:0: [sdb] Attached SCSI removable disk
6. Execute next two commands to write image file to USB port (respectively to SD card).
howopensource@ubuntu:~$ sudo dd if=2015-09-24-raspbian-jessie.img of=/dev/sdb bs=4M howopensource@ubuntu:~$ sudo sync
First Boot of Raspberry
After writing Raspbian to Micro SD card you need to put it into Raspberry slot. Then you need to attach necessary cables. And finally you need to plug power supply into power network. See how it looks like fully attached and running Raspberry. It has two lights similar to normal computer which indicates IO operations (disk/card) and power light.
When you done with initial setup you can access Raspberry via SSH and then you need only power cable to tablet charger and network cable.
How to Stop and Start it
To star Raspberry juts plug charger into power network. To stop Raspberry use corresponding Linux command – halt or shutdown -h now and then unplug charger from power network. Then to start it back just plug charger to power network.
sudo halt sudo shutdown -h now
First Login – User: pi, Pass: raspberry
Here what happens when you boot Raspberry. Default user and password for Raspbian is user: pi and pass: raspberry.
When you boot for the fist time you will be asked a couple of question. Operating system needs to configure some options. Later on you can change it of course.
And here how looks Raspberry desktop and GUI. Second picture shows Raspberry web site opened in default browser.
Hope you enjoy reading. In next article I will write how to setup static IP address of your Raspberry so you can connect via SSH in an easy way.