Difference between revisions of "Raspberry Pi - Week 4"
From Robert-Depot
(→Video Playback) |
(→using GPIO with python) |
||
(19 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
**omxplayer comes pre-installed on our raspbian distribution. | **omxplayer comes pre-installed on our raspbian distribution. | ||
*Try it out. | *Try it out. | ||
− | *Copy a movie file to your raspberry pi using scp. The movie needs to be mp4 format. | + | *Copy a movie file to your raspberry pi using scp. The movie needs to be .mp4 format. |
**you can transcode with ffmpeg: | **you can transcode with ffmpeg: | ||
**<code>ffmpeg -i mouse_brain.wmv mouse_brain.mp4</code> | **<code>ffmpeg -i mouse_brain.wmv mouse_brain.mp4</code> | ||
*run omxplayer: | *run omxplayer: | ||
− | **<code>omxplayer ~/Movies/mouse_brain.mp4<code> | + | **<code>omxplayer ~/Movies/mouse_brain.mp4</code> |
*You can control playback with a number of hotkeys: | *You can control playback with a number of hotkeys: | ||
**http://elinux.org/Omxplayer#Hotkeys | **http://elinux.org/Omxplayer#Hotkeys | ||
**Try these, and notice the responsiveness of the system. Is there any noticable delay? | **Try these, and notice the responsiveness of the system. Is there any noticable delay? | ||
− | |||
− | |||
===ffmpeg=== | ===ffmpeg=== | ||
− | *install homebrew | + | *Install this on your computer, not the raspberry pi. |
− | *<code>brew install ffmpeg</code> | + | **install homebrew |
+ | **<code>brew install ffmpeg</code> | ||
+ | *using ffmpeg to transcode a video file: | ||
+ | **<code>ffmpeg -i ~/Movies/dogkiss.mov dogkiss.mp4</code> | ||
== Scripting Video Playback == | == Scripting Video Playback == | ||
+ | [http://wiki.roberttwomey.com/images/a/ad/Video_loop.tar video_loop.tar] | ||
+ | *We can send the hotkey controls via STDIN in python: | ||
+ | **http://stackoverflow.com/questions/12755968/sending-arrow-keys-to-popen | ||
+ | *shell script to play a directory of files. (good at corporate conventions) | ||
+ | **http://www.cenolan.com/2013/03/looping-video-playlist-omxplayer-raspberry-pi/ | ||
+ | |||
== GPIO == | == GPIO == | ||
+ | *What are the pins? | ||
+ | **http://elinux.org/RPi_Low-level_peripherals | ||
+ | *Handy printable reference | ||
+ | **Raspberry Leaf - http://www.doctormonk.com/2013/02/raspberry-pi-and-breadboard-raspberry.html | ||
+ | *Other headers, not yet populated | ||
+ | **P5, etc... | ||
+ | ===Note on voltage Levels=== | ||
+ | *RPi is 3.3V. | ||
*pin over-voltage protection circuits - http://elinux.org/RPi_Tutorial_EGHS:GPIO_Protection_Circuits | *pin over-voltage protection circuits - http://elinux.org/RPi_Tutorial_EGHS:GPIO_Protection_Circuits | ||
− | * | + | ==Tutorials== |
− | * | + | *Single LED-https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/ |
− | + | *GPIO examples-https://projects.drogon.net/raspberry-pi/gpio-examples/ | |
− | + | *LCD interface https://projects.drogon.net/raspberry-pi/gpio-examples/lcd-interface/ | |
− | * | + | |
− | + | ===using GPIO with python=== | |
− | |||
− | |||
*https://code.google.com/p/raspberry-gpio-python/ | *https://code.google.com/p/raspberry-gpio-python/ | ||
− | + | **<code>sudo apt-get update</code> | |
− | * | + | **<code>sudo apt-get install python-dev</code> |
+ | **<code>sudo apt-get install python-rpi.gpio</code> | ||
+ | *Examples - https://code.google.com/p/raspberry-gpio-python/wiki/Examples | ||
+ | **Basic Usage | ||
+ | **Inputs | ||
+ | **Outputs | ||
+ | **PWM | ||
+ | *adafruit - http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/overview |
Latest revision as of 16:09, 26 April 2013
Contents
[hide]Review
- Installed software with apt-get. (including festival).
- Installed and ran VNC to get a remote desktop on the machine.
- Ran a simple python script to synthesize speech ( example)
- Another python tutorial: Learn Python the Hard Way
Video Playback
- Omxplayer is a video player specifically made for the Raspberry PI's GPU made by Edgar (gimli) Hucek from the XBMC project.
- omxplayer comes pre-installed on our raspbian distribution.
- Try it out.
- Copy a movie file to your raspberry pi using scp. The movie needs to be .mp4 format.
- you can transcode with ffmpeg:
ffmpeg -i mouse_brain.wmv mouse_brain.mp4
- run omxplayer:
omxplayer ~/Movies/mouse_brain.mp4
- You can control playback with a number of hotkeys:
- http://elinux.org/Omxplayer#Hotkeys
- Try these, and notice the responsiveness of the system. Is there any noticable delay?
ffmpeg
- Install this on your computer, not the raspberry pi.
- install homebrew
brew install ffmpeg
- using ffmpeg to transcode a video file:
ffmpeg -i ~/Movies/dogkiss.mov dogkiss.mp4
Scripting Video Playback
- We can send the hotkey controls via STDIN in python:
- shell script to play a directory of files. (good at corporate conventions)
GPIO
- What are the pins?
- Handy printable reference
- Other headers, not yet populated
- P5, etc...
Note on voltage Levels
- RPi is 3.3V.
- pin over-voltage protection circuits - http://elinux.org/RPi_Tutorial_EGHS:GPIO_Protection_Circuits
Tutorials
- Single LED-https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/
- GPIO examples-https://projects.drogon.net/raspberry-pi/gpio-examples/
- LCD interface https://projects.drogon.net/raspberry-pi/gpio-examples/lcd-interface/
using GPIO with python
- https://code.google.com/p/raspberry-gpio-python/
sudo apt-get update
sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio
- Examples - https://code.google.com/p/raspberry-gpio-python/wiki/Examples
- Basic Usage
- Inputs
- Outputs
- PWM
- adafruit - http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/overview