Cov txheej txheem:

Arduino Wireless Tswb System Siv Cov Cuab Yeej Uas Muaj: 9 Cov Kauj Ruam (nrog Duab)
Arduino Wireless Tswb System Siv Cov Cuab Yeej Uas Muaj: 9 Cov Kauj Ruam (nrog Duab)

Video: Arduino Wireless Tswb System Siv Cov Cuab Yeej Uas Muaj: 9 Cov Kauj Ruam (nrog Duab)

Video: Arduino Wireless Tswb System Siv Cov Cuab Yeej Uas Muaj: 9 Cov Kauj Ruam (nrog Duab)
Video: raspberry on a boat #1: Wegmatt dAISy assembly and software overview 2024, Kaum ib hlis
Anonim
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog
Arduino Wireless Tswb System Siv Lub Cev Muaj Zog

Txoj haujlwm no tuaj yeem tsim ua kwv yees li ib nrab teev ntawm tus nqi kwv yees li $ 20.00 yog tias koj muaj tam sim no 433Mhz lossis 315Mhz wireless tswb ntsuas.

Nws kuj tseem tuaj yeem ua tiav qhov haujlwm tshiab nrog lub tswb tswb wireless, xws li lub ntsuas hluav taws xob pom lub ntsej muag thiab lub qhov rooj qhib, yooj yim thiab pheej yig muaj online. Tsuas yog tshawb nrhiav 433Mhz lossis 315Mhz cov cim uas siv PT2262 lossis EV1527 coding.

Kuv paub tseeb tias muaj ntau tus neeg zoo li kuv uas tau yuav lub tswb GSM/2G nrog lub wireless sensor thiab zoo siab nrog nws, txawm li cas los xij thaum 2G/GSM network raug kaw qhov chaw kuv nyob, kuv tau tso nrog lub tswb nrov kuv tuaj yeem tsis muaj program lossis txawm teem sijhawm rau nws. Muaj ib hnub thaum xav tsis thoob tias kuv tuaj yeem ua dab tsi kom ua rau kuv lub tswb nrov dua, nws tau tshwm sim rau kuv los tshuaj xyuas yog tias Arduino tuaj yeem tau txais cov cim qhia los ntawm lub ntsuas cua. Kuv dawm hla qhov tsis txaus ntseeg https://www.instructables.com/id/Decoding-and-sending-433MHz-RF-codes-with-Arduino-// thiab tom qab qee qhov kev sim txiav txim siab tias kuv tuaj yeem tau txais cov cim qhia los ntawm kuv lub cim xeeb uas twb muaj lawm. Kuv pib txheej txheem txhawm rau tsim lub tswb uas tuaj yeem hloov kuv lub tswb uas twb muaj lawm thiab tseem yuav muab kev ua haujlwm ntau ntxiv. Ib qho ntawm cov teeb meem nrog lub tswb qub tsis tau paub tseeb tias qhov twg ntawm 25 lub ntsuas hluav taws xob tau tawm mus, los ntawm kev ntxiv lub vijtsam LCD rau kuv lub tswb tshiab tsim tam sim no kuv tau txais cov ntawv ntawm lub LCD qhia meej tias lub sensor tau qhib. Lub tswb tshiab tseem tuaj yeem ua tub rog siv los ntawm kuv cov wireless keyfobs uas twb muaj lawm thiab muaj lub sijhawm tiag tiag los tso cai rau nws tau txais caj npab thiab tshem riam phom ntawm lub sijhawm tuaj yeem ua ntej ntawm hnub.

Khoom siv

Saib cov ntawv sau ntxiv thaum kawg kom ntseeg tau tias koj siv qhov tseeb ntawm cov ntu no.

Arduino Uno lossis zoo sib xws

433 lossis 315 MHz tus txais tus qauv rau Arduino

DS3231 Lub Sij Hawm Tiag Sijhawm rau Arduino

I2C 16x2 LDC module rau Arduino

Wireless Tswb reed hloov pauv, lub zog ntsuas thiab lub fobs tseem ceeb nyob deb li qhov xav tau

Piezo buzzer

LED & 220 ohm resistor

Breadboard (yeem tab sis pom zoo)

Lub hwj chim tsim nyog rau Arduino

Jumper xov hlau thiab lwm yam

PC nrog Arduino IDE teeb tsa

Kev paub pib ntawm Arduino

Kauj Ruam 1: Cov khoom siv

Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv

Qee cov duab saum toj no ntawm cov khoom koj yuav xav tau rau txoj haujlwm no

Kauj Ruam 2: Hlau Up Ardunio thiab Modules Raws Li Qhia hauv Duab

Hlau Up Ardunio thiab Modules Raws Li Qhia hauv Duab
Hlau Up Ardunio thiab Modules Raws Li Qhia hauv Duab

Piezo ntawm tus pin 5 ntawm Arduino thiab lub ntiaj teb

LED nruab nrab ntawm tus pin 8 ntawm Arduino thiab mus rau 220ohm resistor ces mus rau lub ntiaj teb

433 lossis 315 Mhz tus txais, VCC rau 5V, GND rau hauv av thiab ib qho ntawm 2 cov ntaub ntawv pins rau pin2 ntawm Arduino

I2C 16X2 LCD Module VCC rau 5V, GND rau hauv av, SCL SDA pins rau SCL SDA ntawm Arduino (tus pin A5 yog SCL, tus pin A4 yog SDA)

DS3231 RTC Module VCC rau 5V, GND rau hauv av, SCL SDA pins rau SCL SDA ntawm Arduino (muaj txheej thib 2 nyob saum GND thiab AREF pins ntawm feem ntau Arduino)

Kuv paub qee tus ntawm koj yuav tsis xav tau cov ntaub ntawv ntau dua li qhov no thiab kos duab txuas hauv qab no tab sis kuv yuav nkag mus rau qee qhov nthuav dav rau txhua tus neeg uas xav tau kev pab me ntsis ntxiv.

Kauj Ruam 3: Ntxiv Cov Tsev Qiv Ntawv Xav Tau rau Arduino IDE

Ntxiv Cov Tsev Qiv Ntawv Xav Tau rau Arduino IDE
Ntxiv Cov Tsev Qiv Ntawv Xav Tau rau Arduino IDE
Ntxiv Cov Tsev Qiv Ntawv Xav Tau rau Arduino IDE
Ntxiv Cov Tsev Qiv Ntawv Xav Tau rau Arduino IDE
Ntxiv Cov Tsev Qiv Ntawv Xav Tau rau Arduino IDE
Ntxiv Cov Tsev Qiv Ntawv Xav Tau rau Arduino IDE

Arduino Sketch los khiav lub tswb siv qee lub tsev qiv ntawv uas tsis tau teeb tsa ntawm Arduino IDE los ntawm lub neej ntawd.

Txhawm rau ntxiv RCSwitch lub tsev qiv ntawv rau Arduino IDE. Qhib Arduino IDE hauv cov ntawv qhia zaub mov saum toj kawg nkaus xaiv "Sketch" tom qab ntawd los ntawm qhov nco cia xaiv "suav nrog lub tsev qiv ntawv" thiab los ntawm qhov txuas ntxiv mus xaiv "Tswj cov tsev qiv ntawv". Tom qab ntawd hauv "Lim koj qhov kev tshawb nrhiav" lub thawv hom "RCSW", tom ntej no nyem rau nruab rau "rc-hloov los ntawm sui77"

Cov lus qhia ntxaws ntxiv ntawm kev ntxiv cov tsev qiv ntawv ntawm

Thaum peb nyob ntawm nws peb tseem yuav tsum ntxiv cov tsev qiv ntawv hu ua Time, TimeAlarms, DS1307RTC thiab LiquidCrystal_I2C, cov txheej txheem ib yam li saum toj no tab sis tshawb nrhiav lub npe ntawm txhua lub tsev qiv ntawv tshiab thiab teeb tsa. Saib cov duab txhaj tshuaj saum toj no yog tias tsis paub meej tias siv lub tsev qiv ntawv twg.

DS3231 lub sijhawm tiag tiag yog sib xws nrog thiab siv DS1307RTC lub tsev qiv ntawv.

Kauj Ruam 4: Tom ntej Peb Yuav Tsum Tau Txais Cov Cai Rau Koj Cov Kov

Tom ntej no Peb Yuav Tsum Tau Txais Cov Cai Rau Koj Cov Cwj Pwm
Tom ntej no Peb Yuav Tsum Tau Txais Cov Cai Rau Koj Cov Cwj Pwm
Tom ntej no Peb Yuav Tsum Tau Txais Cov Cai Rau Koj Cov Cwj Pwm
Tom ntej no Peb Yuav Tsum Tau Txais Cov Cai Rau Koj Cov Cwj Pwm

Kuv tau muab tus qauv ntawm Arduino code hauv qab no tab sis koj yuav tsum tau nrhiav qhov txiaj ntsig rau txhua qhov ntawm koj lub ntsuas cua thiab muab tso rau hauv qhov chaws.

Muaj cov ntaub ntawv dav dav yuav ua li cas kom tau txais cov lej ntawm ob qho chaw no;

www.instructables.com/id/Decoding-and-sending-433MHz-RF-codes-with-Arduino-/

github.com/sui77/rc-switch/wiki

Txawm li cas los ntawm no yog kuv cov ntawv luv;

Txhawm rau kom tau txais cov lej koj lub ntsuas cua thiab lub fobs tseem ceeb nyob deb tab tom xa, txuas Arduino raws li tau sib sau ua ke hauv qib 1 mus rau PC ntawm USB cable thiab qhib Arduino IDE. Tom qab ntawd hauv Arduino IDE mus rau "Cov Ntaub Ntawv" poob qis, tom qab ntawd mus rau "Piv txwv" nyem rau hauv cov npe piv txwv piv txwv kom txog thaum koj pom "RCSWITCH" tom qab ntawv xaiv qhov "ReceiveDemo_Advanced" kos duab thiab xa nws mus rau Arduino. Thaum cov duab kos ua tiav uploads qhib qhov saib ntawm Arduino IDE nrog nws tseem txuas rau koj lub PC ntawm USB. Tam sim no ua rau thawj qhov ntsuas uas koj xav tau txais tus lej rau, qhov tso tawm los ntawm RCSwitch yuav tshwm nyob rau hauv lub qhov rai saib xyuas. Txog qhov haujlwm no peb tab tom nrhiav tus lej lej zauv raws li tau hais qhia hauv lub vijtsam 2. Koj yuav tsum ua kom lub ntsuas ntau lub sijhawm nrhiav tus lej zauv uas tshwm ntau zaus, qee zaum yuav muaj qhov sib txawv sib xyaw nrog tus nqi tseeb, qhov no yog los ntawm kev cuam tshuam los ntawm kev siv xov tooj cua tsis zoo lossis lwm yam khoom siv ua haujlwm ib yam nkaus.

Nco tseg cov lej lej ntawm tus lej cim cim rau siv hauv qib tom ntej. Rov ua dua rau txhua lub ntsuas hluav taws xob thiab cov keyfobs nyob deb koj xav siv hauv txoj haujlwm, ua raws txoj cai uas mus nrog lub sensor twg. Yog tias siv keyfobs rau caj npab thiab tshem tawm lub tswb koj yuav xav tau cim cov lej sib txawv rau khawm caj npab thiab khawm tshem riam phom ntawm txhua lub chaw taws teeb.

Kauj Ruam 5: Arduino Code Template

Hauv qab no yog daim ntawv theej ntawm kuv tus lej Arduino ua.ino cov ntaub ntawv hu ua Wireless_Alarm. Koj tuaj yeem nyem rau nws thiab nws yuav tsum qhib hauv Arduino IDE. Kuv tsis yog tus programmer kuv tus lej tau sib sau ua ke los ntawm cov piv txwv pom hauv Arduino IDE, nws yog tej zaum tsis tshwj xeeb tshwj xeeb tab sis nws ua haujlwm thiab tau ntseeg tau nyob rau lub sijhawm ntev.

Nco ntsoov rov khaws cov duab kos tom qab koj hloov pauv kom suav nrog cov lej los ntawm koj tus kheej lub ntsuas.

Kauj Ruam 6: Muab tshuaj txhuam cov lej uas koj tau txais hauv Kauj Ruam 5 Rau Hauv Tus Qauv Arduino Sketch

Tam sim no cov kauj ruam los kho tus lej rau lub ntsuas cua thiab cov keyfobs nyob deb koj siv.

Yog tias koj qhib Wireless_Alarm kos duab hauv koj li IDE koj yuav pom ntawm kab 111.

yog (mySwitch.getReceivedValue () == 115166236) // Fob caj npab khawm code

Qhov twg hauv tus lej uas twb muaj lawm nws nyeem 115166236 koj xav tau hloov tus lej ntawd nrog tus lej lej lej rau lub caj npab khawm ntawm koj cov keyfob tej thaj chaw deb uas koj kaw hauv Kauj Ruam 5.

Piv txwv li yog hauv qib 5 koj tau txais cov lej zauv 1154321 koj yuav hloov kab 111 rau tam sim no nyeem;

yog (mySwitch.getReceivedValue () == 1154321) // Fob caj npab khawm code

Ua raws tib txoj hauv kev rau kab 125.

yog (mySwitch.getReceivedValue () == 115166234) // Fob tshem riam phom khawm

Hloov 115166234 rau tus lej ntawm koj lub key key deb key tshem riam phom uas koj kaw rau ntawm Kauj Ruam 5.

Yog tias koj xav siv ntau lub fobs nyob deb ntawm caj npab thiab tshem riam phom, luam thiab muab kab 111 txog rau 136 ntau zaus raws li xav tau tom qab ntawd hloov qhov txiaj ntsig kom haum rau koj lwm qhov keyfobs nyob deb, tab sis zoo tshaj tsuas yog pib nrog ib qho chaw deb kom txog thaum koj paub tseeb tias koj hloov kho kos duab ua haujlwm.

Tam sim no txhawm rau ntsuas lub tswb ntsuas hauv qhov kos duab ntawm kab 140

yog (ledState == HIGH && mySwitch.getReceivedValue () == 1151640) // Ua rau lub teeb liab xa cov chaw ua haujlwm hauv txee

Nqa tawm 1151640 thiab ntxig tus lej zauv ntawm ib qho ntawm koj lub tswb ntsuas.

Tom qab ntawd ntawm kab 158.

lcd.print (F ("Lub chaw haujlwm hauv chav ua haujlwm")); // luam cov lus rau lcd kom paub tias lub tshuab twg tau qhib (thiab mus thiab pom tus neeg nyiag khoom:)

Hloov Chaw Haujlwm Chaw Haujlwm mus rau yam koj xav tau kom pom ntawm LCD rau lub ntsuas ntawd. Piv txwv li yog tias koj xav kom nws nyeem kitchendoor ua kab zoo li no;

lcd.print (F ("Kitchendoor")); // luam cov lus rau lcd kom paub tias lub tshuab twg tau qhib (thiab mus thiab pom tus neeg nyiag khoom:)

Cov npe yuav tsum tsis pub tshaj 16 tus cim.

Nruab nrab ntawm kab 165 thiab 187 yog tus qauv rau luam thiab muab tshuaj ntau zaus raws li xav tau rau kab ncaj qha hauv qab 187. Hloov tus lej tom qab mySwitch.getReceivedValue () == nrog cov lej ntawm ib qho ntawm koj lwm yam khoom siv uas koj kaw hauv qib 5 thiab hloov lub npe hauv "" hauv lcd.print (F ("sensornamehere")); rau lub npe koj xav muab koj lub sensor.

Yog tias koj tsis siv lub keyfobs nyob deb ntawm caj npab thiab tshem riam phom koj lub tswb koj tuaj yeem tsis quav ntsej kab 111-136 lossis muab // thaum pib ntawm txhua kab uas tsis xav tau thiab Arduino yuav tsis nyeem lawv.

Nco ntsoov khaws cov ntawv tom qab koj tau hloov pauv.

Kauj Ruam 7: Hloov kho.ino rau koj Arduino thiab Xeem

Rub tawm qhov hloov kho.ino rau Koj Arduino thiab Xeem
Rub tawm qhov hloov kho.ino rau Koj Arduino thiab Xeem
Rub tawm qhov hloov kho.ino rau Koj Arduino thiab Xeem
Rub tawm qhov hloov kho.ino rau Koj Arduino thiab Xeem
Rub tawm qhov hloov kho.ino rau Koj Arduino thiab Xeem
Rub tawm qhov hloov kho.ino rau Koj Arduino thiab Xeem

Nrog Arduino tseem txuas nrog koj lub PC los ntawm USB upload cov duab kos rau Arduino Board. Thaum qhov kev tso tawm tiav ua tiav lub LCD yuav tsum nyeem "Tswb Ntawm Kev Raug Rho Tawm". Nias lub pob khawm ntawm koj lub chaw taws teeb thiab LCD yuav tsum nyeem "Tswb Ntawm Kev Ua Tub Rog" thiab LED yuav tsum tau taws kom qhia rau koj paub tias nws yog tub rog, tam sim no ua rau lub ntsuas pa thaum nws ua tub rog, LCD yuav tsum nyeem Tswb ua raws lub sijhawm thiab qhov chaw ntawm lub ntsuas cua, lub suab nrov yuav tsum yog suab li 2 feeb tshwj tsis yog koj thawb lub khawm tshem riam phom. Yog tias koj tsis tau txais qhov txiaj ntsig no rov txheeb xyuas cov lej koj tau txais hauv Kauj Ruam 5 thiab qhov kev hloov pauv uas koj tau ua rau cov cai hauv cov kauj ruam dhau los, kuj tseem txheeb xyuas qhov txuas ntawm txhua yam khoom. Yog tias LCD tsis nyeem tag nrho, muaj qhov hloov pauv sib txawv nyob tom qab ntawm LCD module. Thaum qhov sib piv tau teeb tsa raug yog tias LCD tseem tsis tau nyeem sim hloov Chaw Nyob ntawm LCD los ntawm 0x3f rau 0x27 ntawm kab 12 hauv daim duab. Kev daws teeb meem LCD ntawm no I2C LCD qhia

Kauj Ruam 8: Teeb Lub Sijhawm ntawm RTC Module thiab Hloov Lub Caj Npab thiab Lub Sijhawm Raug Tshem Tawm

Vam tias koj RTC twb tau teeb tsa nrog lub sijhawm raug tab sis yog tias tsis qhib IDE, xaiv 'Cov Ntaub Ntawv' thiab los ntawm qhov nco tseg nyem rau ntawm "Piv txwv", nqes mus rau "DS1307RTC" thiab xaiv "SetTime" kos duab, rub daim duab rau koj Arduino thiab nws yuav teeb tsa lub sijhawm tiag tiag nrog lub sijhawm los ntawm koj lub PC. Tom qab ntawd koj yuav xav tau rov ua lub Wireless_Alarm kos duab rau koj Arduino.

Wireless_Alarm.ino Kuv tau muab yuav los ntawm lub hauv paus teeb tsa lub tswb rau caj npab cia li thaum 10.15 teev tsaus ntuj txhua hmo thiab tshem riam phom ntawm 6.00 teev sawv ntxov txhua tag kis. Txhawm rau hloov lub sijhawm no, hloov kho Sketch ntawm kab 71 thiab 72. Lub sijhawm nyob rau hauv kab tom qab Alarm.alarmRepeat hauv hom HH, MM, SS. hloov qhov no mus rau lub sijhawm twg los haum koj.

Tswb.alarmRepeat (6, 00, 0, Sawv ntxov Tswb); // DISARM lub sijhawm

Tswb.alarmRepeat (22, 15, 0, EveningAlarm); // ARM sijhawm

Yog li txhawm rau hloov lub sijhawm tshem riam phom mus rau 9.15 sawv ntxov thiab lub sijhawm caj npab mus txog 5.30 teev tsaus ntuj txoj cai yuav zoo li no

Tswb.alarmRepeat (9, 15, 0, Sawv ntxov Tswb); // DISARM lub sijhawm

Tswb.alarmRepeat (17, 30, 0, EveningAlarm); // ARM sijhawm

Yog tias koj tsis xav kom lub tswb ceeb toom rau caj npab thiab tshem riam phom cia li muab tso rau // ua ntej ntawm 2 kab thiab lawv yuav tsis siv.

//Alarm.alarmRepeat(6, 00, 0, MorningAlarm); // DISARM lub sijhawm

//Alarm.alarmRepeat(22, 15, 0, EveningAlarm); // Caj npab sijhawm

Lub sijhawm lub tswb nrov nrov nrov rau tuaj yeem hloov pauv los ntawm kev hloov kab 22

const ntev ncua = 120000; // rau millis ncua rau lub sijhawm ntev lub tswb nrov

Lub sijhawm nyob hauv milliseconds yog li 120000 = 120 vib nas this, hloov 120000 txog 30000 yuav ua lub tswb nrov rau 30 vib nas this.

Lub solenoid khiav lub siren, lub teeb pom kev zoo, lub suab nrov nrov nrov thiab lwm yam kuj tseem tuaj yeem txuas rau tus pin 7 lossis tus pin 9 thiab yuav khiav rau "luv" raws li tau teev tseg saum toj no. Nco ntsoov lub siab tshaj plaws rau tus pin Arduino yuav tsum tsis pub tshaj 40mA.

Kauj Ruam 9: Cov Lus Cim Ntxiv

Thaum xaiv 433 lossis 315 MHz tus qauv txais rau Arduino koj yuav tsum xaiv qhov zaus kom haum rau lub tswb ntsuas koj xav siv. Kuv hais kom yuav ib tus qauv uas los nrog cov kauv me me helical antennae rau kev ua tau zoo tshaj plaws, hloov tau 17.3mm ntev ncaj xov hlau kav hlau txais xov kuj tseem ua rau kev ua tau zoo.

Nrog 16x2 LCD module koj yuav tsum siv 4 tus pin I2C LCD los siv cov lus qhia thiab cov cai kuv muab ntawm no, nws tuaj yeem ua nrog 16 tus pin tus qauv LCD tab sis nws yuav tsis ua haujlwm nrog cov hlua lossis cov lej ntawm no.

Wireless tswb reed hloov pauv, lub suab ntsuas thiab qhov tseem ceeb fobs yuav tsum yog 433Mhz lossis 315Mhz kom phim nrog tus txais koj npaj siab siv thiab yuav tsum siv PT2262 lossis EV1527 coding.

Lub tswb nrov tuaj yeem nthuav dav thiab hloov pauv tau, Kuv twb tau ntxiv daim npav SD los kaw thaum lub ntsuas hluav taws xob tau tshwm sim, hloov kho lub LCD kom tsuas yog zes hluav taws thaum khawm tau tuav thiab ntxiv 100dB siren, tab sis tsis suav nrog cov ntsiab lus ntawm no kom khaws kab lus raws li luv thiab yooj yim li sai tau. Kuv vam tias sib qhia cov haujlwm uas kuv tau ua ntawm lub tswb no yog qee qhov siv rau lwm tus.

Zoo siab teb cov lus nug.

Ua tsaug.

Pom zoo: