Cov txheej txheem:
- Kauj ruam 1: Yam Koj Yuav Tsum Tau
- Kauj Ruam 2: Txuas Lub Koob Yees Duab Module
- Kauj Ruam 3: Teeb Lub Koob Yees Duab
- Kauj Ruam 4: Kuaj Lub Koob Yees Duab Module
- Kauj Ruam 5: Tsim Circuit Court Nrog Code
Video: Raspberry Pi Photobooth: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Lub Hom Phiaj:
- Kawm paub yuav ua li cas thiab teeb tsa Pi Camera
- Siv txhais thiab yog nqe lus hauv coding
- Kawm paub siv thev naus laus zis tshiab xws li RGB LEDs
Kauj ruam 1: Yam Koj Yuav Tsum Tau
- 1 Raspberry Pi 3
- Cov qhob cij
- Cov neeg dhia
- 1 Lub Teeb Ntsuas Tus Kws Tiv Thaiv
- 1 Capacitor
- 1 Laub Khawm
- 6 220 Ohm Resistors
- 2 RGB LEDs
- 1 Raspberry Pi Lub Koob Yees Duab
Kauj Ruam 2: Txuas Lub Koob Yees Duab Module
Ua ntej tshaj plaws, nrog Pi tua tawm, koj yuav tsum txuas lub Koob Yees Duab Module mus rau Raspberry Pi lub koob yees duab chaw nres nkoj, tom qab ntawd pib Pi thiab xyuas kom lub software tau qhib.
- Nrhiav lub koob yees duab chaw nres nkoj uas nyob nruab nrab ntawm HDMI thiab 3.5mm chaw nres nkoj
- Rub lub koob yees duab los ntawm cov yas yas kom txog thaum qhov clip yog kab pheeb ces kaum
- Tam sim no ntxig lub koob yees duab cable nrog lub ntsej muag xiav tig mus rau 3.5mm chaw nres nkoj
Kauj Ruam 3: Teeb Lub Koob Yees Duab
Qhib lub Raspberry Pi Kev teeb tsa lub cuab yeej los ntawm cov ntawv qhia zaub mov tseem ceeb thiab ua haujlwm tsis tau thiab pab kom txhua qhov cuam tshuam saum toj no
Los ntawm Cov ntawv qhia zaub mov tseem ceeb qhib lub Terminal thiab ntaus cov kab hauv qab no:
Sudo Raspi-teeb tsa
Tam sim no los ntawm no siv koj cov xub tuav los ua haujlwm los ntawm lub kaw lus thiab nyem rau ntawm qhov kev xaiv Txuas Txuas Txuas thiab los ntawm lawv nyem rau ntawm P1 Lub Koob Yees Duab thiab qhib lub koob yees duab, tom qab ntawd xaiv qhov ua tiav. Rov qab mus rau hom davhlau ya nyob twg hauv kab hauv qab no ntawm cov cai:
pip nruab picamera
lossis Sudo pip nruab Picamera
Kauj Ruam 4: Kuaj Lub Koob Yees Duab Module
Los ntawm no peb tuaj yeem sim yog lub koob yees duab ua haujlwm lossis tsis yog vim peb muaj tag nrho cov software thiab kho vajtse qhib.
Qhib Python 3 los ntawm cov ntawv qhia zaub mov
Los ntawm qhov ntawd qhib cov ntawv tshiab los ntawm lub plhaub thiab txuag nws cameratest.py.
Sau cov cai hauv qab no:
los ntawm picamera ntshuam PiCamera #imported module tsim los ntawm pip nruab pi lub koob yees duab hais kom ua los ntawm lub sijhawm ntshuam pw tsaug zog #imported pw tsaug zog txhawm rau kom paub tseeb tias peb lub koob yees duab nyob ntawm lub koob yees duab = PiCamera () #Setup rau lub koob yees duab
camera.start_preview ()#pib lub koob yees duab thiab qhia koj tias lub koob yees duab tso tawm zoo li cas
pw tsaug zog (10)#tawm qhov kev saib ua ntej rau 10 vib nas this
camera.stop_preview ()#thaum kawg tawm qhov kev saib ua ntej
Khiav cov cai los ntawm F5
Yog tias koj tau txais qhov yuam kev no thaum khiav cov cai:
(mmal: mmal_vc_component_create: ua tsis tiav los tsim cov khoom 'vc.ril.camera' (1: ENOMEM)
mmal: mmal_component_create_core: tsis tuaj yeem tsim cov khoom 'vc.ril.camera' (1) Traceback (hu xov tooj tsis ntev los no): Cov ntaub ntawv "", kab 1, hauv Cov Ntaub Ntawv "/usr/lib/python2.7/dist-packages/picamera /camera.py ", kab 257, hauv _init_ self._init_camera () Cov ntaub ntawv" /usr/lib/python2.7/dist-packages/picamera/camera.py ", kab 288, hauv _init_camera prefix =" Ua tsis tau zoo los tsim lub koob yees duab tivthaiv ") Cov ntaub ntawv" /usr/lib/python2.7/dist-packages/picamera/exc.py ", kab 112, hauv mmal_check tsa PiCameraMMALError (xwm txheej, ua ntej) picamera.exc. PiCameraMMALError: Ua tsis tau los tsim lub koob yees duab tivthaiv: Tawm nco)
Thov mus rau Raspberry Pi teeb tsa mus rau hauv kab lus ua tau zoo thiab txhawb koj li GPU nco kom txog thaum qhov yuam kev ploj mus (yuav tsum rov pib dua).
Tam sim no txhawm rau tsim cov duab uas yuav txuag rau lub desktop peb yuav siv cov cai hauv qab no:
los ntawm picamera ntshuam PiCamera #Imported module tsim los ntawm pip nruab pi lub koob yees duab hais kom ua los ntawm lub sijhawm ntshuam pw tsaug zog #Imported pw tsaug zog kom ntseeg tau tias peb lub koob yees duab nyob twj ywm
lub koob yees duab = PiCamera () #Setup rau lub koob yees duab
lub koob yees duab.start_preview () #Pib qhov pom ua ntej pw tsaug zog (5) #Lau qhov kev saib ua ntej rau 5 vib nas this
camera.capture ('/home/pi/Desktop/image.jpg')# Los ntawm
camera.stop_preview ()#Nres Qhov Saib Ua Ntej
Kauj Ruam 5: Tsim Circuit Court Nrog Code
Raws li pom saum toj no los ntawm daim duab qhia chaw peb yuav tsum teeb lub pob, LDR, thiab thaum kawg ob lub RGB LEDs. Ua ntej peb yuav teeb tsa lub pob ntawm sab laug sab laug ntawm lub khob cij. Thaum koj teeb tsa lub pob peb yuav siv cov kab tsheb ciav hlau sib txuas lub ntsiab lus uas peb yuav txuas rau peb 3.3V ntawm qhov zoo thiab hauv av rau qhov tsis zoo. Tom qab koj tau ua tiav kev teeb tsa Circuit rau khawm nkaus xwb.
Peb yuav sim peb qhov Circuit kom pom tias peb tuaj yeem ua tau li ntawd yog tias lub pob raug nias peb tig cov coj los siv cov cai hauv qab no:
#Imported Modules los ntawm gpiozero ntshuam khawm los ntawm picamera ntshuam PiCamera los ntawm lub sijhawm ntshuam pw
#Teeb tsa
Lub koob yees duab = PiCamera () Khawm = Khawm (22)
#Kev yees duab ua haujlwm, Kuv tau txiav txim siab muab nws tso rau hauv kev txhais ua haujlwm vim nws pab peb ntxuav cov cai tseem ceeb
def photocap (): cov
Camera.start_preview ()
pw tsaug zog (5) Camera.capture ('/home/pi/Desktop/image.jpg') print ("Photo was taken") Camera.stop_preview ()
#Main chaws:
thaum muaj tseeb: yog tias Button.is_pressed: print ("Nias lub khawm") photocap ()
#Vim li cas qhov no thiaj li ua haujlwm: Tus lej tseem ceeb ua haujlwm zoo li txhua yam peb tab tom ua yog siv cov lus txib yog tias khawm.is_pressed nyob rau lub sijhawm muaj tseeb nqe lus yog li nws tau hloov kho tas li thaum lub pob raug nias kom thaij duab
Tam sim no peb tab tom teeb tsa 2 RGB LEDs txhua txoj kev mus txog rau sab saum toj ntawm lub Circuit Court thiab cais lawv nyob nruab nrab ntawm lub khob cij thiab ua kom sib npaug. Yog tias koj tsis muaj 220 ohm resistors rau txoj haujlwm no koj tuaj yeem teeb tsa lawv ua ke nyob ntawm koj qhov kev tiv thaiv rau cov resistors koj muaj. Tus lej thib ob ntawm 4 tus pin RGB LED (qhov ntev tshaj yuav tsum txuas nrog hauv av hla txoj kev tsheb nqaj hlau. Lwm tus pin yuav tsum txhua tus txuas nrog lawv tus kheej GPIO pins. (Thawj tus pin = liab, Tus lej thib ob = hauv av, Tus Pin thib peb = ntsuab) Plaub, tus pin = xiav).
Peb yuav sim ib qho ntawm peb cov RGB LEDs hauv peb lub pob khawm nrog cov cai hauv qab no:
#Imported Modules los ntawm gpiozero ntshuam khawm los ntawm picamera ntshuam PiCamera
los ntawm gpiozero ntshuam RGBLED
los ntawm lub sijhawm ntshuam pw
#Teeb tsa
Lub koob yees duab = PiCamera () Khawm = Khawm (22)
TimedLED = RGBLED (liab = 21, ntsuab = 20, xiav = 16)
#Cov duab ua haujlwm nrog RGB LED, Kuv tau txiav txim siab muab nws tso rau hauv kev txhais ua haujlwm vim nws pab peb ntxuav cov cai tseem ceeb
def photocap (): Camera.start_preview () tsaug zog (4)
timedled.color (1, 0, 0)
tsaug zog (2)
timedled.color (0, 1, 0)
tsaug zog (1)
Camera.capture ('/home/pi/Desktop/image.jpg') print ("Photo was taken") Camera.stop_preview ()
#Main chaws:
thaum Muaj Tseeb:
yog Button.is_pressed:
print ("Nias lub khawm") photocap ()
#Vim li cas qhov no ua haujlwm: Qhov laj thawj vim li cas txoj cai no ua haujlwm yog vim tam sim no peb tau txais RGBLED los ua haujlwm raws li lub sijhawm rau thaum cov duab yuav raug coj mus.
Tam sim no teeb tsa Lub Teeb Dependent resistor nyob rau sab qis ntawm sab ntawm lub khob cij siv daim duab qhia txhua txoj hauv kev mus rau saum thiab cov kev tsheb ciav hlau sib tham ua ntej. Nco qab ob qho ntawm ob txhais ceg ntev ntawm LDR thiab tus kws tshaj lij yuav tsum txuas nrog GPIO tus pin.
Tom qab peb tau txuas nrog LDR peb yuav siv cov cai hauv qab no:
#Imported Cov Qauv
los ntawm gpiozero ntshuam khawm
los ntawm picamera ntshuam PiCamera los ntawm gpiozero ntshuam RGBLED
los ntawm gpiozero ntshuam LightSensor
los ntawm lub sijhawm ntshuam pw
#Teeb tsa
Lub koob yees duab = PiCamera () Khawm = Khawm (22) TimedLED = RGBLED (liab = 21, ntsuab = 20, xiav = 16)
LightSensor = LightSensor (23)
#Cov duab ua haujlwm nrog RGB LED, Kuv tau txiav txim siab muab nws tso rau hauv kev txhais ua haujlwm vim nws pab peb ntxuav cov cai tseem ceeb
def photocap (): Camera.start_preview () pw (4) timedled.color (1, 0, 0) pw (2) timedled.color (0, 1, 0) pw (1) Camera.capture ('/home/ pi/Desktop/image-j.webp
#Main chaws:
thaum Muaj Tseeb:
yog tias Button.is_pressed: luam tawm ("Khawm tau nias") photocap ()
yog Button.is_pressed thiab Lightsensor.when_dark:
print ("Button was Pressed")
print ("Nws tsaus ntuj")
photocap ()
#Vim li cas qhov no thiaj li ua haujlwm: Txoj kev uas kuv tau ntxiv Lub Teeb pom kev zoo rau kuv tus lej yog dhau los ntawm lwm qhov yog cov lus hais uas muaj qhov ua haujlwm txawv teb chaws ntawm lub teeb pom kev zoo. Thaum tsaus ntuj teeb tsa peb zoo rau peb cov kauj ruam tom ntej
Tam sim no cov kauj ruam kawg dhau los ntawm txoj haujlwm no yuav yog txhawm rau qhib lwm qhov RGBLED sib npaug rau lwm tus los ua haujlwm li lub teeb nyem, Txoj cai kawg:
los ntawm gpiozero ntshuam khawm
los ntawm picamera ntshuam PiCamera
los ntawm gpiozero ntshuam RGBLED
los ntawm gpiozero ntshuam LightSensor
los ntawm lub sijhawm ntshuam pw
#Teeb tsa
Lub koob yees duab = PiCamera ()
Khawm = Khawm (22)
TimedLED = RGBLED (liab = 21, ntsuab = 20, xiav = 16)
FlashLED = RGBLED (liab = 19, ntsuab = 13, xiav = 6)
LightSensor = LightSensor (23)
#Photo ua haujlwm nrog RGB LED, Kuv tau txiav txim siab muab nws tso rau hauv kev txhais ua haujlwm vim nws pab peb ntxuav cov cai tseem ceeb def photocap (): Camera.start_preview () pw (4) timedled.color (1, 0, 0) pw (2) timedled.color (0, 1, 0) pw (1) Camera.capture ('/home/pi/Desktop/image.jpg') print ("Photo was taken") Camera.stop_preview () # Cov cai loj: thaum Tseeb: yog Button.is_pressed:
print ("Nias lub khawm")
photocap ()
yog Button.is_pressed thiab Lightsensor.when_dark:
print ("Button was Pressed") print ("Nws tsaus ntuj")
FlashLED.color (1, 1, 1)
photocap ()
#Vim li cas qhov no thiaj li ua haujlwm: Txoj kev uas kuv tau ntxiv kuv lub teeb nyem yog los ntawm kev siv RGB coj los tso tawm cov xim dawb uas yog 1, 1, 1 thiab nws tsuas yog ua yog tias yog cov lus yog qhov tseeb.
Pom zoo:
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
Raspberry Pi PhotoBooth: HTML5 & NodeJS: 4 Cov Kauj Ruam
Raspberry Pi PhotoBooth: HTML5 & NodeJS: Ib qho HTML5 thiab NodeJS photobooth nrog kev saib ua ntej thiab kev cai ciam teb no. Kuv xav tau qee yam lom zem rau nws thiab nws cov phooj ywg kom nco txog qhov xwm txheej (uas yog zaum kawg lawv yuav
Kab tshoob / Kev tshwm sim Photobooth: 6 Kauj Ruam (nrog Duab)
Kab tshoob / Kev tshwm sim Photobooth: Nyob zoo txhua tus, Kuv tau sib yuav xyoo tas los, thaum peb tab tom nrhiav kev npaj D-hnub, peb tau mus rau ntau lub rooj sib tham kab tshoob kev kos. Ntawm txhua lub rooj sib tham muaj Photobooth tus tswv tsev, Kuv xav tias lub rooj sib tham photobooth yog qhov zoo tshaj plaws rau kev ua tshoob, txhua tus qhua c
Automated Photobooth: 4 Kauj Ruam (nrog Duab)
Automated Photobooth: Qhov no yuav qhia koj yuav ua li cas thiaj ua lub rooj muag khoom yees duab siv lub raspberry pi, lub ntsuas hluav taws xob nrug deb deb, thiab ob peb lwm yam khoom siv ntxiv. Kuv xav ua ib qhov haujlwm uas siv ob yam khoom siv khoos phis tawj thiab ib txoj haujlwm uas siv tau zoo. Kuv tshawb nrhiav
DIY Photobooth: 7 Kauj Ruam (nrog Duab)
DIY Photobooth: Nov yog kev qhia yuav ua li cas tsim koj tus kheej photobooth zoo ib yam li ib txwm pom ntawm cov khw, chaw ua si lom zem, thiab chaw yuav khoom thoob ntiaj teb. Lub rooj muag khoom no txawm li cas los xij yog digital thiab yog qhov pheej yig dua/yooj yim dua ua hauv tsev. Kuv wr