Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Python Picamera with GPIO Zero
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ben Nuttall
October 15, 2016
Programming
390
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Python Picamera with GPIO Zero
Picamera workshop given at Pi Towers Raspberry Jam, October 2016
Ben Nuttall
October 15, 2016
Transcript
16 slides
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
More Decks by Ben Nuttall
See All by Ben Nuttall
Numeronyms are obnoxious
bennuttall
1
790
Live Highlights in BBC iPlayer
bennuttall
0
200
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
260
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
200
Running a Python Package Index for Raspberry Pi
bennuttall
0
230
From Acorns to Raspberries
bennuttall
0
190
Innovation in the newsroom
bennuttall
0
250
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
270
How to market your open source project
bennuttall
0
310
Other Decks in Programming
See All in Programming
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
200
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
750
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
380
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
670
Crash Auto Pipelines
veronikapj
1
440
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
260
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
390
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
640
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
190
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
690
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
610
オーケストレーション記述言語 Katari
yukikurage
0
270
Featured
See All Featured
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
780
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Visualization
eitanlees
153
17k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
350
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
490
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
580
4 Signs Your Business is Dying
shpigford
187
23k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
600
Agile that works and the tools we love
rasmusluckow
331
22k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
980
HDC tutorial
michielstock
2
1k