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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ben Nuttall
October 15, 2016
Programming
340
0
Share
Python Picamera with GPIO Zero
Picamera workshop given at Pi Towers Raspberry Jam, October 2016
Ben Nuttall
October 15, 2016
More Decks by Ben Nuttall
See All by Ben Nuttall
Numeronyms are obnoxious
bennuttall
0
470
Live Highlights in BBC iPlayer
bennuttall
0
150
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
210
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
150
Running a Python Package Index for Raspberry Pi
bennuttall
0
180
From Acorns to Raspberries
bennuttall
0
160
Innovation in the newsroom
bennuttall
0
210
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
230
How to market your open source project
bennuttall
0
270
Other Decks in Programming
See All in Programming
実践CRDT
tamadeveloper
0
570
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
220
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
380
의존성 주입과 모듈화
fornewid
0
140
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
5k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
140
Vibe NLP for Applied NLP
inesmontani
PRO
0
440
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
580
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
23
13k
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
350
実用!Hono RPC2026
yodaka
2
230
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
250
Featured
See All Featured
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
100
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
180
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Ethics towards AI in product and experience design
skipperchong
2
260
Building Adaptive Systems
keathley
44
3k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
260
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
720
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
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