Cov txheej txheem:
- Kauj Ruam 1: Ntxiv Txoj Cai rau ESP8266
- Kauj Ruam 2: Teeb Koj Li TP-LINK Ntse Plug
- Kauj Ruam 3: Teeb Tus Pab Tsev
- Kauj Ruam 4: Kauj Ruam Kawg
Video: WiFi Pab Kom Kub Kub Tswj Ntse Ntse: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Hauv cov lus qhia teeb tsa no peb yuav saib seb yuav tsim WiFi li cas ntsuas kub ntsuas nrog siv ESP8266 yooj yim rau kev nqa hnyav thiab DHT11 ntsuas kub/av noo. Peb tseem yuav siv lub rooj sib tham hauv Circuit Court uas kuv tau tsim thiab tseem muag tam sim no hauv cov khw tindie channel yog tias koj xav yuav.
Cia peb pib nrog daim nqi ntawm cov ntaub ntawv koj yuav xav tau:
ESP8266 WiFi Module
amzn.to/2pkGPoa
DHT11 Sensor
amzn.to/2phwfhO
TP-Txuas Ntse Plug
amzn.to/2GElQUz
Koj tseem tuaj yeem nqa tag nrho cov qauv ntawm tindie khw rau cov channel:
www.tindie.com/products/misperry/wifi-enab…
Kuj txheeb xyuas JLCPCB rau PCB Fabriction. Lawv yog cov uas kuv tau siv los ua PCB:
Kev Thauj Khoom Dawb ntawm Thawj xaj & $ 2 PCB Prototyping ntawm
Kauj Ruam 1: Ntxiv Txoj Cai rau ESP8266
Tam sim no peb yuav tsum tau nyem cov cai hauv qab no mus rau ESP8266. Cov lej no tuaj yeem pom ntawm cov chaw khaws khoom hauv qab no github:
Hauv cov cai hauv qab no koj tsuas yog yuav tsum teeb tsa ob peb nqe lus txhais saum toj no:
MQTT neeg rau zaub mov:
Tus neeg siv MQTT:
MQTT Lo lus zais:
MQTT_sensor_topic:
-WiFi
Hais tias: qhov hais ntawm wifi network koj txuas rau
Lo lus zais: tus password WiFi.
Thaum koj tau ua tiav qhov no hauv kab lus hauv qab no koj tuaj yeem suav sau thiab tshuaj xyuas qhov ua yuam kev thiab yog 0 qhov yuam kev koj tuaj yeem nyem nws mus rau ESP8266.
/ * * Cov Ntaub Ntawv Lub Npe: TempHumSensor.ino * * Daim Ntawv Thov: HomeAssistant Space Rhaub Thermostat * * Nqe lus piav qhia: Tus lej no yog rau ESP8266 WiFi qhib siv arduino * ntaus ntawv tau tshaj. Qhov no yuav xa cov ntaub ntawv ntsuas kub * ntawm DHT11 lub cuab yeej mus rau HASS lub ntsej muag rau kev ua. * * Tus Sau: M. Sperry - https://www.youtube.com/misperry * Hnub tim: 03/ * Kho dua tshiab: 1.0 * * */
#suav nrog
#include #include #include #include #include
#define CON_TIME_OUT 20 // Sijhawm tsis txuas nrog wifi
#define MQTT_TIME_OUT 10 // Sijhawm tsis txuas nrog MQTT server
#define DHTPIN 0 // Pin uas txuas nrog DHT sensor
#define DHTTYPE DHT11 // Hom sensor yog DHT11, koj tuaj yeem hloov nws mus rau DHT22 (AM2302), DHT21 (AM2301)
#define mqtt_server "" // Sau koj li MQTT server ntxiv lossis IP. Kuv siv kuv qhov chaw nyob DuckDNS (yourname.duckdns.org) hauv daim teb no
#define mqtt_user "" // nkag mus rau koj lub npe MQTT #define mqtt_password "" // sau koj tus password #define MQTT_SENSOR_TOPIC "ha/bedroom_temp" // Nkag mus rau lub ncauj lus rau koj MQTT
// Wifi: SSID thiab tus password
const char* ssid = ""; const char* lo lus zais = "";
// DHT Kev teeb tsa
DHT_Unified dht (DHTPIN, DHTTYPE); uint32_t ncua MS;
WiFiClient wifiClient;
PubSubClient tus neeg siv khoom (wifiClient);
// ua haujlwm hu ua tshaj tawm qhov kub thiab txias
void publishData (ntab p_temperature) {// tsim JSON object // doc: https://github.com/bblanchon/ArduinoJson/wiki/API%20Reference StaticJsonBuffer jsonBuffer; JsonObject & hauv paus = jsonBuffer.createObject (); // INFO: cov ntaub ntawv yuav tsum hloov pauv mus rau hauv txoj hlua; teeb meem tshwm sim thaum siv ntab… // hloov mus rau fahrenheit p_temperature = (p_temperature * 1.8) + 32; // hloov mus rau fahrenheit paus ["kub"] = (Txoj hlua) p_temperature; root.prettyPrintTo (Serial); Serial.println ("");
cov ntaub ntawv [200];
root.printTo (cov ntaub ntawv, root.measureLength () + 1); client.publish (MQTT_SENSOR_TOPIC, cov ntaub ntawv, muaj tseeb); }
// muaj nuj nqi hu thaum MQTT lus tuaj txog
void callback (char* p_topic, byte* p_payload, unsigned int p_length) {}
void reconnect () {
// Loop kom txog thaum peb rov txuas dua thaum (! Client.connected ()) {Serial.print ("INFO: Sim MQTT kev txuas …") // Sim txuas mus yog (client.connect ("ESPBlindstl", mqtt_user, mqtt_password)) {Serial.println ("INFO: txuas"); } lwm {Serial.print ("ERROR: ua tsis tiav, rc ="); Serial.print (client.state ()); Serial.println ("DEBUG: sim dua hauv 5 vib nas this"); // Tos 5 vib nas this ua ntej ncua sijhawm ncua (5000); }}}
void teeb (tsis muaj dab tsi) {
Serial.begin (9600);
// Peb pib los ntawm kev txuas mus rau WiFi network
Serial.println (); Serial.println (); Serial.print ("Txuas rau"); Serial.println (ssid);
WiFi.begin (ssid, password);
thaum (WiFi.status ()! = WL_CONNECTED) {
ncua (800); Serial.print ("."); }
Serial.println ("");
Serial.println ("Txuas nrog WiFi"); Serial.println ("IP chaw nyob:"); Serial.println (WiFi.localIP ()); // pib MQTT kev sib txuas client.setServer (mqtt_server, 1883); client.setCallback (hu rov qab);
// Pib DHT sensor
dht.begin (); Serial.println ("DHT11 Unified Sensor Data");
// Sau cov ntsiab lus ntsuas kub
sensor_t sensor; dht.temperature (). getSensor (& sensor); Serial.println ("------------------------------------"); Serial.println ("Kub"); Serial.print ("Sensor:"); Serial.println (sensor.name); Serial.print ("Tsav Ver:"); Serial.println (sensor.version); Serial.print ("ID tshwj xeeb:"); Serial.println (sensor.sensor_id); Serial.print ("Tus nqi siab tshaj:"); Serial.print (sensor.max_value); Serial.println (" *C"); Serial.print ("Tus nqi qis:"); Serial.print (sensor.min_value); Serial.println (" *C"); Serial.print ("Kev daws teeb meem:"); Serial.print (sensor.resolution); Serial.println (" *C"); Serial.println ("------------------------------------"); // Sau cov ntsiab lus ntsuas cov av noo. dht.humidity (). getSensor (& sensor); Serial.println ("------------------------------------"); Serial.println ("Vaum"); Serial.print ("Sensor:"); Serial.println (sensor.name); Serial.print ("Tsav Ver:"); Serial.println (sensor.version); Serial.print ("ID tshwj xeeb:"); Serial.println (sensor.sensor_id); Serial.print ("Tus nqi siab tshaj:"); Serial.print (sensor.max_value); Serial.println ("%"); Serial.print ("Tus nqi qis:"); Serial.print (sensor.min_value); Serial.println ("%"); Serial.print ("Kev daws teeb meem:"); Serial.print (sensor.resolution); Serial.println ("%"); Serial.println ("------------------------------------");
// Teeb ncua ntawm kev nyeem ntawv sensor raws li cov ntsiab lus sensor
delayMS = sensor.min_delay / 1000; }
void loop (tsis muaj dab tsi) {
ntab kub;
yog (! client.connected ())
{rov txuas dua (); }
ncua (delayMS);
// Tau txais qhov xwm txheej kub thiab luam tawm nws tus nqi.
sensors_event_t kev tshwm sim; dht.temperature (). getEvent (& kev tshwm sim); yog (isnan (event.temperature)) {Serial.println ("Yuam kev ntsuas kub!"); kub = 0.00; } lwm qhov {kub = event.temperature; Serial.print ("Kub:"); Serial.print (kub); Serial.println (" *C"); } // tshaj tawm rau MQTT publishData (kub); }
Kauj Ruam 2: Teeb Koj Li TP-LINK Ntse Plug
Koj yuav tsum teeb tsa koj li TP-LINK ntse ntsaws, lossis ib qho ntse ntsaws rau lub mater ntawd, txoj hauv kev uas cov khw tsim khoom pom zoo.
Nco ntsoov sau tseg MAC chaw nyob ntawm lub cuab yeej. Yog tias koj lub cuab yeej zoo li kuv li TP-LINK ntaus ntawv koj tsis tuaj yeem nyob tus IP zoo li qub. Yog li, koj yuav tsum teeb tsa koj lub router rau DHCP Kev Zam Txim. Qhov no yuav siv MAC chaw nyob ntawm koj lub cuab yeej thiab thaum twg ntaus ntawv thov rau chaw nyob tus router yuav muab nws tib qhov chaw nyob txhua lub sijhawm.
Nov yog qhov txuas rau yuav teeb tsa qhov no li cas nrog Linksys
www.linksys.com/us/support-article?article…
Kauj Ruam 3: Teeb Tus Pab Tsev
Tam sim no teeb tsa Lub Tsev Pabcuam. Txog qhov no koj yuav xav tau ntxiv cov kev teeb tsa hauv qab no rau kev teeb tsa.yaml cov ntaub ntawv uas nyob hauv /home/homeassistant/.homeassistant cov qauv txheej txheem ntawm lub cuab yeej koj teeb nws rau.
Thaum ua tiav ntxiv qhov no rau koj tus pabcuam pabcuam hauv tsev koj yuav tsum tau rov pib dua koj lub tsev pabcuam software rau kev hloov pauv kom muaj kev cuam tshuam.
Tsis tas li kuv yuav siv TP-LINK ntse ntsaws lub zog hloov lub cuab yeej thiab lub ntsiab lus yog hauv qab no hauv cov ntawv teeb tsa. Tus IP chaw nyob uas tau siv rau lub cuab yeej yog qhov uas koj teeb tsa rau DHCP kev xaj hauv qib dhau los.
Kev teeb tsa no kuj tseem tuaj yeem pom ntawm cov github repo hauv qab no:
mqtt: hloov: - platform: tplink lub npe: Chav rhaub cua sov host: 192.168.2.11
sensor 1:
platform: mqtt state_topic: 'ha/bedroom_temp' lub npe: Chav pw Temp unit_of_measurement: '° F' value_template: '{{value_json.temperature}}'
kev siv tshuab:
- alias: _Temp chav pw Temp Siab txhais: - platform: numeric_state entity_id: sensor. Bedroom_Temp saum toj no: 73
nqis tes ua:
kev pab: homeassistant.turn_off entity_id: switch. Bedroom_Heater
- alias: _Temp chav pw Temp qis
txhais: - platform: numeric_state entity_id: sensor. Bedroom_Temp hauv qab no: 73 nqis tes ua: kev pabcuam: homeassistant.turn_on entity_id: switch. Bedroom_Heater
Kauj Ruam 4: Kauj Ruam Kawg
Tam sim no nrog koj tus pabcuam hauv tsev teeb tsa thiab koj tus lej Arduino teeb tsa koj yuav npaj txhij los qhib tag nrho cov kab ke. Yog li, tso koj lub rhaub dej/kiv cua/txias txias ntsaws rau hauv lub ntse ntsaws thiab ntsaws rau hauv lub ntsaws ntse. Thaum nws tau npaj tiav koj yuav xav tau ntsaws rau hauv lub USB them me me thiab tom qab ntawd WiFi qhib qhov ntsuas kub. Thaum txhua yam nyob online koj yuav tsum muaj peev xwm saib hauv koj lub tsev pabcuam dashboard thiab pom qhov ntsuas kub tshiab tau tshaj tawm.
Ua tsaug ntau ntau rau koj txhua tus pab txhawb nqa thiab. nco ntsoov tawm qhov nyiam thiab tuaj ntsib cov channel ntawm https://www.youbue.com/misperry thiab pom txhua yam peb muaj rau koj. Nco ntsoov tias koj sau npe yuav thiab qhia rau koj cov phooj ywg kom pab tawm cov channel.
Pom zoo:
Ua Koj Tus Kheej Txuas Cov Cua Kub Kub thiab Txuag Nrog Cua Kub: 53 Cov Kauj Ruam (nrog Duab)
Ua Koj Tus Kheej Txuas Cov Cua Kub Kub thiab Txuag Nrog Cua Kub: Lub hom phiaj yog dab tsi? Ua kom yooj yim dua los ntawm kev ua kom sov koj lub tsev raws nraim qhov koj xav Ua kom txuag nyiaj thiab txo cov pa roj carbon tsev tso cua sov los ntawm cua sov koj lub tsev tsuas yog thaum koj xav tau Kev tswj hwm koj cov cua sov nyob txhua qhov chaw koj zoo siab koj tau ua nws y
AI Pab Qhov Muag (Lub Khoos Phis Tawj Pom Kev Pom Kom Nco Qab Cov Neeg Ua Haujlwm kom Tsom iav Kev Nyab Xeeb): 4 Cov Kauj Ruam
AI Pab Qhov Muag (Lub Koob Yees Duab Lub Koob Yees Duab kom ceeb toom rau cov neeg ua haujlwm kom hnav tsom iav kev nyab xeeb): Nov yog qhov ua piv txwv ntawm lub kaw lus. Thaum lub kaw lus pom tias tau khaws cov laum, nws yuav txiav tawm qhov ceeb toom tsom iav kev nyab xeeb. Txhawm rau sawv cev rau qhov muaj kev ceeb toom tsom iav kev nyab xeeb, ciam teb ntawm RGB duab yog xim liab hauv qhov kev nthuav qhia v
ESP8266 RGB LED Sawb WIFI Tswj - NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi - RGB LED Sawb Smartphone Tswj: 4 Cov Kauj Ruam
ESP8266 RGB LED Sawb WIFI Tswj | NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi | RGB LED Sawb Smartphone Tswj: Nyob zoo cov neeg hauv qhov kev qhia no peb yuav kawm paub siv nodemcu lossis esp8266 li IR chaw taws teeb los tswj RGB LED sawb thiab Nodemcu yuav raug tswj los ntawm smartphone dhau wifi. Yog li hauv paus koj tuaj yeem tswj RGB LED Sawb nrog koj lub xov tooj
ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 - Saib Xyuas Qhov Kub Kub & Qhov Kub Kub ntawm M5stick-C Nrog DHT11: 6 Cov Kauj Ruam
ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 | Saib Xyuas Qhov Kub thiab Qhov Ntsuas Kub ntawm M5stick-C Nrog DHT11: Nyob zoo cov neeg, hauv cov lus qhia no peb yuav kawm paub yuav ua li cas cuam tshuam DHT11 ntsuas kub nrog m5stick-C (pawg tswj hwm kev txhim kho los ntawm m5stack) thiab tso tawm ntawm cov zaub ntawm m5stick-C. Yog li hauv qhov kev qhia no peb yuav nyeem qhov ntsuas kub, av noo & heat kuv
ESP32 NTP Kev Ntsuas Kub Ua Haujlwm Kub Kub Nrog Steinhart-Hart Kho thiab Tswb Kub: 7 Kauj Ruam (nrog Duab)
ESP32 NTP Kev Ntsuas Kub Ua Haujlwm Ntsuas Kub nrog Steinhart-Hart Kev Kho thiab Tswb Kub: Tseem tab tom taug kev kom ua tiav "qhov haujlwm yuav los tom ntej", "ESP32 NTP Kev Ntsuas Kub Kev Ntsuas Kub Ua Noj Nrog Steinhart-Hart Kev Kho thiab Tswb Kub" yog Cov Ntawv Qhia qhia yuav ua li cas kuv ntxiv NTP ntsuas kub, piezo b