• Like
Getting Started with Raspberry Pi v1.2
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Getting Started with Raspberry Pi v1.2


Getting Started with Raspberry Pi is one of 4 daily workshops put on by FamiLAB at Otronicon 2013.

Getting Started with Raspberry Pi is one of 4 daily workshops put on by FamiLAB at Otronicon 2013.

Published in Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Getting Started with Raspberry Pi Otronicon: 18 January 2013 Developed byWednesday, January 30, 13
  • 2. Getting Started with Raspberry Pi Welcome! Let’ get started! This will be fun and you will learn a lot today. Please follow instructions and only use the Raspberry Pi when instructed to do so. Your Raspbery Pi should be running the latest Raspbian OS available here: http://www.raspberrypi.org/downloads Okay... Let’s go!Wednesday, January 30, 13
  • 3. Getting Started with Raspberry Pi Let’s Play! For the first ten minutes today we will play. Go ahead and right click on the Python Games icon on the desktop and select open. Click OK on the audio dialog box. When we are working on the desktop today we will be opening files by right clicking. Opening files and programs can be a little slow to start from the desktop environment. Also, if you double click multiple times, you will open several versions of the same program, so we’ll use the right click method to open things as opposed to the wrong click method today! Select a game and play!Wednesday, January 30, 13
  • 4. Getting Started with Raspberry Pi Shut down! Shut down Python games by clicking on the close button (x) in the upper right corner of the Python Game Launcher window. From the lower left corner of the desktop, left click and select logout from the pop up menu. Click on the shutdown button in the LXDE window. Don’t worry, we’ll be turning the Raspberry Pi back on in a few minutes after we discuss how to use it and look at some amazing examples!Wednesday, January 30, 13
  • 5. Getting Started with Raspberry Pi Why buy a Pi? The official Raspberry Pi Foundation description: “The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used 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.”Wednesday, January 30, 13
  • 6. Getting Started with Raspberry Pi Eben Upton The Raspberry Pi was built so that learning about computers and programming could be fun! Eben Upton, the inventor of the Raspberry Pi, used to have fun playing on and tinkering with computers when he was younger. Once he started teaching computing at the University of Cambridge, he noticed that students were no longer having fun coding with computers. They were just playing games rather than making them. To improve the situation, he got together with some friends, started the Raspberry Pi Foundation, and got to work creating a wonderful little computer that would be fun to program and play with!Wednesday, January 30, 13
  • 7. Getting Started with Raspberry Pi Eben Upton CNN Moneywatch featured Eben Upton and the Raspberry Pi: $35 computer can get kids coding Eben Upton, the man behind Raspberry Pi, hopes to bring computer programming skills to a new generation. http://money.cnn.com/video/technology/innovation/2012/12/10/ t-raspberry-pi-kids-coding.cnnmoney/Wednesday, January 30, 13
  • 8. Getting Started with Raspberry Pi How is it used? The Raspberry Pi is used in a lot of ways! It runs on a Linux Operating System so… how it works depends on the linux build. Some builds are very easy to use like Raspian “Wheezy” the one you are using here today, while others are customized for specific tasks. Some other examples are Raspbmc (a media center distribution), Risc OS, or Plan 9 from Bell Labs. This operational diversity is one of the benefits of the Raspberry Pi. But to get started and to remain consistent, we suggest using Raspbian Wheezy. http://www.raspberrypi.org/downloadsWednesday, January 30, 13
  • 9. Getting Started with Raspberry Pi Look, up in the Sky! 1) Project Black Sky: https://vimeo.com/user14504880 Project Black Sky is a science project done by a 13 year old that took a Raspberry Pi up to 85,000 feet in a weather ballon! “The Raspberry Pi performed flawlessly during the mission. While other more expensive electronic devices in the capsule failed (the Canon camera and the Spot GPS), the Raspberry Pi never stopped functioning, even through extreme low temperature and pressure, and a violent descent.” http://www.projectblacksky.com/Wednesday, January 30, 13
  • 10. Getting Started with Raspberry Pi ...in a SNES 2) Ted’s Super Nintendo Emulated System: This project uses the Raspberry Pi to replace the main logic and graphical components in a SNES. This is one of the more sophisticated projects done on a Raspberry Pi. http://www.raspberrypi.org/archives/2984 http://tinyurl.com/SNES-FamiLAB http://tinyurl.com/snes-hackadayWednesday, January 30, 13
  • 11. Getting Started with Raspberry Pi ... as a Media Center 3) An XBMC is an open source, cross platform media center originally designed to run on the Xbox. Many people are buying Raspberry Pi’s to use as dedicated media centers. There are many media center builds. We’ll demonstrate one here: Play clip from “Push Pause Play” on openELEC RP. http://wiki.xbmc.org/index.php?title=Raspberry_Pi Push Pause Play may be downloaded here: https://vimeo.com/34608191Wednesday, January 30, 13
  • 12. Getting Started with Raspberry Pi ...as a Camera Controller 4) Lance R.Vick’s Raspberry Pi Camera Controller: Lance made his camera rig at FamiLAB. Some of the FamiLAB members helped him cut the bracket out of MDF board on a CNC mill to make the camera mount. Other FamiLAB members helped him build the gears for the rig on their 3D printers! Lance uses an open source C library called gphoto. He also uses Python code to bind the C code into very useful software modules. https://vimeo.com/50499145 http://lrvick.net/ http://gphoto.sourceforge.net/proj/Wednesday, January 30, 13
  • 13. Getting Started with Raspberry Pi ...as a Server 5) Raspberry Pi as a web server: “How to” by Jeremy Morgan http://tinyurl.com/piwebserver Solar Powered FTP!: http://tinyurl.com/solarftpserverWednesday, January 30, 13
  • 14. Getting Started with Raspberry Pi ...Minecraft? 6) Minecraft Pi Edition: Mojang and the Raspberry Pi foundation announced Minecraft Pi Edition in November. It is due to be released soon! http://www.raspberrypi.org/archives/2872 Keep an eye on the main Raspberry Pi foundation blog and forums to see what else is happening on the RP! http://www.raspberrypi.org/Wednesday, January 30, 13
  • 15. Getting Started with Raspberry Pi Raspberry Pi Model B The B model is the first RP to come off of the production line. It has gone through at least 3 major revisions in the last year. Every revision has brought major improvement yet not affected the $35 price point.Wednesday, January 30, 13
  • 16. Getting Started with Raspberry Pi Raspberry Pi Model A The A model is scheduled to start shipping soon. Lacking an ethernet connector and having only one usb port allows the A model to ship at a price of $25. This simplified version will also require less power which will be attractive for some projects. Imagine having a “B” model to use a developers machine, and using “A” models to deploy in projects. Many projects will not require wired networks and a usb hub can provide many alternatives.Wednesday, January 30, 13
  • 17. Getting Started with Raspberry Pi Handling the RP The Raspberry Pi was built to be used, but not abused. Every Printed Circuit Board (PCB) should be handled with care. Handle the RP only by the edges of the board itself. Avoid touching or holding any of the components on the board. Rough handling can cause solder points to fail and may result in short circuits. Experiment, but be careful with the GPIO pins as well. A great reference is the Raspberry Pi Users Guide: http://www.raspberrypi.org/archives/tag/gareth-halfacreeWednesday, January 30, 13
  • 18. Getting Started with Raspberry Pi Order of operations: Connections to the Raspberry Pi include power, video, audio, network, usb and general purpose input and output (GPIO). It is important to make your connections at start up and shut down in a certain order.Wednesday, January 30, 13
  • 19. Getting Started with Raspberry Pi Order of operations: Power: As a general rule regarding connectors, power to a system should be the last thing to be connected and the first thing to be disconnected after a shutdown. If power is supplied before other connections are made, bad things can sometimes happen.Wednesday, January 30, 13
  • 20. Getting Started with Raspberry Pi Order of Operations: Make connections in this order: 1) Operating System (SD card) 2) Audio Visual Display and audio 3) USB peripherals Mouse, keyboard, hub, etc. 4) Network 5) GPIO (optional) 6) Power See the official Quick start guide here: http://www.raspberrypi.org/quick-start-guideWednesday, January 30, 13
  • 21. Getting Started with Raspberry Pi Power up! Please plug the power cable back into your Raspberry Pi. As your RP boots up, you will see a report streaming down the monitor. Eventually the boot sequence will finish and you will find yourself at the prompt! Don’t worry, this is a good place to be. A very good place!Wednesday, January 30, 13
  • 22. Getting Started with Raspberry Pi Let’s do an update. Enter the following text into the terminal: sudo apt-get update Apt stands for Advanced Packaging Tool. It is used in the terminal to manage, download and install packaged files. The Apt command you have just entered has updated and synchronized all of your Raspbian packages.Wednesday, January 30, 13
  • 23. Getting Started with Raspberry Pi Let’s find Joe. Let’s search for and install a useful program: Enter the following text into the terminal: apt-cache search joe When you hit your enter key, you will see a list of resources pouring down your terminal. These are all of the resources that include the string “joe” in the current Raspbian build on the Raspberry Pi. Apt-cache search explores a repository of known software for the current Raspbian build of the RPs operating system. It requires a live network connection to locate the remote files.Wednesday, January 30, 13
  • 24. Getting Started with Raspberry Pi Let’s install Joe If we see Joe, let’s get Joe. Joe is a programmer’s text editor that has syntax highlighting for Python and C. We’ll use Joe to make our first program on the Raspberry Pi! Enter the text: sudo apt-get install joeWednesday, January 30, 13
  • 25. Getting Started with Raspberry Pi Let’s work with Joe Once Joe is done installing, the prompt will show up in the terminal. When it does, let’s type in the following line: joe helloworld.py The command above “calls” up the program Joe, and opens a new document. It also names the file helloworld.py. If the file had already existed, then Joe would have simply opened it. But since we just installed Joe, this single line of code just created and named a new file. That’s pretty cool!Wednesday, January 30, 13
  • 26. Getting Started with Raspberry Pi Let’s make code This new file needs some content. Let’s type in the following in Joe’s editor section: print “hello world” Next, type Ctrl+K to save the file and “X” to exit Joe.Wednesday, January 30, 13
  • 27. Getting Started with Raspberry Pi Let’s run code After we have used Joe to write our Python code, we’ll simply use the built in interpreter to run the program. Type the following into the terminal: python helloworld.py The program will run and return the string of text “Hello world” to the terminal. You have now written and run your first program on the Raspberry Pi. Nice work!Wednesday, January 30, 13
  • 28. Getting Started with Raspberry Pi Utility time Before we move to the desktop environment and get deeper into coding, let’s learn a few more things about the terminal. Let’s look for devices! Enter the following: lsusb Lsusb lists (usb devices detected) This command shows all USB devices detected and gives pertinent data for each. With this information, you can search through “repositories” that contain software and firmware updates related to the devices.Wednesday, January 30, 13
  • 29. Getting Started with Raspberry Pi More utility time Let’s have a look at which modules are running. Enter the following: lsmod Lsmod (lists modules) displays modules open in the linux kernel. What’s a linux Kernel? The kernel is the central program that manages the OS. A Shell is another program that is used to allow the user to communicate with the OS. The terminal that you are using now is a shell.Wednesday, January 30, 13
  • 30. Getting Started with Raspberry Pi One More Thing! Before we go ahead and leave the terminal, we shall gather one more set of resources and unpack them. Please enter: wget http://www.raspberrypi.org/game.tar.gz Wait for the files to load. tar xvfz game.tar.gz This uncompresses the gzipped archive. Next, enter: cd game and finally: python snake.pyWednesday, January 30, 13
  • 31. Getting Started with Raspberry Pi Snake! DId you see that? It’s a snake! Made out of the letter “o.” Use your arrow keys to pick up as many digits as you can. Play Snake for a few minutes and take a short break! when you are done playing Snake, enter: Ctrl+ZWednesday, January 30, 13
  • 32. Getting Started with Raspberry Pi Terminal At this point we have reached the end of our terminal session. We hope your fingers are not too tired, as we will be hacking and mousing around the LXDE next. So, for your last terminal command please type: startx into the terminal and then quickly remove your hands from the keyboard!Wednesday, January 30, 13
  • 33. Getting Started with Raspberry Pi Desktop Session When the desktop environment loads, please do not open any programs! The Raspberry Pi can be very slow in the desktop environment. Many linux applications run slow in this environment, so in order for you to be able to operate follow instructions! Don’t click on any icons yet!Wednesday, January 30, 13
  • 34. Getting Started with Raspberry Pi Shortcuts! Overview: Scratch - Block based programming for kids. IDLE and IDLE 3 - That’s right - 2 versions of Python! Midori - Default web browser. PiStore - The new place to get RP stuff. Debian Reference - The manual that hackers read. Wifi Config - A gui wifi set up program LX Terminal - A windowed version of the terminal. Python Games - A python game arcade.Wednesday, January 30, 13
  • 35. Getting Started with Raspberry Pi Scratch Demo! Let’s right click on the Scratch icon on the desktop! The cat is named “Scratchy!” She’s a pretty cool cat. Wait for it! The LXDE may take a few seconds to load things on the RP processor. When Scratch opens, click on the control button in the upper left window (the block palette) to call up the control blocks. Announcement: There are FamiLAB Scratch workshops every morning at 10:30 during Otronicon right here in this room!Wednesday, January 30, 13
  • 36. Getting Started with Raspberry Pi Control Blocks Drag the “When space key pressed” object to the scripts window. The Scripts window is the center window. Place the block near the top.Wednesday, January 30, 13
  • 37. Getting Started with Raspberry Pi Audio Blocks Click on the sound button in the block palette to call up the sound blocks. Drag the “play sound meow” block onto the stage below the command block. Drag the sound block until it attaches like a puzzle piece to the command block.Wednesday, January 30, 13
  • 38. Getting Started with Raspberry Pi Motion Blocks Click on the Motion button. Drag either of the “Turn 15 degrees” blocks so that it connects to the bottom of the sound block.Wednesday, January 30, 13
  • 39. Getting Started with Raspberry Pi Spin Scratchy! Click on the space bar!Wednesday, January 30, 13
  • 40. Getting Started with Raspberry Pi Stop Scratchy! Scratch is used to teach young students basic programming structures. It was developed at the Lifelong Kindergarten Group at the MIT Media Lab. Quit Scratch, and don’t save! Q. Why quit Scratch? A. We have to get that cat out of here before the giant snake comes back!Wednesday, January 30, 13
  • 41. Getting Started with Raspberry Pi LXTerminal We are going to run some more code in python. We have already completed the “Hello World” program back in the terminal using Joe. Now we are going to run python from the LXTerminal Go ahead and open the LXTerminal by right clicking on the desktop icon and selecting open.Wednesday, January 30, 13
  • 42. Getting Started with Raspberry Pi List At the prompt, type in: ls (That’s a lower case L and S!) and hit return. “ls” lists the files and directories located within the current directory level that you are accessing in the terminal. We jsut used “ls” to get oriented in the terminal.Wednesday, January 30, 13
  • 43. Getting Started with Raspberry Pi Navigate At the prompt enter cd game and hit return. The CD command tells the terminal to change directories and open the game directory. Entering “ls” again will show us the contents of the game directory.Wednesday, January 30, 13
  • 44. Getting Started with Raspberry Pi Interpreter In the game directory you should find snake.py along with a few other python files. Enter python snake.py and hit return. You have invoked the python interpreter by typing python. Typing snake.py lets the interpreter know which file to load.Wednesday, January 30, 13
  • 45. Getting Started with Raspberry Pi Snake! Use the arrow keys on your keyboard to guide the snake! The space bar will restart the game. Play a few rounds and then exit Snake. Enter Control + z to exit snake.Wednesday, January 30, 13
  • 46. Getting Started with Raspberry Pi Hack it! Let’s use Joe to open the .py file and look inside! Type the following into the terminal: joe snake.py Hit return.You should see the snake.py file Use your arrow keys to navigate down until you find the following text: def snake(scr); This is the code that defines the snake.Wednesday, January 30, 13
  • 47. Getting Started with Raspberry Pi Yellow Snake! A few lines below the def snake(scr); change the line that reads: curses.init_pair(1, curses.COLOR_RED,... to curses.init_pair(1, curses.COLOR_YELLOW,... You may have to enter Shift + S to unlock the text file in Joe. If so you will be prompted when you enter the text.Wednesday, January 30, 13
  • 48. Getting Started with Raspberry Pi Longer tail! Continue to scroll down the code with the arrow key. Find the text for the tail: # empty tail tail = [] length = 10 Go ahead and change the length from 10 to a number less than 30.Wednesday, January 30, 13
  • 49. Getting Started with Raspberry Pi Save it and Exit! Type the following into the terminal: Ctrl + K and then D This will save the changes to the file. Enter Ctrl + K and then ZWednesday, January 30, 13
  • 50. Getting Started with Raspberry Pi Save and Run it! Re-run the script by entering: python snake.py Did it work?Wednesday, January 30, 13
  • 51. Getting Started with Raspberry Pi Thank You! We’ve been through a lot together. Scratchy asked me to thank you for saving her from the large snake! We’ll spend the rest of this session looking at the examples and exploring the Raspberry Pi. Feel free to play with python or explore the examples with us! Don’t forget to come visit us at FamiLAB.Wednesday, January 30, 13
  • 52. Workshops! Otronicon FamiLAB workshop schedule: 10:30 a.m. - Scratch: Game Programming for Kids 12:30 a.m. - Introduction to Soldering - Build a Game 3:00 p.m. - Getting Started with Raspberry Pi 5:00 p.m. - Introduction to Arduino For information about workshops and more: http://familab.org/Wednesday, January 30, 13
  • 53. Thank You! Learn more about FamiLAB here: http://familab.org/Wednesday, January 30, 13