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
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
440
Live Highlights in BBC iPlayer
bennuttall
0
130
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
190
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
130
Running a Python Package Index for Raspberry Pi
bennuttall
0
160
From Acorns to Raspberries
bennuttall
0
140
Innovation in the newsroom
bennuttall
0
190
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
210
How to market your open source project
bennuttall
0
260
Other Decks in Programming
See All in Programming
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
990
「ブロックテーマでは再現できない」は本当か?
inc2734
0
700
MUSUBIXとは
nahisaho
0
130
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
250
ThorVG Viewer In VS Code
nors
0
770
Fluid Templating in TYPO3 14
s2b
0
130
CSC307 Lecture 05
javiergs
PRO
0
500
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
組織で育むオブザーバビリティ
ryota_hnk
0
170
2026年 エンジニアリング自己学習法
yumechi
0
130
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
150
Data-Centric Kaggle
isax1015
2
760
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
680
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
100
We Have a Design System, Now What?
morganepeng
54
8k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
57
50k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
117
110k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
64
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
300
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
300
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
A designer walks into a library…
pauljervisheath
210
24k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
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