Top Banner
Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015
28

Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Jan 11, 2016

Download

Documents

Ruby Carter
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Education 299: Raspberry Pi Training

Mike Davis – Truman College5/19/2015

Page 2: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Welcome!

• This professional development workshop is for educators who are looking for an opportunity to integrate new technology into the classroom.• You will learn how to:• Use your Raspberry Pi remotely• Find it on a network• Use it to control a camera• Use it to host a local web page

Page 3: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Goals for Today

• Plug in and access your Raspberry Pi• Load the Raspian Wheezy Operating System• Play with the OS and get comfortable with the command line• Determine the IP address of the Raspberry Pi• Connect the camera and take pictures• Retrieve pictures from the Raspberry Pi• Use a python program to take a time lapse.• Use cron to schedule a timelapse.

Page 4: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

What is the Raspberry Pi?

Description• Designed by Eben Upton with an emphasis

in computer programming.• Small computer, runs on Linux.• Very small power draw (1.21 Watts)• 40 GPIOs• 4 USB Ports• HDMI output• 3.5mm jack• Micro USB for power• Ethernet plug-in

Raspberry Pi

Page 5: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Plug it in!

Connections• Plug in the HDMI cable / Pi-View• Plug in the USB Devices • Keyboard• Mouse Wireless dongle

• Plug in the Ethernet cable.• Plug in the power (last)

Should Look a bit like this

Page 6: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

What you should see

What you are doing• We have modified SD cards that

have the Raspian Wheezy OS.• It will load the Raspian image

directly, and quickly.• This is the operating system for

the computer.• Login = pi• Password = raspberry

Look a little like this

Page 7: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Access the Graphical User Interface (GUI)

What you are doing• At the command line type

startx• This will start the graphical user

interface for the RPi.• Its like seeing the windows

desktop.

Look a little like this

Page 8: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Play Around in the GUI

Goals• Find the web browser• Open Scratch• Find the wireless configuration• Find the terminal

Page 9: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Play Around in the Terminal

Terminal CommandsCommand Effect

pwd Shows you the present working directory

mkdir name Makes a directory

cd name Changes the directory

cd .. Moves back one level in the directory

cd ~ Moves to the home directory

ls Lists the contents of the directory.

sudo Super User Do

Common Linux Commands

Page 10: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Make a Directory to Put Pictures In

Instructions• Command

cd ~mkdir camera

Reason• We will plug in the camera and

start taking pictures.• We will have to tell the camera

where those pictures should be stored.• We will want to access those

pictures from another computer.

Page 11: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

File management – Prepare to take pictures• You may want to set up a folder to store the pictures you are taking.

• If the goal is to take a picture and put it in file, that goes in to the command.

raspistill –o /home/pi/camera/picture.jpg

Command Effect Example

pwd Present working directory, where you currently are.

mkdir Make a new folder mkdir camera

cd Change directory cd camera

cd .. Return to previous directory cd ..

cd /home/pi/camera Go to a specific directory cd /home/pi/camera

ls List contents ls

Page 12: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Helpful Video for Plugging in the Camera

• Lift up the small black guide by the Ethernet port.• The small electrical contacts on

the ribbon face the end with the power cord.• Avoid any kind of static or

sparks.• Plug in, turn on the Rasberry Pi

after it is connected.

Page 13: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Configure the Camera

• You may need to configure the camera.

sudo raspi-config

Select Enable Camera and then Finish.

• You will be asked to reboot. Go ahead.

• This only needs to be done once.

• Camera Specs• 5 M Pixel• Video Mode – 1080p30, 720p60,

and 640x480p60/90• Full Frame SLR Lens Eq. – 35mm• Fixed Focus – 1m to infinity• F-Stop – 2.9• Focal length – 3.60mm• Can do up to 90 frames/second

Full Specs

Page 14: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Lets take a selfie.

• From the command line use this script

raspistill –o picture.jpg

• This tells the computer to use a program called raspistill and output (o) a file called picture.jpg• With the default settings this will

be a 2.4MB file.

Page 15: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Raspistill has a lot of customizable commandsEffect Command Default

Preview -p TRUE

No Preview -n FALSE

Sharpness -sh 0

Contrast -co 0

Brightness -br 0

Horizontal Flip -hf FALSE

Vertical Flip -vf FALSE

Shutter Speed -ss N/AUp to 6s

Sample commands• Flips the image• raspistill –vf -hf –o picture.jpg

• Increase the contrast• raspistill –co 50 –o picture.jpg

Complete list

Page 16: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Raspistill Image Effects

Effect Command

Negative -ifx negative

Solarise -ifx solarize

Sketch -ifx sketch

Oilpaint -ifx oilpaint

Watercolour -ifx watercolour

Film -ifx film

Try various image effects.

Save each image separately.

Save over individual images.

Complete list

Page 17: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

How to do time lapse photos

1. Make sure you have a folder you want to save everything to.2. Type the command

raspistill –o /home/pi/camera/picture%03d.jpg –tl 10000 –t 120000

Program Output destination and file name.

3 digit number to appear after camera (001, 002, 003, etc)

Time lapse in milliseconds between pictures

Total time in milliseconds for all pictures

Page 18: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

The End Product

Page 19: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Things to think about with time lapse projects• What is something that will change slowly but dramatically?• Seedlings• Crystals• Bacterial growth• Decay

• How often will you need to take pictures?• How much space will you need for those pictures?• What can I control?• Lights• Power

Page 20: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Camera Takes Video Too

Raspivid• The camera can also take video.• Use it to take slow motion video

with a high frame rate.• Up to 90 frames per second

depending on the resolution.

Video Made in my Lab

Page 21: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

How to do videos

1. Make sure you have a folder you want to save everything to.2. Type the command

Raspivid –w 640 –h 480 –fps 90 –t 20000 –o /home/pi/camera/movie.h264

ProgramWidth and height of the image

Length of video in milliseconds

Output locationFrame speed

Page 22: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Now lets get those pictures/files

On your Raspberry Pi• Determine the IP addresssudo ifconfig

On your preferred computer• Make sure you are on the same

network as the Raspberry Pi.• Download WinSCP• This is a program that will enable

File Transfer Protocol between your computer and the Pi.• Very user friendly interface.

Page 23: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Local computer on the left, remote computer (RPi) on the right.

Page 24: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Got a lot of photos, how do I make a time lapse movie?

Download Cineform – GoPro Studio Light, free video editing• Import all photos.• Since they are ordered

sequentially, they will be in time order.

• Go on to step 2, and step 3.• Export as a AVI or MP4 or…• Enjoy your movie!

Page 25: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Get clever

Use other things as lenses Dye them

Page 26: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Lots of ways to skin a cat.

Can I use Dropbox?• You can, and its pretty easy.

• Instructions

• Requirements• Dropbox account• Developer access

• Benefits• You can automatically upload files to

Dropbox.• You can have a Python program take

pictures and send them to Dropbox.• Check on your photos from anywhere.

Can I use a Python program• You can, and build it to your needs.• Instructions

• Requirements• A little programming experience, but

not much.

• Benefits• You can tell your computer to take

pictures in the way you want, when you want.

Page 27: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Potential Projects / Asks

• Make a Photobooth that will take a picture when a button is pushed, and email it to the user.• Example

• Take a picture of something at the same time everyday.• Start taking time lapse photos at the same time everyday and upload them to

Dropbox or a remote server at the end of the day.• Take video with the Raspberry Pi Camera

• Example

• Control the Raspberry Pi Camera from another computer.• Example

• Control the Raspberry Pi Camera from your phone.• Example

Page 28: Education 299: Raspberry Pi Training Mike Davis – Truman College 5/19/2015.

Assignment – Due Friday by Midnight• Come up with and document a Project for your camera.• More than taking a single picture.• Use the camera to show something changing, or happening quickly.• Use the settings on the camera to showcase something interesting.

• Describe how you completed your project.• Create a set of teacher notes for your project.• These will be shared with the STEM Community.