Introduction to Python with Raspberry Pi

Slides:



Advertisements
Similar presentations
Introduction to the Raspberry Pi ® Saman Amighi 10/2013 ® Raspberry Pi Foundation.
Advertisements

WHAT IS A COMPUTER? BY JACK SUMMERS. WHAT IS A COMPUTER? A computer basically a set of different components that when put together in the correct way.
Embedded Programming and Robotics Lesson 12 Introducing the Raspberry Pi Intro to Raspberry Pi1.
An illustrated introduction to building a computer using a Raspberry Pi 2. A Raspberry Pi, that is! Images from Microsoft clipart.
RaspberryPi Ira Goldstein Siena College. What is a Raspberry Pi? University of Cambridge’s Computer Laboratory – Decline in skill level – Designed for.
Basic Computer Structure and Knowledge Project Work.
Translate the following message:
Raspberry Pi.
By Naveed Ahmad! How to setup a. First of all, what are the parts of a Raspberry Pi? Source:
This presentation will cover all of the work that was set during the third week of the course. This means that the task associated with the purpose of.
INSIDE THE COMPUTER. What is Computer ? Computer is Electronic device which work on electricity. OR An electronic device for storing and processing data,
UPGRADING MEMORY BY : tuan mohd fariz.  Choosing and Installing Memory.
SINGLE BOARD COMPUTERS ARE YOU ON THE RIGHT AIRPLANE?
Introduction :  In the beginning, the calculator is the basic idea of computers out, then that arrived at the large computers.  in1980 or late seventies.
1 ENG224 INFORMATION TECHNOLOGY – Part I 1. Introduction to Computers.
THE PARTS OF A COMPUTER WHAT ARE THE PARTS OF A COMPUTER THAT MAKE A COMPUTER A COMPUTER?
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.
Rasberry pi 2 model B. Selve computeren i rasberry pi’en.
Raspberry Pi Project Control Your Home Lights with a Raspberry Pi.
Introducing the Raspberry Pi Nauru ICT Department April 2016.
Farhin Al Masud What is Raspberry PI? o Low cost, credit card sized computer o SOC (System on a chip) o Founded by Raspberry PI foundation.
Raspberry Pi. Introduction The Raspberry Pi is a credit-card sized computer It can be plugged into your TV and a keyboard, and can be used for many of.
Raspberry PI 2 Installation & Demo App By Wayne Keadle.
Professor: Nabil Elmjati IB100 Introduction to computer Sciences.
An introduction to the Raspberry Pi. What is a Raspberry Pi?  University of Cambridge’s Computer Laboratory  Decline in skill level  Designed for education.
SAURABH GINGADE 12311A0480. The Raspberry Pi is a credit-card sized computer.
RaspberryPi.
Introduction to Python with Raspberry Pi
Python with Raspberry PI Kit
Voice Controlled Robot by Cell Phone with Android App
Engineering Innovation Center
Introduction to Computers
Introduction to Computers Mrs. Gambucci
Building Raspberry Pi Controllers with Python
Introduction to Raspberry Pi & Kano
Workshop on Raspberry Pi 3
Computer System Laboratory
Ira Goldstein Siena College
Introduction to Computers
Raspberry Pi.
Chapter Objectives In this chapter, you will learn:
Computer System Laboratory
Written by Joey Cardenas Presented by _______________
Prepared by: Raghad J Foqha Supervisor: Dr. Saed Tarapiah
Chapter A - The Raspberry Pi Computer
Course on Embedded Systems Introduction
INTRODUCTION TO COMPUTING
A microcontroller Raspberry Pi 2 Model B V1.1 RPi
Programming with Arduinos and Rapsberry Pi
Drill Translate the following message:
Lighting LEDs with a RASPBERRY PI
INTRODUCTION TO THE RASPBERRY PI Darrell Davis KT4WX
Raspberry Pi Pi 2 Model B.
PRESENTED BY Bitware Technologies
An introduction to the Raspberry Pi
Introduction to Computers
Introduction to Computers
Computer Basics.
Raspberry Pi. Introduction to Raspberry Pi Python Electronics Linux Outline.
Year 9 Entry Level Computing
Odroid XU4.
Overview 1. Inside a PC 2. The Motherboard 3. RAM the 'brains' 4. ROM
Beginning Raspberry Pi
Introduction to Single Board Computer
Python with Raspberry PI Kit
Emphasis: Get it working and do stuff!
The System Unit By: Cole and Mariah.
Chapter 7 IoT Physical Devices and Endpoints
Raspberry Pi Hardware By: Mike Kwiatkowski.
Presentation transcript:

Introduction to Python with Raspberry Pi Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath History Raspberry Pi first came onto the scene in 2012.  As the story goes, Eben Upton, director of studies at St. John's College, Cambridge inthe UK, and colleagues came up with the Raspberry Pi as a tool to improve education. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

WHAT MAKES RASPBERRY Pi SO COOL? Part of what makes Raspberry Pi such a neat device is it's a powerful computer packed onto a small board and it's cheap.  It can do anything a stand alone computer can do.  The other feature is that you can control things like motors and interface it directly with circuits.  This is why the Raspberry Pi has been embraced by the maker community.  What distinguishes makers is that they build devices that, just a few years ago, could only realistically be built by companies. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

WE'RE GOING TO START A REVOLUTION I don't think it's hyperbole to say that we're on the edge of another technology evolution.  Engineering majors certainly do learn about microcontrollers and electric machines, but they usually don't learn about those things until their junior year.  And too often, those classes get bogged down in theory to the detriment of learning how to actually build and control machines.  Theory's very, very important, of course, but you also want to be able to build things right out of the gate too.  And the other great aspect of Raspberry Pi is that you can build useful devices and systems without getting swamped in theory. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

SOME KINDS OF RASPBERRY Pis Let's next take a look at the Raspberry Pi hardware: 1) Raspberry Pi 3 came on the market in 2016. 2) Pi 2 has a slower processor and no built in wireless support. There is not a huge difference between the Pi 3's and the Pi 2's. 3) There is also a Raspberry Pi Zero, which is an even cheaper model, but it of course has less memory, a less powerful processor, and fewer features. It is good for dedicated projects and experimenting. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

RASPBERRY Pi 2 AND Pi 3 INTERNALS Raspberry Pi 2: RAM: 1GB System on Chip(SoC): BCM 2835 CPU: QUAD Core ARM 7 runs at 800MHz, but has been clocked at 1GHz GPU: Video Core IV 250 MHz Raspberry Pi 3: RAM: 1GB System on Chip(SoC): BCM 2837 CPU: 1.2 GHz ARM Cortex A53 GPU: Video Core IV 400 MHz Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

RASPBERRY Pi 2 AND Pi 3 INTERNALS The Pi 2 and Pi 3 look physically almost the same, save for the built in WiFi and Bluetooth. Both of these have four USB ports: you connect up a keyboard and mouse to two of these ports.  And you could hook up a USB drive to one of the other ports, and you've got a fourth port for whatever. There's an Ethernet connection on both.  The Pi 3 also has WiFI and Bluetooth connectivity built in.  You can use WiFi on the Pi 2 but you'd need a WiFi dongle. There's an HDMI connector so you can connect a monitor or a TV. There's a 3.5mm audio/video jack. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

RASPBERRY Pi 2 AND Pi 3 INTERNALS There's a standard micro USB connector for power input.  You could use a cell phone charger, one for an Android phone would probably work. I'm just using the Raspberry Pi official charger. There's the micro SD card slot. The micro SD card is where you store the operating system and your files. There are 40 GPIOs (General Purpose Input/Output), and these are what enable you to connect the Raspberry Pi to external hardware. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Raspberry Pi 3 B Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Raspberry Pi 3 A+ Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Pi ZERO Specs Super Cheap! Five Bucks! RAM: 512MB System on Chip(SoC): BCM 2835 CPU: ARM 11 clocked at 1GHz It has 40 GPIOs, but the header pins are missing. You need to solder on any connections. Sparse ports: Has only one micro USB port, which requires an adaptor to connect to standard USB devices or a USB hub. Has a mini HDMI port, which requires an adaptor to connect to HDMI connector. Micro SD port is present, but push-click locking mechanism has been removed to save space and reduce cost. No built in Ethernet connectivity, but Ethernet connectivity can be added. Target: If you need a bunch of Raspberry Pis for whatever it is you're building.  Not suitable for learning how to use Raspberry Pi. Basically, it's for people who already know Raspberry Pi, and are building things like robots or security systems. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Pi ZERO Specs Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath SAME COMPUTER... Basically, the same computer.  They run the same operating system software.  The differences are in the price, processor, RAM, and connectivity. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

MICRO SD SPECIFICATIONS _______________________________________ Class 2        2MB/sec Class 4        4MB/sec Class 6        6MB/sec Class 10    10MB/sec The minimum memory for Raspberry Pi is 4GB.  However, you really need at least 8GB, and 16GB is an even better choice.  The 16GB SD card is, in my opinion, the best choice because it's more than enough memory to do the kinds of projects we'll be doing in class.  Large capacity SD cards are available up to 200 GB, but those expensive and not necessary unless ….. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath https://www.pinterest.com/marutizu/terminator-4/

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Operating Systems You can buy the micro SD cards with the operating system pre-loaded or you can buy a micro SD card and install the operating system yourself.  The Raspian is the OS that is pre-loaded. 1) Raspian: Recommended. It's a Linux distribution based on Debian. https://www.raspberrypi.org/downloads/raspbian/ Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Operating Systems 2) Arch: For experienced users.  No built in desktop. 3) OpenELEC: Ubuntu distribution for multimedia, supports Codi. 4) RaspBMC: media-centric distribution; blends XBOX with Raspian 5) Ubuntu MATE for the Raspberry Pi 2 and Raspberry Pi 3 6) Kali Linux for Raspberry Pi 7) Windows 10 IoT Core Some other operating systems: Pidora (Fedora for the Pi), but it probably won't be updated, since the data partition is awkward, Raspian (boot to Scratch) is really for kids, and RetroPie for gaming. There is also RISC OS, which is not Linux based. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath GPIOs Pi 2, Pi 3, and Pi Zero all have 40 GPIOs.  Older Raspberry Pis only had 26 GPIOs.  This is the feature that enables you to hook up external boards and circuits to the Raspberry Pi. You can actually breadboard a circuit and hook the circuit directly up to the Raspberry Pi and have the Raspberry Pi control the circuit. This is really useful for people who design and develop circuits.  You do have to be a little careful if you use the Pi this way because it is possible to fry the Pi. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Do not fry your Pi! Connect the USB keyboard and USB first Connect the HMDI connector Turn on the monitor Plug in the power cable Do not plug in a HAT on a Pi that is plugged in and booted into Raspian. Plug in the HAT before plugging in the power cable. Connect the GND last when connecting circuits to the pins Disconnect the GND first when connecting circuits to the pins Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Do not fry your Pi! Input no more that 3.3V to a GPIO Use GPIO.cleanup() to set the GPIO pins back to a safe state; input only This will ensure that you do not accidently make a short circuit or other errors Current load should be less than 16mA on any one GPIO pin Current load should be less than 100mA for all GPIO pins Do not connect a motor directly to the Pi's GPIO, the back EMF(Electromotive Force) will fry the Pi; Use a transistor Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath HATs HAT stands for Hardware Attached on Top.  These are external boards you can purchase that plug right into the GPIOs.  The Raspberry Pi designers made the Pis backwards compatible, so newer Raspberry Pis can use older boards.  The RaspiRobot HAT has 26 pins; it was designed to work with older Raspberry Pis, but it still works with the newer Pis. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath HAT Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Sense HAT temperature, pressure, humidity sensors accelerometer, compass detects yaw, roll, and pitch joystick Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Creating Python 3 Scripts Menu → Programming → Python 3 (IDLE) IDLE = Integrated Developers Environment File → New File Run → Run Module or press F5 to run Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Python Code from sense_hat import SenseHat sense = SenseHat() sense.show_message("Welcome to Python with Raspberry Pi", scroll_speed = 0.1,text_colour=[0,255,255]) Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Getting Help on Classes help(SenseHat) Use the help function to find information on the properties and functions associated with the class. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Scrolling Text on the SenseHat from sense_hat import SenseHat from time import sleep sense = SenseHat() t = sense.get_temperature() # access the temperature t = round(t,1) # round to one decimal point p = sense.get_pressure() # access the pressure p = round(p,1) h = sense.get_humidity() # access the humidity h = round(h,3) # round to three decimal points Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Scrolling Text on the SenseHat msg = "Temperature: "+str(t)+" Pressure "+str(p)+" Humidity "+str(h) str() converts to a string sense.show_message(msg,0.1,[0,0,230],[0,255,255]) msg is text_string, scroll_speed=0.1, text_colour=[255, 255, 255], back_colour=[255, 0, 0] Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Displaying one character from sense_hat import SenseHat from time import sleep sense = SenseHat() sense.show_letter("H",text_colour=[20,255,80]) text_colour = [red,green,blue] 0 (no color) to 255 (saturation) sleep(3) Sleep for 3 seconds; pause the execution of the code sense.show_letter("i",text_colour=[20,255,80]) sense.clear() clear the SenseHat Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Set a pixel from sense_hat import SenseHat from time import sleep sense = SenseHat() sense.set_pixel(0,2,255,0,0) (x,y,red,green,blue) x coordinate 0 to 7 and y coordinate 0 to 7 Red pixel at coordinate x = 0, y = 2 sleep(0.5) sleep for 0.5 second Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Set a pixel sense.set_pixel(7,7,0,0,255) Blue pixel at coordinate x = 7, y = 7 sleep(0.5) sense.clear() Clear the SenseHat Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath

Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath Update and Upgrade Go to the Terminal sudo apt-get update sudo apt-get upgrade Do not interrupt either of these commands. The second command will take between 30 minutes and two hours depending upon your network connection. Text Copyright (c) 2017 by Dr. Elizabeth I. Horvath