Thursday, November 3, 2016

Installing an OS on your Raspberry Pi

If you want to use your Raspberry Pi as a pocket sized computer, you're going to need to install an OS, or Operating System. Raspberry Pi uses Linux as its operating system, which is stored on the SD card (or, if you have a newer Raspberry Pi, the micro SD card).

Flashing Your SD Card
If you bought your Raspberry Pi as kit, it likely will come with an SD card that has already been flashed with NOOBS (you can also buy them separately for fairly cheap pre-installed with NOOBS, ~$9 on Amazon). If this is the case, then you can ignore this section. However, if you just have a blank SD card that you plan on using, or if you are a more advanced user and want a particular distro of Linux, then this is a step you'll need to complete.

To do this, all you'll need is another computer that has an SD card reader. You can follow the directions below depending on if you're using Windows, Mac OS, or Linux:

https://www.raspberrypi.org/documentation/installation/installing-images/

What is 'NOOBS'
NOOBS stands for "New Out Of Box Software" -- It is a very easy-to-use installation manager for installing your operating system. When you boot your Raspberry Pi up for the first time (after your SD card has been flashed), you should see this installation manager pop up (image below)


There are a few key things that I want to point out on this screen before you click "Install" ...

Different Linux Distros
In Linux, you can choose from a wide range of distros (short for distributions). The easiest analogy I can think of for understanding what a distro is, is ice cream. Say that Linux is ice cream -- the distros would represent all the different flavors of ice cream. All ice cream in the end is still ice cream, however, it takes different ingredients to make the different flavors and achieve different tastes. In Linux, all distros are still Linux at their core, but they are made differently and for different purposes.

With NOOBS, we have the choice of installing the following Operating Systems:

- Raspbian
- Pidora
- LibreELEC
- OSMC
- RISC OS
- Arch Linux



Rasbian
The most popular and most recommended Linux distro to use on the Raspberry Pi is Raspbian. This comes from the Linux distro Debian (Debian, Raspbian -- Notice that they sound kind of alike!), but has been tweaked and changed to work better for the Raspberry Pi. Raspbian is great because it doesn't just install a basic OS, it also installs software and packages, such as Minecraft, IDLE, PyGames, and so on. If you are just beginning, this is a great place to start.






Pidora
Pidora, much like Raspbian, comes from another Linux distro that has been tweaked for the Raspberry Pi. Instead of Debian, however, this comes from the distro Fedora (Pidora, Fedora -- Notice that they sound kind of alike!).






These are the main two you'll likely be using, but if you're interested in the others that are listed, I've provided links to their information pages below:

LibreELEC
OSMC
RISC OS
Arch Linux

Language
The other thing I want to point out on this screen is the Language setting -- Since Rasperry Pi is from the UK, this will default to "English(UK)" and the keyboard will default to "gb" (which stands for Great Britain). If you're in the US, this could pose a problem! You might think there would be no difference here, since both speak English (even though the other spells things a bit funny), but the keyboard layouts are ever-so-slightly different in the UK vs. the US. To save yourself a headache later and avoid little annoyances like finding the # symbol, make sure to change this to the appropriate keyboard you're using before hitting install.

Time to Install
Once you have chosen your desired Linux distro and changed the language/keyboard, go ahead and hit "Install" at the top left. You'll immediately be brought to a loading screen that will tell you the progress of the install. Once its done, you'll be asked to re-boot and your operating system should now be installed and working!

Pay attention to the fun facts that they have on the load screen for the install -- They give out helpful information about your Rasperry Pi -- Including what your login and password are! (HINT: login = pi and password = raspberry)

If you have any trouble, or have further questions on installing operating systems on your Raspberry Pi, feel free to shoot me an email or leave your questions in the comments.

Thursday, September 29, 2016

Quickstart on IDLE




On your Raspberry Pi, one of the quickest ways to begin programming in Python is by using the program IDLE, a Python development environment. Let's begin exploring and understanding IDLE, so our Python projects can go more smoothly.




Opening IDLE
IDLE can be found in your menu under "Programming." You'll find two options here -- Python 2 and Python 3. Both of these are IDLE, however, Python 2 uses Python 2.7 (a more legacy version of Python), and Python 3 uses Python 3.4.




Using the Shell
Once you open IDLE (you can open Python 2 or Python 3, for this post it does not matter), you see a screen pop up that say "Python Shell" in the title bar, and list the version of Python you're using. You'll also be prompted with three arrow keys, that look like the following:

>>>

This is called a REPL (Read Evaluate Print Loop), and it's where we can type some Python commands. We can store variables here. For example, try typing the following:

>>> name = "Fluffy"
>>> "Hello " + name

What happens when you press enter? you should see it return the following:

'Hello Fluffy'

We can also use it as a basic calculator:

>>> 2 + 2

Upon hitting enter, it should spit out:

4

The shell is great for running commands like this, however, let's explore some different options for writing code in IDLE.

Hello World
To write a program we are going to want to create a file that we will run through the shell. This allows us to create a program instead of running just basic commands. To do this from IDLE, go to File > New Window. You'll see an empty page open (that looks a lot like a simplified Word Document!) and we will type in the following:

print("Hello World!")

Save your file as helloworld.py (make sure you put "py" and not "pi"!) and let's hit run! What happens?

You should be seeing your program run through the Python Shell and print 'Hello World!'

These are the basics of writing Python in IDLE. We will use this for most projects we do on this blog.



Questions? Comments? Ideas for future posts? I want to hear them! Please leave them in the comments below.

Tuesday, September 27, 2016

Arduino or Raspberry Pi?




         



I frequently hold workshops for kids who want to learn both programming and computer hardware, for which I use the Raspberry Pi. I get a lot of questions surrounding the difference between Raspberry Pi and Arduino, and which one is better. Both are great in their own respects, but both are different and it all depends on what you want to use it for. The main difference is the Raspberry Pi is a microprocessor, while the Arduino is a microcontroller

Let's start by looking at what each one is separately:

Raspberry Pi

The Raspberry Pi is a small pocket-sized computer (a single board computer - SBC), and is much more general-purpose than the Arduino. Much like your computer at home, it runs using an operating system (In our case, Linux) and can run more complex applications. Anytime you're making something that needs more power, Raspberry Pi is your best bet. It is more close to a computer than to the Arduino.


Raspberry Pi would be your best bet if you were making the following:

- Complex Robotics
- Learning to hack
- Cameras/Video
- Graphic interfaces
- Complex equations

If you're looking for tutorials or projects that you can do with the Raspberry Pi, look out for future posts or go take a visit to the Raspberry Pi foundation blog.

Arduino





The Arduino (also known outside of the US/UK as Genuino) is bare bones compared to the Raspberry Pi, as it is an 8-bit microcontroller used to do simple functions over and over again. Something to note is that the Arduino does not have an operating system like the Raspberry Pi.


Examples of when you might use an Arduino are the following:

- Motors
- Simple robotics (Like a line-following robot)
- Sensors
- Character LCDs

For more projects or tutorials that you can do with the Arduino, check out this page from their website.


If you're still confused on which to get, there is a general rule of thumb that I've read on a few different sites: Describe your project in a simple sentence. If you can do so with one or two 'and's, get an Arduino. If you need more than two 'and's, get a Raspberry Pi.


If you have any questions, or ideas for a blog post you want written, please feel free to let me know!