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
490
Live Highlights in BBC iPlayer
bennuttall
0
160
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
220
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
160
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
Oxcを導入して開発体験が向上した話
yug1224
4
270
Modding RubyKaigi for Myself
yui_knk
0
850
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
7
1.3k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
180
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
130
AIエージェントの隔離技術の徹底比較
kawayu
0
450
OSもどきOS
arkw
0
380
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
450
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
5.1k
開発体験を左右するライブラリの API 設計 - GraphQL スキーマ構築ライブラリから考える #tskaigi
izumin5210
2
1.5k
ふつうのFeature Flag実践入門
irof
7
3.4k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
0
110
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
9
930
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
540
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The Limits of Empathy - UXLibs8
cassininazir
1
340
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
200
Bash Introduction
62gerente
615
210k
The untapped power of vector embeddings
frankvandijk
2
1.7k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
190
The agentic SEO stack - context over prompts
schlessera
0
790
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
340
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