Cov txheej txheem:

RFID + Xim Sensor IoT Project: 7 Kauj Ruam
RFID + Xim Sensor IoT Project: 7 Kauj Ruam

Video: RFID + Xim Sensor IoT Project: 7 Kauj Ruam

Video: RFID + Xim Sensor IoT Project: 7 Kauj Ruam
Video: Open lock with a RFID Reader using Arduino 🔐💳😲 #diy #arduino #arduinoproject #howto #how #electronic 2024, Hlis ntuj nqeg
Anonim
RFID + Xim Sensor IoT Project
RFID + Xim Sensor IoT Project

Lub tswv yim ntawm txoj haujlwm no yog muab nqi zog rau cov neeg uas haus cov khob kas fes thiab pov tseg lawv kom raug. Ua ib lub tuam txhab zoo li Tim Hortons piv txwv; xyoo 2014, lawv tau sau tseg ua haujlwm 2 billion khob kas fes txhua xyoo. Txawm hais tias lawv lub khob tuaj yeem rov ua dua tshiab, lawv tsis raug lees txais rov ua dua txhua qhov chaw nyob rau lub sijhawm no. Raws li tau hais hauv lawv lub vev xaib, tam sim no peb muaj cov haujlwm hauv ntau lub tsev noj mov thoob plaws tebchaws Canada uas peb ntes peb lub khob ntawv (thiab lwm yam ntim khoom) rau rov ua dua tshiab los yog ua dua tshiab. Tus naj npawb ntawm cov chaw uas peb muab rau hauv khw muag khoom rov ua dua tshiab txuas ntxiv thaum peb ua haujlwm nrog cov tuam txhab tswj hwm pov tseg hauv nroog txhawm rau nthuav peb txoj haujlwm…”

Yog li, thaum lawv txuas ntxiv nthuav thiab nce kev lag luam raws li kev saib xyuas ib puag ncig ib puag ncig, peb ntseeg tias lawv tseem tuaj yeem ua rau cov neeg siv khoom nce ntxiv thiab nce kev paub los ntawm kev tsim cov khoom plig txhawb zog.

Txoj haujlwm no yog kev sim txhawm rau txhim kho cov txheej txheem ib puag ncig lub tswv yim no.

Kauj Ruam 1: Qhov Chaw

Qhov
Qhov
Qhov
Qhov
Qhov
Qhov
Qhov
Qhov
  • Raspberry Pi 3
  • Arduino Mega Cov
  • Mini khob cij
  • Poj niam. Txiv neej jumper xov hlau
  • 2 x LEDs (liab & ntsuab)
  • 2 x 330 Ohm Resistors
  • TCS3200 Xim Sensor
  • RC522 RFID nyeem ntawv thiab Cim npe
  • USB 2.0 Cable Hom A/B.
  • Computer thiab Internet
  • Khob kas fes

Kauj ruam 2: Teeb Kho Vajtse

Teeb Kho Vajtse
Teeb Kho Vajtse
Teeb Kho Vajtse
Teeb Kho Vajtse

Txuas TCS 3200 rau Arduino

VCC 5 VV

GND GND

S04 ib

S1 5

S2 6

S3 7

E0 NPE

TSUAS 8

Txuas RFID/LEDs rau Raspberry Pi

SDAB 24

SWB 23

MOOG 19

MYOB 21

NQA 6

TSW 22

3.3V 1

GREEN LED 12 thiab 330 Ohm rau GND

RED LED 11 thiab 330 Ohm rau GND

Kauj Ruam 3: Programming Xim Sensor

Programming Xim Sensor
Programming Xim Sensor

TCS3200 hnov xim lub teeb los ntawm sab hauv 8 x 8 photodiode array. Tam sim no qhov hloov pauv zaus tau siv los hloov kev nyeem ntawv los ntawm photodiode mus rau hauv lub xwmfab yoj uas nws qhov zaus yog sib piv rau qhov siv ntawm lub teeb.

Photodiodes muaj peb lub lim dej sib txawv. Muaj 16 lub lim dej liab, 16 lub lim dej ntsuab, 16 lub lim dej xiav, thiab lwm yam 16 cov duab tsis muaj lim.

Txhawm rau kom lub photodiode nyeem cov xim, peb yuav tsum tswj tus pin S2 thiab S3.

Rooj Xim:

Xim S2 S3

Liab LOW LOW

Xiav LOW HIGH

Ntsuab HIGH HIGH

Txhua lub sensor tej zaum yuav txawv me ntsis hauv zaus. Nqa lub sensor ze rau lub khob. Siv Colour_Tester.ino tus lej txhawm rau nrhiav qhov tseeb raug rau koj lub khob tshwj xeeb thiab nco qab cov txiaj ntsig muab hauv Serial Monitor. Tom qab ntawd sau yog tias cov lus tshaj tawm "yog" lossis "tsis yog" yog lub ntsuas tau pom lub khob raws li qhia hauv Sensor_Data.ino.

Thaum ua tiav, txuas Arduino mus rau Raspberry Pi ntawm USB cable.

Kauj Ruam 4: Teeb Raspbian rau RFID RC522

Teeb Raspbian rau RFID RC522
Teeb Raspbian rau RFID RC522
Teeb Raspbian rau RFID RC522
Teeb Raspbian rau RFID RC522
Teeb Raspbian rau RFID RC522
Teeb Raspbian rau RFID RC522

1. Pab kom SPI (Serial Peripheral Interface), qhib lub davhlau ya nyob twg thiab khiav cov lus txib hauv qab no.

sudo raspi-teeb tsa

2. Siv tus xub xub los xaiv “5 Qhov Kev Xaiv Ua Ntej” thiab nias Enter.

3. Siv koj cov yawm sij xub xaiv "P4 SPI", thiab nias Enter.

4. Tam sim no koj yuav raug nug yog tias koj xav kom pab tau SPI Interface, xaiv Yog nrog koj tus xub xub thiab nias Enter kom mus ntxiv.

5. Thaum SPI interface tau ua tiav ua tiav koj yuav tsum pom cov ntawv hauv qab no tshwm ntawm qhov screen, "SPI interface tau qhib". Pib dua Raspberry Pi los ntawm nias Enter thiab tom qab ntawd ESC. Ntaus cov lus txib hauv qab no rau hauv lub davhlau ya nyob twg ntawm koj tus Raspberry Pi kom rov pib dua koj li Raspberry Pi.

sudo rov pib dua

6. Thaum koj Raspberry Pi tau rov ua tiav tiav, kos kom paub tseeb tias nws tau ua tiav qhov tseeb. Khiav cov lus txib hauv qab no kom pom tias spi_bcm2835 tau teev tseg.

lsmod | pab spi

7. Nruab Python-dev thiab git nrog cov lus txib.

sudo apt-tau nruab python-dev git

8. Pib Node-Liab los tsim daim nplaub tshev ~/.node hauv koj lub tsev nplaub tshev. Khiav qhov hais kom ua

ntawm-liab-pib

Nkag mus rau tus neeg siv siv koj tus browser, taw rau qhov chaw nyob https://: 1880. Piv txwv li kuv tus Pi nyob ntawm kuv lub chaw haujlwm hauv tsev network ntawm chaw nyob 192.168.0.17, yog li nkag Node-RED Kuv xauj mus rau

Tam sim no nres Node-Red Server nrog cov lus txib.

ntawm-liab-nres

9. Nruab Daemon node thiab Serial node.

cd ~./node-liab

npm i node-red-node-daemon npm i node-red-node-serialport

10. Nruab SPI-Py.

cd ~ ib

git clone https://github.com.lthiery/SPI-Py.git cd SPI-Py/sudo python setup.py install

11. Luam cov ntaub ntawv no los ntawm zip hauv koj tus neeg siv phau ntawv qhia tsev - piv txwv li /tsev /pi.

12. Reboot tus pi thiab Pib Node-Red ib zaug ntxiv.

13. Kuaj daim npav nyeem ntawv los ntawm kev sau tsab ntawv los ntawm kab hais kom ua

cd ~ ib

nab hab sej rfidreader.py

Thaum koj yoj daim ntawv tsis pub dhau ~ 1cm ntawm thaj tsam tseem ceeb ntawm daim npav nyeem ntawv, tsab ntawv yuav luam tawm qhov tshwj xeeb UID ntawm daim npav, thiab nws yog hom. Muaj ntau hom ntawv, feem ntau hu ua MIFARE 1KB, tab sis muaj lwm tus. Tsis yog txhua daim npav siv tib txoj kev sib txuas lus RF yog li tsis txhob poob siab yog tias daim npav random uas koj khaws tuaj tsis raug lees paub. Nco ntsoov UID ntawm koj cov ntawv cim npe rau tom qab.

Kauj Ruam 5: Tsim Node-RED Flow kom Nyeem Koj Li RFID Tag thiab Xim Xim

Tsim Node-RED Flow los nyeem Koj Daim Ntawv Cim RFID thiab Xim Xim
Tsim Node-RED Flow los nyeem Koj Daim Ntawv Cim RFID thiab Xim Xim
Tsim Node-RED Flow los nyeem Koj Daim Ntawv Cim RFID thiab Xim Xim
Tsim Node-RED Flow los nyeem Koj Daim Ntawv Cim RFID thiab Xim Xim
Tsim Node-RED Flow los nyeem Koj Daim Ntawv Cim RFID thiab Xim Xim
Tsim Node-RED Flow los nyeem Koj Daim Ntawv Cim RFID thiab Xim Xim

Txuas rau Node-RED ntawm koj Pi siv lub browser-xws li los ntawm lwm lub khoos phis tawj lossis ntawm Pi nws tus kheej.

1. Nyem rau lub cim hamburger nyob ib sab ntawm lub pob liab liab tso rau saum txoj cai.

2. Mus rau Ntshuam thiab nyem rau ntawm Clipboard.

3. Luam tag nrho cov ntsiab lus ntawm cov ntawv hauv kab ntawv-liab-flow.txt thiab muab tshuaj txhuam rau hauv daim ntawv los teev cia thiab nias Ntshuam.

4. Peb yuav tsum xyuas kom txhua yam tau teeb tsa kom raug. Ua ntej tshaj, nyem rau ntawm kab lus txiv kab ntxwv daj (sab laug sab laug). Nyem rau ntawm lub cim Cim thiab tom qab ntawd lub Viewfinder icon thiab xaiv qhov chaw nres nkoj txuas uas Arduino txuas nrog. Tom qab ntawd Nyem rau qhov hloov tshiab khawm ua raws li lub pob ua tiav liab.

5. Tom ntej no peb yuav teeb tsa lub paj liab MQTT (tom ntej no rau ntawm cov kab ntawv txuas). Nyem rau ntawm Pen icon. Ntaus tus IP chaw nyob ntawm qhov chaw koj xav kom tus broker ua. Thaum ua tiav, nyem lub pob Hloov tshiab liab thiab khawm Ua tiav liab.

6. Thaum kawg, peb teeb tsa lub txiv kab ntxwv ua haujlwm hu ua JSON mus rau Lub Hom Phiaj nyob ib sab ntawm RFIDReader node. Txoj haujlwm muaj cov lus hloov pauv. Qhov no yuav siv UID ntawm cov cim npe thiab hloov npe rau lawv. Hauv peb qhov xwm txheej, peb muaj ob daim ntawv cim npe uas peb tau hloov pauv Tus Neeg Siv 1 thiab Tus Neeg Siv 2.

CEEB TOOM CEEB TOOM: Yog tias koj npaj siab siv ntau dua ob daim ntawv koj yuav tau hloov cov ntawv sau/ntws.

Kauj Ruam 6: Tso thiab Dashboard

Deploy thiab Dashboard
Deploy thiab Dashboard
Deploy thiab Dashboard
Deploy thiab Dashboard
Deploy thiab Dashboard
Deploy thiab Dashboard
Deploy thiab Dashboard
Deploy thiab Dashboard

Txhua yam yog teeb tsa thiab npaj mus. Nias lub pob Deploy liab nyob rau sab xis saum toj.

Nyem rau ntawm kab duab kab cim hauv qab nws ua raws los ntawm lub cim uas zoo li yog lub npov nrog tus xub. Lub qhov rai tshiab yuav tsum tshwm nrog RFID & SENSOR TABLE thiab RFID-RC522 widgets.

Nias lub khawm Tsim kom pib lub rooj tshiab thiab pib ntsuas koj cov ntawv cim npe. Koj yuav tsum pom lub rooj qhia pom cov cim cim sib txawv ntawm cov ntsiab lus/sijhawm nws tau kuaj pom thiab hnub/sijhawm. Lub caij no, ntawm lub khob cij, cov zaub ntsuab yuav tsum ci thaum twg pom cov cim, yog tias tsis yog lub teeb liab yuav nyob. (Txhawm rau tshem lub rooj, nyem Clear thiab rho tawm lub rooj xovxwm Rho tawm). Cov xim xim yuav tsum ua haujlwm zoo ib yam. Yog tias lub khob raug kuaj pom ces lub teev dub yuav tig ntsuab.

Kauj ruam 7: Yav tom ntej

  • Zoo saib UI
  • Ntau Cov Neeg Siv
  • Lub Koob Yees Duab/Duab cov ntaub ntawv kom pom tseeb lub khob kas fes
  • Xa cov ntsiab lus hloov tshiab rau twitter account

Pom zoo: