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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
460
Live Highlights in BBC iPlayer
bennuttall
0
140
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
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
620
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
240
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
170
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1.2k
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
260
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
180
ロボットのための工場に灯りは要らない
watany
12
3.2k
AI活用のコスパを最大化する方法
ochtum
0
340
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
180
How to stabilize UI tests using XCTest
akkeylab
0
140
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
0
280
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
310
Leo the Paperboy
mayatellez
4
1.6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
160
The browser strikes back
jonoalderson
0
850
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
150
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
220
Measuring & Analyzing Core Web Vitals
bluesmoon
9
790
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Darren the Foodie - Storyboard
khoart
PRO
3
3k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
600
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