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
370
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
1
590
Live Highlights in BBC iPlayer
bennuttall
0
170
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
240
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
170
Running a Python Package Index for Raspberry Pi
bennuttall
0
210
From Acorns to Raspberries
bennuttall
0
170
Innovation in the newsroom
bennuttall
0
230
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
260
How to market your open source project
bennuttall
0
300
Other Decks in Programming
See All in Programming
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
540
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.8k
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
580
Built Our Own Background Agent at LayerX
layerx
PRO
10
5.8k
今さら聞けない .NET CLI
htkym
0
200
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
110
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
210
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
150
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
120
バグを直したら useEffect が消えた
colorful12
3
650
プロポーザルを書いてもらう
pvcresin
0
560
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.7k
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
270
Typedesign – Prime Four
hannesfritz
42
3.1k
Statistics for Hackers
jakevdp
799
230k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
470
The Language of Interfaces
destraynor
162
27k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
460
GitHub's CSS Performance
jonrohan
1033
470k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
First, design no harm
axbom
PRO
2
1.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
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