Cov txheej txheem:

RaspberryPi 3 Magnet Sensor Nrog Mini Reed Sensor: 6 Cov Kauj Ruam
RaspberryPi 3 Magnet Sensor Nrog Mini Reed Sensor: 6 Cov Kauj Ruam

Video: RaspberryPi 3 Magnet Sensor Nrog Mini Reed Sensor: 6 Cov Kauj Ruam

Video: RaspberryPi 3 Magnet Sensor Nrog Mini Reed Sensor: 6 Cov Kauj Ruam
Video: Arduino Basics: How to use magnetic Sensors, Reed Switch vs Hall Sensor 2024, Hlis ntuj nqeg
Anonim
RaspberryPi 3 Magnet Sensor Nrog Mini Reed Sensor
RaspberryPi 3 Magnet Sensor Nrog Mini Reed Sensor

Hauv Cov Lus Qhia no, peb yuav tsim lub IoT magnet sensor siv RaspberryPi 3.

Lub ntsuas hluav taws xob suav nrog LED thiab lub suab nrov, ob qho tib si tig thaum lub hlau nplaum tau hnov los ntawm lub ntsuas me me.

Kauj Ruam 1: Sau cov khoom siv

Sau Cov Khoom Siv
Sau Cov Khoom Siv
Sau Cov Khoom Siv
Sau Cov Khoom Siv

Txhawm rau pib, nco ntsoov tias koj muaj tag nrho cov khoom siv tsim nyog. Koj yuav xav tau:

  • Ib qho RaspberryPi 3
  • Ib T Cobbler
  • Ib qho Breadboard
  • Ib Ribbon Txuas
  • Lub Mini Reed Sensor
  • Ib LED
  • Ib Buzzer
  • Cov Khoom Sib Txuas (suav nrog qee qhov nrog tsawg kawg ib tus poj niam kawg)

Kauj ruam 2: Txuas Pi thiab Breadboard

Txuas Pi thiab Breadboard
Txuas Pi thiab Breadboard

Tom ntej no, koj yuav txuas RaspberryPi thiab Breadboard. Txhawm rau ua qhov no, koj yuav tso ib kawg ntawm txoj hlua txuas rau hauv T Cobbler, thiab lwm qhov hla tus pin ntawm RaspberryPi. Tom qab ntawd muab tus T Cobbler tso rau hauv lub khob cij.

Kauj Ruam 3: Hlau Mini Reed Sensor

Hlau Mini Reed Sensor
Hlau Mini Reed Sensor
Hlau Mini Reed Sensor
Hlau Mini Reed Sensor

Tam sim no, xaim lub mini reed sensor. Koj yuav xav siv xov hlau nrog tus poj niam kawg kom ua tiav qhov no, vim lub ntsuas cua muaj txiv neej tus pin. Los ntawm sab laug mus rau sab xis, lub cim ntsuas tus pin tau tso tawm, lub zog, thiab hauv av.

Hlau tus pin tso tawm rau T Cobbler GPIO24, lub zog rau ib qho 5V T Cobbler tus pin, thiab hauv av rau ib qho GND T Cobbler tus pin.

Kauj Ruam 4: Hlau LED

Hlau LED
Hlau LED
Hlau LED
Hlau LED

LED tuaj yeem ua rau me ntsis yog tias koj tsis paub nws! LED nws tus kheej muaj qhov kawg ntev thiab qhov luv luv. Qhov ntev kawg yuav tsum txuas nrog GPIO26 los ntawm 330k ohm resistor, thiab qhov luv luv txuas ncaj qha mus rau hauv av, raws li qhia saum toj no. Koj tuaj yeem xaiv siv xov hlau txuas ntxiv kom ntseeg tau tias txhua yam nyob zoo thiab zoo!

Kauj Ruam 5: Hlau Buzzer

Hlau Buzzer
Hlau Buzzer
Hlau Buzzer
Hlau Buzzer

Koj yuav pom tias koj lub suab nrov muaj ob qho + thiab a - cim nyob hauv qab. + Qhia tias tus pin buzzer yuav tsum txuas nrog lub zog, thiab - qhia tus pin uas yuav tsum txuas nrog hauv av.

Txuas tus + tus pin rau GPIO25, thiab tus pin rau GND. Kuv xaiv siv tib txoj hauv kev kuv xaim kuv LED rau GND ntawm, tab sis koj tsis tas yuav ua qhov no!

Kauj ruam 6: Khiav Ib co Code

Khiav Ib co Code!
Khiav Ib co Code!

Tus nab npawb nab npawb muab rau ntawm no sau peb cov cuab yeej raws nraim qhov peb xav kom nws ua; thaum lub mini reed sensor pom cov hlau nplaum, LED thiab buzzer tig rau. Thaum tshem cov hlau nplaum, ob qho tib si tua. Nco ntsoov tias peb yuav tsum tau hloov pauv qhov txiaj ntsig kev nkag los ntawm peb lub mini reed sensor. Qhov no yog vim tias lub ntsuas pa ib txwm qhib, thiab qis qis thaum nws hnov cov hlau nplaum.

Tam sim no koj yuav tsum muaj lub tshuab nqus hlau ua haujlwm!

Pom zoo: