How to Setup Raspberry PI for Beginners (MAC OS Users) By: Dengfeng Li
How to Setup Raspberry PI for Beginners (MAC OS Users)
By: Dengfeng Li
Introduction As a credit-‐card-‐size single board computer, Raspberry PI has amazing computing power compared with other single board computer. The latest model B has a 700MHz central microprocessor and provides 2 USB interfaces, HDMI/audio output and LAN port. It is primary designed for education purpose and for people who are interested in programming. Since it is not designed to substitute the conventional personal computer, it has a relative low price and is affordable for electronics enthusiasts. And, unlike the personal computer that you only need push your power button and friendly graphic user interface will lead you configure it, Raspberry PI is more complicated to setup before you want to use it. But once you get familiar with it, you will find the enormous potential behind it. Raspberry PI is LEGO for engineers, which encourage the exploration and tinkering and allow engineers build inexpensive but fantastic projects such as hosting your own web server, building a high performance robot, home-‐made digital camera, etc. This guide will show you the steps for first time configuration on Raspberry PI and the steps to write a simple demo program running on Raspberry PI. This guide requires you have the skill knowing how to use personal computer under MAC operating system. Besides, a basic knowledge of computer programming will promote you get a better understanding of each step in this guide.
Notes:
• Words with Italic font are explained in detail in Glossary section in the last page
• Sentences with bold font are commands that you need type them into the terminal.
Requirements:
• A Raspberry PI board – model B • SD card: at least 4 GB • SD card reader: if your computer already has a SD card reader, then you do
not need it. • A personal computer – MAC Operation System • HDMI cable • A display: if your display does not support HDMI, then you need an HDMI-‐to-‐
AVG adapter. • Standard USB keyboard and mouse.
Burn the operating system to the SD card Raspberry PI has its own operating system – Raspbian. Raspbian is a reduced Linux system based on Debian. This step shows you how to install Raspbian to the SD card on Mac operating system.
1. First, you need download the operating system from official site: a. http://www.raspberrypi.org/downloads/ b. They provide multiple operating system images; you should use the
Raspbian in this tutorial. 2. After downloading the Raspbian image, there will be two files in your
Download folder. Open the terminal and input the two commands sequentially. First input Cd ~/Downloads and then input ls. You can see there are two files in the Download folder, namely, raspbian.img and raspbina.zip:
3. Then, insert your SD card and type the command df -‐h. You will find a name of your SD card similar as /dev/disk1s1. Then add character “r” before “disk” and delete following “s1”, the result will be your final device name. /dev/rdisk1 in this case.
4. Type sudo diskutil unmount XXX to unmount SD card for pre-‐install. XXX will be the device name of your SD card.
5. Type the command to burn the operating system to your SD sudo ddb s=1m if=XXX.img of=YYY. XXX is the image name of your operating system and YYY is your device name.
6. The burning process will be couple minutes. Once the terminal shows the transferred bytes, the burning process is finished and you are ready to go to the Start PI section
Start Raspberry PI
1. Insert your SD card into the Raspberry PI 2. Connect your display and mouse to Raspberry PI 3. After checking cables are connected correctly, plug in the power cable and
you will see the red LED light on the Raspberry PI board flashing. Since this is the first time to boot the Raspberry PI, you will see the display showing the system check process. After it done, you will see the configuration screen like this:
Configure Raspberry PI:
1. First of all, check the expand_rootfs option. It is used for expanding your system image file to match with the SD card and increase the utilization of the memory. Then press enter on your keyboard to see following reminder:
2. Then, go to the overscan option. This is used for setup the system to match with the display. Choose Enable.
3. Next, you need choose our keyboard type. For standard keyboard, you need choose Generic 105-‐key(Intl) PC.
4. After choosing the keyboard type, you need choose the keyboard layout and language. You will see that the list all showing the UK keyboard layout, you should first choose Other and then select English for US keyboard layout.
5. The following configuration options are negligible for beginners, press [ESC] return to the main menu and select FINISH to restart the system. The restarted system will displayed as terminal mode:
6. Finally, type startx to go into the graphic user interface.
7. Next, try to write a simple demo program to warm up.
Write a demo program on Raspberry PI The Raspbian operating system pre-‐installs the Integrated Development Environment (IED) of Python for you. I will show you how to write a hello-‐world program in Python and run it on Raspberry PI.
1. Double click the IDLE 3 icon on the Raspberry PI desktop to open the IDE 2. Select FILE -‐> New Window and type the code below into the new window
#my first Python program username = input("Hello, I'm Raspberry Pi! What is your name? ") print ('Nice to meet you, ' + username + ' have a nice day!')
3. Now, save the file by selecting FILE -‐> Save As and name it as "hello”
4. Press F5 to run the program. The result will be shown like following:
5. It is quiet simple, isn’t it? Now, you are ready to explore your own creativity and make some cool projects!
Glossary Debian: An open-‐source operating system that mainly based on Linux kernel. But it can also be built on FreeBSD and GUN Hurd kernel. Debian now is the most popular operation system on personal computer and network servers that based on Linux kernel. Linux system: An open-‐source operating system on personal computer and network servers. Linux system induces many variant operation systems that belong to Linux distribution, such as Debian, Ubuntu, Fedora and etc. Raspbian: An open-‐source operating system that adopted from Debian and runs on Raspberry PI. It includes over 35,000 packages; pre-‐compiled software bundled in a nice format.