(Raspberry) Pi Day Extravaganza!

Slides:



Advertisements
Similar presentations
How to use the NEC projector Its easy! Really!. How to use the NEC projector IMPORTANT-make sure you have reserved the equipment (projector and/or laptop).
Advertisements

Lab7: Introduction to Arduino
Discovering Computers Fundamentals, Third Edition CGS 1000 Introduction to Computers and Technology Fall 2006.
Getting your Arduino to Work: Microsoft Windows 1.Install Arduino programming environment 2.Install Arduino Uno driver 3.Make sure you can download a program.
Computer Basics 1 Computer Basic 1 includes two lessons:
Introduction to the Raspberry Pi ® Saman Amighi 10/2013 ® Raspberry Pi Foundation.
Cambodia-India Entrepreneurship Development Centre - : :.... :-:-
Installing software on personal computer
Intel Do-It-Yourself Challenge Hello World with the Arduino IDE Nicolas Vailliet Intel.
SET UP COMPUTER ** PLEASE BE AWARE SCREENSHOTS MAY NOT MATCH **
Embedded Programming and Robotics Lesson 12 Introducing the Raspberry Pi Intro to Raspberry Pi1.
COMPUTER SYSTEM.
An illustrated introduction to building a computer using a Raspberry Pi 2. A Raspberry Pi, that is! Images from Microsoft clipart.
Raspberry Pi Training Truman College Goals of our Training Today Unbox and boot up the Raspberry Pi (RPi) Learn how to access the desktop graphical.
Silicon Labs ToolStick Development Platform
Lesson 4 Computer Software
Operating Systems Operating System
Chromium OS is an open-source project that aims to build an operating system that provides a fast, simple, and more secure computing experience for people.
COMP1070/2002/lec3/H.Melikian COMP1070 Lecture #3 v Operating Systems v Describe briefly operating systems service v To describe character and graphical.
Parts of a Computer.
Ch Review1 Review Chapter Microcomputer Systems Hardware, Software, and the Operating System.
CPU (CENTRAL PROCESSING UNIT): processor chip (computer’s brain) found on the motherboard.
Operating Systems  A collection of programs that  Coordinates computer usage among users  Manages computer resources  Handle Common Tasks.
Translate the following message:
By: Joshua chambers INTRODUCTIONINTRODUCTION What your computer can do depends upon two things: the hardware your computer has, and the software that.
High Speed Data Converter University
Geo CE-XM ch 4 Edited 10/14/05 1 The XM is the newest of the rovers, and unlike other units, it comes with software installed on the unit as well as using.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Booting Ubuntu Linux Live CSCI 130 – Fall 2008 Action Lab Dr. W. Jones.
By Naveed Ahmad! How to setup a. First of all, what are the parts of a Raspberry Pi? Source:
Jim Ng 15/1/2014 CENG4480 TUTORIAL 1. ABOUT ME Current MPhil Student supervised by Prof. Mak You can find me at Rm116 in SHB
1 THE COMPUTER. 2 Input Processing Output Storage 4 basic functions.
Click once to reveal the definition. Think of the answer. Then click to see if you were correct. HARDWARE Physical parts of the computer.
Introduction :  In the beginning, the calculator is the basic idea of computers out, then that arrived at the large computers.  in1980 or late seventies.
CSC190 Introduction to Computing Operating Systems and Utility Programs.
Parts of the computer Deandre Haynes. The Case The Case This Case is the "box" or "chassis" that holds and encloses the many parts of your computer. Its.
Intro to Raspberry Pi A Southwest Florida Hackerspace Workshop Presented by: Russell Benzing & Eric Schiffli.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Chapter 6A Operating System Basics PART I.
Unit 1: Computing Fundamentals. Computer Tour-There are 7 major components inside a computer  Write down each major component as it is discussed.  Watch.
Digital Literacy: Computer Basics
 Contents 1.Introduction about operating system. 2. Minimum requirement for Windows 7 operating system. 3. Procedure to install Window 7 operating system.
Raspberry Pi Project Control Your Home Lights with a Raspberry Pi.
SMOOTHWALL FIREWALL By Nitheish Kumarr. INTRODUCTION  Smooth wall Express is a Linux based firewall produced by the Smooth wall Open Source Project Team.
Raspberry PI 2 Installation & Demo App By Wayne Keadle.
An introduction to the Raspberry Pi. What is a Raspberry Pi?  University of Cambridge’s Computer Laboratory  Decline in skill level  Designed for education.
Introduction to Computers Mrs. Gambucci
Workshop on Raspberry Pi 3
Computer System Laboratory
Welcome to Arduino A Microcontroller.
Implementation of Embedded OS
IoT 101 with Raspberry Pi and Azure
Operating System Review
Computer System Laboratory
Embedded Software Development with Python and the Raspberry Pi
Chapter A - The Raspberry Pi Computer
An Arduino Workshop A Microcontroller.
A microcontroller Raspberry Pi 2 Model B V1.1 RPi
Arduino Part 1 Topics: Microcontrollers Programming Basics
Programming with Arduinos and Rapsberry Pi
Lighting LEDs with a RASPBERRY PI
Engineering Innovation Center
Computer Basics.
Roller Coaster Design Project
Operating System Review
Building an Internet of Things Device
Software Setup & Validation
Introduction to Single Board Computer
Lab #1: Getting Started.
Windows Operating System
Raspberry Pi Hardware By: Mike Kwiatkowski.
Presentation transcript:

(Raspberry) Pi Day Extravaganza! Brought to you by: UMIEEE, IEEE GOLD, Visions Electronics Presenters: Troy Denton, Ahmad Byagowi

Disclaimer Any opinions or viewpoints expressed do not necessarily reflect those of IEEE, IEEE GOLD, UMIEEE, or any of our sponsors Any software provided or mentioned is for educational purposes only You break it, you buy it Just kidding, you already bought it

The Agenda (1/2) Introductions and parts hand-out SD Card flashing procedure, setup walk-through Raspberry Pi intro (while we flash SD cards) Hardware overview Software (OS) overview Community Support Loading up the Desktop (GUI) Command line fun – installing software for our workshop

The Agenda (2/2) Programming example 1 – “Hello World” Break for Pie & demonstrations! Programming example 2 – Blinking Lights Programming example 3 - The MCP3001 SPI ADC Arduino interaction Various demos

What is not covered In-depth linux material Programming techniques We will guide you through examples, however to do this topic justice would require a series of workshops Programming techniques Will give insights and explanations relevant to examples only, again in the interests of time Circuit theory Again, insights relevant to the material covered today only Arduino use We will get a basic example working, but that’s about it

What is not covered As much as I would like to teach all of this extra material, this is a “Raspberry Pi” event UMIEEE regularly throws workshops that cover these topics If questions stray too far from the prepared material, I will defer them to after the allotted time (9:30) Will stay beyond 9:30 if there is interest Feedback is appreciated!

Introductions Introductions Thank people for coming

Introductions – get your parts! Presenters: Troy Denton, Ahmad Byagowi Honorable mentions: MTS Memory Express Visions Electronics UMIEEE IEEE GOLD The Raspberry Pi Foundation! (http://raspberrypi.org)

Setup

Setup Log on to the windows machine in front of you Password is “ece” Go to the following website: http://troydenton.ca/rpi.html Unzip the UMRPImg_4G.zip that is on your desktop If it is not there, download it from http://troydenton.ca/UMRPImg_4G.zip

Setup – flashing the card Windows *nix Extract win32diskimager Right click win32diskimager, run as administrator “Browse” to the extracted rpi.img file Figure out /dev/ path for your SD card dd bs=4M if=/path/to/rpi.img of=/dev/<sd card>

Setup – flashing the card Windows *nix Select the proper device in the “Device” drop down. On lab machines this should be device E:/ or G:/ Click “Write” Be careful!! Figure out /dev/ path for your SD card dd bs=4M if=/path/to/rpi.img of=/dev/<sd card>

Raspberry Pi Intro

Raspberry Pi - Philosophy As computer geeks and tinkerers, we generally like to hack and modify the things around us

Raspberry Pi - Philosophy Unfortunately this lends itself well to breaking all of your stuff

Raspberry Pi - Philosophy Most consumer devices are not meant to be hacked, or even easily understood In this respect they are like a black box

Raspberry Pi - Philosophy The raspberry pi, however, can withstand common tools, and even chris brown. The idea being here, is that it is a flexible and expendable platform you can use to learn

Raspberry pi - Philosophy ∑( )= The Raspberry pi is the efforts of a group of hobbyists, designing a board around the broadcom BCM2835. Not paid to design it Non profit org in UK

Raspberry pi - Philosophy raspberrypi.org forums: Just shy of 60,000 members http://www.raspberrypi.org/archives/tag/educatio nal-manual http://www.adafruit.com/blog/category/raspberry -pi/ The latest and greatest raspberry pi projects and tutorials Amazing online presence (stats as of 2013-03-13) 15,000,000 results for “raspberry pi” – launched 2012 27,000,000 results for “arduino” – launched 2005

Raspberry pi - Philosophy In keeping with the community spirit, UMIEEE IEEE GOLD like to spread the word

Raspberry Pi - Hardware Overview of peripherals A Pi-casso?

Raspberry Pi – Hardware Coming Soon!

Raspberry Pi – Hardware Broadcom BCM2835 CPU core is an ARM11 GPU + CPU RAM

Raspberry Pi – Hardware Broadcom BCM2835 CPU core is an ARM11 RAM: 256MB (Model B Rev1) 512 MB (Model B Rev2) CPU Speed: can technically go up to 1GHz Contains all logic for serial buses (USB, SPI, I2C) GPIO pins go _directly_ to the CPU

Raspberry Pi – Hardware Broadcom BCM2835 CPU core is an ARM11 Can overclock it via software settings CPU and GPU each have their own memory allocation – where the “memory split” occurs is configurable in software GPU needs a minimum 16MB

Raspberry Pi - Hardware Digital inputs and outputs only! No analog!

Raspberry Pi - Hardware JTAG header Display connector Camera connector

Raspberry Pi - Hardware USB to Ethernet Adapter

Raspberry Pi - Hardware

Raspberry Pi - Software Designed with linux systems in mind, not necessarily required RISCOS Arch linux Fedora Occidentalis Raspbian (our distro of choice) A slew of others….

Raspberry Pi - Software Raspbian is what is known as the “Operating System” (OS) Similar to windows running on your home PC, the raspberry pi requires an operating system to work Raspbian is a special-purpose distribution based on Debian (a variant of linux) The OS is what lets the raspberry pi not only run programs, but run multiple programs concurrently It accomplishes this with a “scheduler” in the OS Simply put, this makes programs “take turns” Only one program is actually executing at any one time

Raspberry Pi - Software The SD card contains: The OS All Programs on the Raspberry pi All permanent (nonvolatile) storage, in general

Loading up the OS

Loading up the OS Plug in the Network cable Plug in your SD card Plug in your HDMI cable Plug in the USB hub Plug in mouse and keyboard from desktop computer Set monitor to hdmi (press this button twice ) Plug in usb power (act fast) The Raspberry pi automatically boots off of the SD card

Loading up the OS You should see the raspberry pi logo, and a bunch of computer jargon printing to the screen This is the linux kernel in action! When it is finished, you will be prompted to login. Username: pi Password: raspberry

Loading up the OS You are now at the system prompt Commands to try: ls ls –a, ls –l, Lists the files in the directory cd <directory> Move to directory <directory> Enter “cd” without a directory to return “home” top This shows all of the programs running

Loading up the OS Let’s take full advantage of our SD card: type sudo raspi-config and hit enter This is a program you can use to configure the raspberry pi Select “expand_rootfs”

Loading up the OS

Loading up the OS To load up the graphical desktop, type startx and hit enter LXDE is the “Lightweight X Desktop Environment” In linux, you can use different programs to provide a graphical interface GNOME KDE LXDE XFCE Etc… Many programs have been preinstalled, look around!

Loading up the OS Midori – internet browser OpenOffice.org – Open source alternative to Microsoft Office, “compatible” XBMC – Xbox media Center Demo on this later Roughly equivalent to a 300MHz Pentium 2

Loading up the OS When we’re done looking around, close your open programs (for performance purposes) Double click the “LXTerminal” icon on the desktop This will open a small terminal window

Command line fun – installing software for our workshop

Command line fun In the console window, enter the following: cd git clone git://github.com/doceme/py-spidev.git sudo apt-get install python-dev Will take a few minutes cd py-spidev make sudo make install

Command line fun What did we just do? cd Command used to change directories git clone git://github.com/doceme/py-spidev.git Download sourcecode from a git repository sudo apt-get install python-dev Download and install development libraries from our package manager make Compile the sourcecode that we got via git into usable programs sudo make install Install these programs into system directories

Command line fun sudo nano /etc/modprobe.d/raspi-blacklist.conf Change the file so it looks like: #blacklist spi-bcm2708 #blacklist i2c-bcm2708 Use arrow keys to move around Then hit CTRL+O to save, enter to confirm CTRL+X to exit

Command line fun To enable the SPI drivers, we need to restart the system sudo shutdown –r now More on SPI later We are now done installing software!

Programming example 1 – “Hello World” Without further ado, let’s fire up geany and write our first program on the raspberry pi! For our purposes today, we will be coding in Python.

Programming example 1 – “Hello World” Log in, “startx” if you havn’t already Open up geany (LXDE icon/start menu > programming > geany) Enter: print “Hello, World!” print “This is our first” print “Python example!”

Programming example 1 – “Hello World” Save this as helloworld.py in your “home” directory To run the program, we need to go back to our command window. (open if you havn’t yet) Enter: cd Enter the command: python helloworld.py Congratulations, You’re a nerd now

Break for pie!

Programming example 2 – blinking lights “Hello world” is the first step in programming traditional computers Similarly, blinking an LED is the first step in the microcontroller world This is accomplished through the GPIO pins! GPIO: General Purpose Input Output

Programming example 2 – blinking lights GPIO pins are special connections to the processor that can be controlled by code Instead of your program telling the raspberry pi to put words on the screen, you can tell the raspberry pi to turn a switch on or off

Programming example 2 – blinking lights Each GPIO pin is either switched “on”, or “off”. We “call” a function to change its state. Hey! Turn it on!

Programming example 2 – blinking lights Each GPIO pin is either switched “on”, or “off”. We “call” a function to change its state. Turn it off now!

Programming example 2 – blinking lights Enter, the breadboard:

Programming example 2 – blinking lights Little to do with bread

Programming example 2 – blinking lights Rows of adjacent holes are connected together

Programming example 2 – blinking lights The outer “strips” are connected as well

Programming example 2 – blinking lights Pin numbering: BCM style

Programming example 2 – blinking lights Pin numbering: BCM style The BCM numbering style refers to the pin names of the actual CPU pins -Each pin on the cpu has a number and a name

Programming example 2 – blinking lights Pin numbering: Raspberry Pi header - NOT USING THIS! Just FYI 2 4 . 25 26

Programming example 2 – blinking lights

Programming example 2 – blinking lights Open up your terminal cd mkdir gpio cd gpio wget troydenton.ca/blink1.py sudo python blink1.py

Programming example 2 – blinking lights While this is running, open the file in geany

Programming example 2 – blinking lights

Programming example 2 – blinking lights wget troydenton.ca/blink2.py sudo python blink2.py

Programming example 3 – reading an input Similar to how we can tell the CPU to output a value, we can have the CPU “read” a value 5V “0!” voltage “What do you see ??” 0V time

Programming example 3 – reading an input Similar to how we can tell the CPU to output a value, we can have the CPU “read” a value 5V “1!” voltage “What do you see ??” 0V time

Programming example 3 – reading an input

Programming example 3 – reading an input Limitations of GPIO: When accessing via python, not at its fastest C is much faster… but, not as easy for a workshop Max GPIO output speed (using python in raspbian) ~60 kHz by this measurement Upwards of 80 observed Jitter issues Acceptable for real-time? Not likely! Max input speed slightly better ~111 kHz

Programming example 3 – reading an input wget http://troydenton.ca/blink3.py sudo python blink3.py

Intro to SPI SPI: Serial Peripheral Interface bus A loose standard used to transmit data serially Implementation is up to chip manufacturers Many chips out there speak SPI… EEPROMs (memory) Some Network interface IC’s Analog to digital converters (MCP3001) In this section, we will use the MCP3001 to read an analog voltage into the raspberry pi

Intro to SPI Example from MCP3001 datasheet Digital Output Analog input

Intro to SPI Example from MCP3001 datasheet Digital Output Analog input

Intro to SPI Example from MCP3001 datasheet

Intro to SPI

Installing SPI Libraries Run the following commands: cd mkdir adc cd adc wget http://troydenton.ca/adc.py python adc.py Turn the potentiometer and watch the display change

Arduino interaction The arduino is another embedded platform/microcontroller Based on the Atmel AVR series of microprocessors Today we are going to use our embedded computer (Raspberry pi) to program our embedded computer (Arduino!) Because we can.

Arduino interaction Plug your arduino into an open USB port on the raspberry pi Open up the Arduino IDE by clicking “start” > Programming > Arduino IDE In the Arduino IDE, select Tools > Board, and select your model of Arduino If you do not know which, ask one of us and we will get it going for you

Arduino interaction Next, go to tools > Serial Port > /dev/ttyUSB0 Load up some example code by going to File > Example > Basics > DigitalReadSerial

Arduino interaction Modify the code to look like this: Then, click the button to upload the test code to the arduino Click to bring up the serial console

Arduino interaction Make sure the “Baud Rate” is set to 9600 in the serial console: You should see your test message printing once a second

Demos and other installed software