Cov txheej txheem:
- Kauj Ruam 1: Txuas NRF24L01 Modules thiab Circuit
- Kauj ruam 2: Coding tus Transmitter
- Kauj Ruam 3: Coding Tus Txais
- Kauj ruam 4: Ua tiav
Video: Wireless Arduino Teeb-Sib Piv LED Teeb Siv Photoresistor: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Cov lus qhia no qhia ntxaws txog cov kauj ruam tsim nyog los tsim lub rudimentary wireless teeb pom kev zoo teeb LED siv Arduino Unos thiab photoresistor. Daim ntawv thov tau rau lub cuab yeej no yuav yog teeb pom kev hauv chav uas tsis muaj lub qhov rais nrog lub hnub ci dag, sib piv qhov teeb pom kev zoo sab nraum lub sijhawm tiag tiag. Cia peb pib!
Cov Khoom Muag:
Arduino Uno x2 os
NRF24L01 Wireless transceiver x2 (Yeem - NRF24L01 hnab ev khoom x2)
TIP120 darlington transistor
Photoresistor
5 hli LEDs x3
Pushbutton
100 ohm resistor x3
10 k ohm resistor x3
Ntau Yam Jumper Wires
Kauj Ruam 1: Txuas NRF24L01 Modules thiab Circuit
Hauv txoj haujlwm no, ib tus Arduino yuav ua tus xa khoom, xa cov ntaub ntawv teeb pom kev los ntawm tus kws yees duab thaum lub khawm nias. Lwm qhov Arduino yuav ua tus txais, nqa cov ntaub ntawv ntawd thiab hloov nws mus rau hauv lub teeb liab mus rau LEDs. Thawj daim duab qhia pom daim duab xa xov, thiab daim duab thib ob qhia tus txais.
Nco tseg: hauv cov duab ntawm kuv qhov haujlwm, koj yuav pom lub NRF24L01 cov xa xov txuas nrog lwm tus PCB. Nov yog lub hnab ntim khoom rau lub transceivers, uas ua raws li lub zog tswj hwm. Ntxiv rau ua kom txuas xov yooj yim dua, cov hnab ev ntawv tswj hwm lub zog tawm tswv yim rau NRF24L01, tso cai siv lub zog 5V. Kuv tau tso cov hnab ev ntawv hauv kuv daim duab rau qhov pom tseeb.
(Yog tias koj txiav txim siab siv lub hnab ev khoom, thov mus saib qhov txuas no rau daim duab ntawm tus pin chaw nyob hauv qhov siv rau hauv Tshuag NRF24L01).
Txuas hauv qab no yog daim ntawv theej PDF ntawm kab ntawv, kom yooj yim dua zooming/ntxaws saib.
Kauj ruam 2: Coding tus Transmitter
Kauj ruam kawg yog coding. Koj yuav tsum tau teeb tsa RadioHead lub tsev qiv ntawv lossis lub tsev qiv ntawv sib npaug rau siv nrog NRF24L01 cov qauv.
Rau txoj haujlwm no, tus xa thiab txais Arduinos siv cov lej sib txawv ntawm txhua tus. Nov yog tus lej rau tus xa tawm:
Kuv kuj tau txuas cov ntaub ntawv.ino (NRF_Send) kom yooj yim.
#suav nrog
#suav nrog
RH_NRF24 nrf24; // Initializing tus transceiver li nrf24
int khawm = 5; // Teeb tus lej tus lej rau khawm thiab photoresistor
int pResistor = A0; int tus nqi = 0; // Tus nqi ntawm lub teeb los ntawm 0-1023
void teeb tsa ()
{Serial.begin (9600); pinMode (khawm, INPUT); pinMode (pResistor, INPUT); yog (! nrf24.init ()) // Ceeb toom rau tus neeg siv yog tias kev pib ua haujlwm ntawm tus qauv tsis ua tiav Serial.println ("pib ua tsis tiav"); // Qhov pib tom qab pib yog 2.402 GHz (channel 2), 2Mbps, 0dBm yog (! Nrf24.setChannel (1)) Serial.println ("setChannel ua tsis tau"); yog (! nrf24.setRF (RH_NRF24:: DataRate2Mbps, RH_NRF24:: TransmitPower0dBm)) Serial.println ("setRF ua tsis tau tejyam"); }
void lub voj ()
{yog (digitalRead (khawm)) {// Xa lus yog tias lub pob raug nias tus nqi = analogRead (pResistor); // Nyeem tus nqi ntawm photoresistor (0-1023) uint8_t cov ntaub ntawv = {tus nqi}; // Teeb tsa ib qho array hu ua "data " uas muaj lub teeb pom kev nrf24.send (cov ntaub ntawv, sizeof (cov ntaub ntawv)); // Xa cov array mus rau tus neeg txais nrf24.waitPacketSent (); // Tos kom txog thaum lub pob ntawv tau xa Serial.println ("Lub teeb pom kev:" +Txoj hlua (tus nqi)); // Luam lub teeb pom kev rau hauv qhov saib xyuas}}
Kauj Ruam 3: Coding Tus Txais
Rau tus txais, tus lej tseem siv RadioHead Library.
#suav nrog
#suav nrog
RH_NRF24 nrf24;
int LEDPin = 3;
int tus nqi = 0; // Tus nqi ntawm lub teeb los ntawm 0-1023
void teeb tsa ()
{Serial.begin (9600); tus pinMode (LEDPin, OUTPUT); yog (! nrf24.init ()) Serial.println ("init ua tsis tau tejyam"); // Qhov pib tom qab pib yog 2.402 GHz (channel 2), 2Mbps, 0dBm yog (! Nrf24.setChannel (1)) Serial.println ("setChannel ua tsis tau"); yog (! nrf24.setRF (RH_NRF24:: DataRate2Mbps, RH_NRF24:: TransmitPower0dBm)) Serial.println ("setRF ua tsis tau tejyam"); }
void lub voj ()
{// Tos rau cov lus uint8_t buf [RH_NRF24_MAX_MESSAGE_LEN]; // Khaws cov lus tau txais raws li kab lus hu ua "buf " uint8_t len = sizeof (buf); // Khaws qhov loj ntawm buf li "len" thaum (nrf24.waitAvailableTimeout (200) && nrf24.recv (buf, & len)) // Tau txais cov lus rau 200 milliseconds lossis txog thaum tag nrho cov lus tau txais {tus nqi = buf [0]; // Teeb tus nqi rau thawj qhov ntsuas ntawm buf , uas yog int los ntawm photoresistor analogWrite (LEDPin, daim ntawv qhia (tus nqi, 0, 1023, 0, 255)); // Teeb tus pin PWM kom tso tawm tus lej ntsuas ntawm 0-255 rau LED ci ci Serial.println (Txoj hlua (tus nqi)); } analogWrite (LEDPin, 0); }
Kauj ruam 4: Ua tiav
Txaus siab rau ua si ib puag ncig nrog qib sib txawv thiab saib cov LEDs sib phim lawv! Tus photoresistor tuaj yeem ua rau qee zaum tsis zoo, thiab ua haujlwm zoo tshaj plaws hauv chav tsaus nrog lub teeb pom kev hauv ib puag ncig (tab sis tuaj yeem ua haujlwm sab nraud nrog lub hnub ib yam nkaus).
Pom zoo:
Cov Khoom Siv Teeb Meem Siv Chaw Taws Teeb Siv Arduino: 7 Kauj Ruam
Cov Khoom Siv Teeb Meem Siv Khoom Siv Hluav Taws Xob Siv Arduino: Tam sim no, Cov Tsim, Cov tsim tawm tau nyiam Arduino rau kev txhim kho sai ntawm cov qauv ntawm cov phiaj xwm. Arduino yog lub platform siv hluav taws xob qhib raws qhov yooj yim-rau-siv-kho vajtse thiab software. Arduino muaj zej zog cov neeg siv zoo heev. Hauv qhov no
IoT Guru Huab - Piv Piv Piv Txwv: 4 Kauj Ruam
IoT Guru Cloud - Piv Txwv Daim Qauv Yooj Yim: IoT Guru Cloud tau muab cov kev pabcuam rov qab los ntawm REST API thiab koj tuaj yeem sib sau cov REST hu rau koj lub vev xaib yooj yim. Nrog Highcharts, koj tuaj yeem tso tawm kab kos ntawm koj qhov kev ntsuas yooj yim nrog AJAX hu
Ua Ntej Qhia Kom Siv Cov Av Huv Huv Sensor W/ Piv Piv Txwv: 7 Kauj Ruam
Ua Ntej Qhia Kom Siv Cov Av Huv Huv Sensor W/ Piv Piv Txwv: Koj tuaj yeem nyeem qhov no thiab lwm yam kev qhia zoo ntawm ElectroPeak lub vev xaib raug cai Cov piv txwv tseem ceeb kuj tau muab los pab koj ua tus coj txoj cai.Koj Yuav Kawm Dab Tsi: Yuav av li cas
Kev teeb tsa Matrix LED hauv Cov Khoom Siv Hluav Taws Xob qub - Yuav Tsum Tau Cov Khoom Siv: 3 Cov Kauj Ruam (nrog Duab)
Kev teeb tsa Matrix LED hauv Cov Khoom Siv Hluav Taws Xob qub - Yuav Tsum Tau Siv Cov Khoom Siv: Lub teeb pom kev zoo los ntawm lub Windows PC dhau Bluetooth thiab LED cov txheej txheem nthuav tawm Ib co piv txwv ntawm pixel kos duab thiab cov duab ua haujlwm khiav ntawm LED Cov Ntsiab Lus ntawm PIXEL Guts Kit Hauv Cov Lus Qhia no, peb ' yuav
NodeMCU - MQTT Piv Txwv Piv Txwv: 4 Cov Kauj Ruam
NodeMCU - MQTT Piv txwv yooj yim: Zaj lus qhia no yuav qhia qhov pib MQTT raws tu qauv siv ntawm NodeMCU pawg thawj coj saib.Peb siv MQTTBox ua MQTT tus neeg siv khoom ntawm no, thiab peb yuav siv NodeMCU kom ua tiav cov haujlwm hauv qab no: Tshaj tawm "nyob zoo ntiaj teb" rau lub ncauj lus " outTopic”txhua ob vib nas thisSubscr