As we learn more about the Raspberry Pi, we will get to the point that we will need to write programs. We have learned how to write python programs in our earlier tutorial series on the Arduino. Good news is that we can apply what we learned there to the Raspberry Pi. But, we will first have to learn how to create and edit text files. The text editor we will use on the Raspberry Pi is called “nano”. We will learn how to use nano by creating and editing simple text files. Also in this lesson we learn how to make new directories in Linux using the mkdir command. We also learn that we can view a file without opening it by using the “cat” command.
Watch the video above for all this information. These concepts are best taught and learned by watching and doing. So, watch the video and do the commands along with me. You will be an expert in no time!
The first thing we need to learn with Linux is how to navigate the file/folder structure in Linux. In windows we do this by just clicking on pictures of folders and files. The file structure in Linux operates the same way. We have a top level folder we call the root folder, and then we have folders and files inside of folders, and then those folders can have more folders and files. It is a tree type structure that you are already familiar with. What is different is we navigate through the files in Linux from the command lines, and not by clicking on pictures of windows and folders. Once you master the command line, you will prefer that to the clicking on pictures method of Windows.
In this lesson we will learn how to navigate through the files. In Linux, you first give the “waht”, that is what you want to do, or the command you want to do, and then you give the “where”, that is, where in the file structure you want to execute the command.
The first command we can learn is pwd. By typing pwd in the command line it will show you what folder you are presently in. That is useful as you are learning to navigate as it will always show you where you are.
The next command is ls. ls simply lists the files and folders in the present folder.
The final command covered in the video lesson above is cd, which stands for change directory.
After the command, you give the “where”, which is the path to where you want to do the command.
The method of navigating and understanding the file structure is easier to communicate by showing you, so please watch the video above. If you follow the video, you should clearly understand how the path methodology works in linux.
In LESSON 1 we described the gear you would need to work with the Raspberry Pi. At this point you should have the equipment in and be ready to go. In this lesson we will show you how to get your pi up and running. The first thing you are going to need to do is to format your SD card. Please note that you SHOULD NOT use the standard windows formatting routine. You need to download the SD association card formater. You can get the latest version HERE. At the bottom of the page accept the terms, and the download should begin. After downloading, click the file and installation should begin. After installation, the program can be used to properly format your SD card.
After you have formatted your card, the next thing is to download the operating system for the pi. The easiest way to get started is to download the NOOBS system HERE. You can select the Download Zip link. After downloading the file, open the zip folder and remover the contents from the zip folder. You can put the contents into another normal folder that you name “NOOBS”. After you have extracted the contents from the ZIP folder onto the NOOBS folder, you are ready to move it to the SD card. You want to copy the CONTENTS of the NOOBS folder to your SD card. Do not copy the NOOBS folder itself to the SD card, just the contents.
You are now ready to boot your Pi. First, plug the SD card into your Raspberry Pi. Now connect a keyboard to a USB port, and then connect a mouse to a USB port. You can also connect an Ethernet cable if you like. The last thing to connect is the power. Note that you must be careful to NEVER remove the SD card while the Pi is powered up. This will corrupt the card. You should always properly shutdown the pi with Linux command “sudo shutdown” before removing power from the Raspberry pi. It is fairly easy to corrupt the SD card if you are not careful.
When you see the pi come to life, you will be asked what to install. Choose the Raspbian operating system, and then click install. It will take about an hour for it to install the operating system. After the installation is complete, it will offer you a menu of options on configuring the pi. For these lessons, we are going to use the Linux terminal to control the pi and learn Linux. We will go through the graphical user interface in later lessons, but for now we are going to learn Linux
If you have followed us through our series of lessons on the Arduino, and then the lessons on using Arduino with Python you have already learned some really cool stuff. You have probably learned so much, in fact, that you are starting to contemplate projects that will stretch the resources available on the arduino. For example, if you decided to add an LCD display to our GPS tracker project, you would probably find that you had run out of memory on the Arduino.
So while we all love, and will continue to love, the Arduino, you do finally reach the point you need a microcontroller with a little more horsepower. This is where the Raspberry Pi comes in. The raspberry pi is about the same size as the arduino, but it has the power of a desktop computer. With the Raspberry Pi, you still have direct access to ports and pins to build your own custom projects, but you have the speed, memory and CPU needed for much more sophisticated projects. The Raspberry Pi runs Linux, which we will have to learn in these lessons. The good news is that when we get the Pi up and running you can write and run python programs on it, and we have already spent quiet a bit of time learning python. So, with your background in Arduino and Python, you will be up and running on the Pi in no time.
To start with you will need to get your gear together. I definitely recommend the Raspberry Pi model 2, as it is the latest and greatest at the time this lesson is being made. You will need the Pi, a power supply, a micro SD card, and a monitor cable. You will also need a monitor, keyboard and mouse, but you probably already have those things laying around. I have found that the best thing is to buy a kit that includes the pi, power supply, micro SD card, monitor cable and USB WIFI adapter. A kit I really like that I think is an excellent value can be found HERE. Please note that this kit (and most all kits) contain an HDMI to HDMI cable. The output of the Raspberry Pi is HDMI. However, many monitors to not have an HDMI input but want a DVI connector. If your monitor only has DVI input, you will need an additional cable, which you can find HERE. For most people, getting the kit and the cable will be all you need to get started.
If you only have a really old monitor with a VGA input, please note that the HDMI to VGA cables available on amazon do not work. (At least all that I have tried to not work). It is not just a matter of getting a cable with the right connectors on the end. You have to convert HDMI to analog, which the cable does not do. For the case of making the Pi work with a VGA monitor, I have found the Belkin HDMI to VGA adapter will work with the Pi and you can get it HERE.
Please note that I have found the trickiest part of getting the Pi up and running is getting the right cable for your monitor. Please carefully check what type of monitor you have, and get the right cable.
So, get your gear ordered and in the next lesson we will cover how to get things hooked up and configured.
I hope you all will stick with the Arduino lessons I am putting together. They will really lead to some pretty powerful things you can do. Before too long, I will show you how to build an instrument package and send it to space. We have had two successful missions so far. The first one went to 90,000 feet, and the most recent one to 120,000 feet. Our instrument packages have live onboard telemetry and send dozens of channels of data back to the earth. On our last mission we maintained telemetry for over 70 miles. This video describes an overview of the electronics package and telemetry we designed and built for our space probe.
Here is some exciting footage from our mission as the space probe reached its maximum altitude.
Making The World a Better Place One High Tech Project at a Time. Enjoy!