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
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
More Decks by Ben Nuttall
See All by Ben Nuttall
Numeronyms are obnoxious
bennuttall
0
500
Live Highlights in BBC iPlayer
bennuttall
0
160
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
230
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
160
Running a Python Package Index for Raspberry Pi
bennuttall
0
190
From Acorns to Raspberries
bennuttall
0
170
Innovation in the newsroom
bennuttall
0
220
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
240
How to market your open source project
bennuttall
0
280
Other Decks in Programming
See All in Programming
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.4k
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
350
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
160
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
550
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
350k
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.7k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
120
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
270
OSもどきOS
arkw
0
580
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.3k
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
190
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
22k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
The Cost Of JavaScript in 2023
addyosmani
55
10k
WENDY [Excerpt]
tessaabrams
11
38k
Practical Orchestrator
shlominoach
191
11k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
440
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
The Pragmatic Product Professional
lauravandoore
37
7.3k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
240
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
370
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
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