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
350
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
480
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
アクセシビリティ試験の"その後"を仕組み化する
yuuumiravy
1
200
Programming with a DJ Controller — not vibe coding
m_seki
3
830
実践ハーネスエンジニアリング:ステアリングループを実例から読み解く / Practical Harness Engineering: Understanding Steering Loops Through Real-World Examples
nrslib
5
5.2k
なぜあなたのコードには「コシ」がないのか?〜AI時代に問う、最後まで美味しい設計と戦略〜 #phpconkagawa / phpconkagawa2026
shogogg
0
160
Firefoxにコントリビューションして得られた学び
ken7253
2
160
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
130
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
380
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
190
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
23
12k
Kingdom of the Machine
yui_knk
2
1.5k
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
150
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
340
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
4 Signs Your Business is Dying
shpigford
187
22k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
550
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Bash Introduction
62gerente
615
210k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
120
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
400
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
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