Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Python Picamera with GPIO Zero
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ben Nuttall
October 15, 2016
Programming
0
330
Python Picamera with GPIO Zero
Picamera workshop given at Pi Towers Raspberry Jam, October 2016
Ben Nuttall
October 15, 2016
Tweet
Share
More Decks by Ben Nuttall
See All by Ben Nuttall
Numeronyms are obnoxious
bennuttall
0
450
Live Highlights in BBC iPlayer
bennuttall
0
130
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
200
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
140
Running a Python Package Index for Raspberry Pi
bennuttall
0
170
From Acorns to Raspberries
bennuttall
0
150
Innovation in the newsroom
bennuttall
0
200
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
220
How to market your open source project
bennuttall
0
260
Other Decks in Programming
See All in Programming
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
4
370
CopilotKit + AG-UIを学ぶ
nearme_tech
PRO
1
120
15年目のiOSアプリを1から作り直す技術
teakun
1
590
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
190
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
150
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
220
AI活用のコスパを最大化する方法
ochtum
0
120
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
510
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
2
140
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
0
110
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.1k
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
670
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
850
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
190
Building Adaptive Systems
keathley
44
2.9k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
80
Making the Leap to Tech Lead
cromwellryan
135
9.7k
How to train your dragon (web standard)
notwaldorf
97
6.5k
How GitHub (no longer) Works
holman
316
140k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Are puppies a ranking factor?
jonoalderson
1
3.1k
Transcript
Python Picamera with GPIO Zero Introducing the camera board and
Python module
Raspberry Pi camera module - 5Mpx / 8Mpx - Full
HD - Photo & video - Command line - Python module - Infra-red camera
Connect the camera
Add a GPIO Button
Boot the Pi and open Python 3
IDLE Python Shell >>> from picamera import PiCamera >>> from
gpiozero import Button >>> camera = PiCamera() >>> button = Button(17) >>> button.when_pressed = camera.start_preview >>> button.when_released = camera.stop_preview
Open a new file • File > New File •
File > Save • Save as camera.py
Take a selfie from picamera import PiCamera from time import
sleep camera = PiCamera() camera.start_preview() sleep(3) camera.capture("/home/pi/image.jpg") camera.stop_preview() Save and run: Ctrl + S F5
Add GPIO Button code from picamera import PiCamera from gpiozero
import Button from time import sleep camera = PiCamera() button = Button(17) camera.start_preview() button.wait_for_press() sleep(3) camera.capture("/home/pi/button.jpg") camera.stop_preview()
Add a loop camera.start_preview() for i in range(5): button.wait_for_press() sleep(3)
camera.capture("/home/pi/button%s.jpg" % i) camera.stop_preview()
Picamera effects
Picamera effects camera.start_preview() button.wait_for_press() camera.image_effect = 'negative' sleep(5) camera.capture("/home/pi/negative.jpg") camera.stop_preview()
Try more effects: - negative - colorswap - sketch - emboss
Picamera effects import random camera.start_preview() for i in range(5): button.wait_for_press()
effect = random.choice(list(camera.IMAGE_EFFECTS)) camera.image_effect = effect camera.annotate_text = effect sleep(5) camera.capture("/home/pi/%s.jpg" % effect) camera.stop_preview() Try more effects: - negative - colorswap - sketch - emboss
Documentation and help guides • picamera.readthedocs.io • gpiozero.readthedocs.io • raspberrypi.org/resources
• raspberrypi.org/education/downloads
What next? • Time-lapse • Stop motion animation • Wildlife
camera
What next? • Sensor trigger • Send to social media
• Robotics