loading...
Bisanya
ketika duduk di kamar atau ruang tamu perubahan suhu yang terjadi terasa begitu
aneh. Sebenarnya berapa sih suhu rungan dalam kamar tersbut? Hal ini yang
membuat saya terdorong untuk membuat alat yang dapat memonitoring suhu ruangan
dengan menggunakan thisngspeak.
Apa
sih kompen-komponen yang saya gunakan untuk membuat projek ini ??
Disini
saya akan menggunakan DHT11 untuk merasakan kelembaban, BMP180 untuk merasakan
suhu dan tekanan dan Resistor Pengendalian Cahaya (LDR) untuk mendapatkan
gambaran kasar tentang intensitas cahaya. Arduino nano akan mengumpulkan data
dari sensor ini dan mengirim ke ESP8266 untuk mengunggahnya ke saluran pribadi
Anda di thingspeak.com. Kami akan menyalakan Arduino nano kami dari adaptor
dinding 12V-2A, sensor dan ESP8266 akan menerima tegangan yang diubah dari
LM2596 berdasarkan buck converter.
Daftar
komponen:
BMP180
tekanan dan sensor suhu,
Sensor
kelembaban DHT11,
Resistor
Penggantungan Cahaya (LDR),
Modul
wifi ESP8266 (firmware siap),
Arduino
nano,
2
Resistor - 51 KOhm dan 4,7 KOhm,
LM2596
buck converter,
Jack
DC,
ganti dengan
Adaptor
dinding 12V-2A.
Untuk
melihat nilai data sensor, kita memerlukan saluran pribadi di thingspeak.com.
Kami akan membutuhkan Arduino IDE untuk menulis kode Arduino untuk arduino
nano. (Saya berasumsi bahwa Anda memiliki PC / laptop dan rute wifi dengan
akses ke internet)
Daftar
persyaratan perangkat lunak:
Saluran
pribadi di Thingspeak.com dan
Arduino
IDE (Lebih disukai versi terbaru).
Anda
dapat mengunduh versi terbaru Arduino IDE dari arduino.cc. Sekarang mari buat
saluran pribadi di thingspeak.com.
Untuk
membuat saluran pribadi di thingspeak.com ikuti langkah-langkah berikut:
Buka
browser web Anda dan buka thingspeak.com dan klik tab 'Sign Up' di pojok kanan
atas, (Gambar no.1)
Isi
detailnya dan klik 'Buat akun', (Gambar no.2)
Sekarang
klik pada tab 'Saluran Baru', (Gambar no.3)
Sekali
lagi isi rincian untuk saluran dan aktifkan 4 bidang (karena kami akan
mengirimkan 4 nilai sensor), gulir ke bawah dan klik tab 'Simpan Saluran',
(Gambar no.4 / 5)
Pada
halaman ini klik pada tab 'Kunci API' dan catat 'Tulis Kunci API' Anda.
Di
sini saya melampirkan gambar skema untuk Monitoring ini. Saya juga melampirkan
file fritzing untuk hal yang sama. Koneksi cukup sederhana.
BMP180
terhubung ke port I2C arduino nano.
LDR
terhubung dalam mode pembagi tegangan dengan 51 resistor KOhm dan persimpangan
menghubungkan ke pin A1 arduino nano.
Pin
data DHT11 ditarik tinggi dengan 4,7 resistor KOhm dan terhubung ke pin A0 dari
arduino nano.
TX
dan RX ESP8266 terhubung ke D10 dan D11 dari arduino nano. CH_PD ESP8266
terhubung ke rel 3.3V.
Sesuaikan
output modul LM2596 ke 3.3V dengan memutar potensiometer pada modul ini.
Hubungkan output modul ini ke Vcc dan Gnd dari BMP180, DHT11, LDR dan ESP8266's
Vcc dan Gnd masing-masing.
Masukan
modul LM2596 berasal dari adaptor dinding 12V-2A yang juga terhubung ke Vin dan
Gnd dari Arduino nano.
Gunakan
strip berg untuk penempatan Arduino nano dan ESP8288 pada GCB,
Gunakan
solder besi dan kawat solder untuk menghubungkan mereka secara elektrik ke
papan,
Gunakan
konektor perempuan untuk memperluas jangkauan semua sensor dan modul LM2596
karena akan menempel pada penutup dan dinding kandang,
Gunakan
strip berg untuk membuat titik penghubung untuk ekstensi wanita yang dibuat di
atas,
Mewujudkan
skema sirkuit pada GCB menggunakan kabel (strip mereka menggunakan stripper
kawat), atau rel kawat solder meleleh dan akhirnya,
Periksa
macam-macam sebelum menyalakan sirkuit menggunakan multimeter.
Kode
untuk Personal Weather Station cukup sederhana. Saya telah berkomentar kode
dengan benar untuk kemudahan portabilitas. Sebelum Anda membakar kode,
perhatikan hal-hal berikut.
Pastikan
semua pustaka diinstal,
Ganti
tanda hubung dengan SSID titik akses Anda (router wifi) di baris 14 dari kode,
Ganti
tanda hubung dengan PASSWORD jaringan wifi Anda di baris 15 kode,
Ganti
tanda hubung dengan saluran tertulis pribadi saluran ThingSpeak Anda di baris
17 dan
Sementara
pemrograman Arduino nano memastikan bahwa suplai DC 12V Anda OFF.
Berikut
ini tautan ke github (Personal Weather Station) untuk mengunduh kode dan
pustaka yang saya gunakan.
Sekarang
setelah perangkat keras dan lunak kami tersedia, hanya yang tersisa adalah
pengemasan.
Sekarang
kita perlu membuat lubang dengan berbagai bentuk dan ukuran pada kotak 4x4x2
inci. Kita perlu membuat lubang untuk jack DC dan mengaktifkan dinding
enclosure yang diinginkan. Kita juga perlu membuat lubang untuk sensor pada
tutup kandang.
Saya
telah melampirkan gambar yang menunjukkan dimensi lubang yang perlu kita buat
di kandang.
Masukkan
GCB Anda di dalam enklosur.
Tempatkan
saklar dan jack DC di lubang-lubang di dinding; sensor pada lubang tutupnya.
Selesaikan posisi mereka dan gunakan lem untuk memperbaikinya. Terakhir,
gunakan obeng untuk menutup penutupnya.
Di
sana Anda memilikinya, perangkat yang dapat mengukur cuaca pribasi. Hidupkan
catu daya dan lihat suhu ruangan Anda, kelembapan, tekanan dan intensitas
cahaya dari mana saja di dunia melalui smartphone / PC / Laptop / Tablet Anda
di saluran pribadi ThingSpeak Anda.
#include <SoftwareSerial.h> #include <Wire.h> #include <dht.h> #include <Adafruit_BMP085.h> #define DEBUG 0 // change value to 1 to enable debuging using serial monitor #define dht_pin A0 // defining pin A0 for DHT sensor #define lightSensor A1 // defining pin A1 as input pin for LDR voltage divider dht DHT; Adafruit_BMP085 bmp; SoftwareSerial esp8266Module(10, 11); // RX, TX String network = "----"; // your access point SSID String password = "-------------"; // your wifi Access Point password #define IP "184.106.153.149" // IP address of thingspeak.com String GET = "GET /update?key=----------------"; // replace with your channel key void setup() { if(DEBUG){ Serial.begin(9600); // Setting hardware serial baud rate to 9600 } esp8266Module.begin(9600); // Setting softserial baud rate to 9600 if (!bmp.begin()) { if(DEBUG){ Serial.println("Could not find a valid BMP085 sensor, check wiring!"); } while (1) {} } delay(2000); } void loop() { setupEsp8266(); DHT.read11(dht_pin); double humi = DHT.humidity; double bmp_temp = bmp.readTemperature(); double bmp_pressure = bmp.readPressure(); int lightIntensity = analogRead(lightSensor); updateTemp(String(bmp_temp) ,String(lightIntensity),String(bmp_pressure),String(humi)); delay(30000); } //------------------------------------------------------------------- // Following function setup the esp8266, put it in station made and // connect to wifi access point. //------------------------------------------------------------------ void setupEsp8266() { if(DEBUG){ Serial.println("Reseting esp8266"); } esp8266Module.flush(); esp8266Module.println(F("AT+RST")); delay(7000); if (esp8266Module.find("OK")) { if(DEBUG){ Serial.println("Found OK"); Serial.println("Changing espmode"); } esp8266Module.flush(); changingMode(); delay(5000); esp8266Module.flush(); connectToWiFi(); } else { if(DEBUG){ Serial.println("OK not found"); } } } //------------------------------------------------------------------- // Following function sets esp8266 to station mode //------------------------------------------------------------------- bool changingMode() { esp8266Module.println(F("AT+CWMODE=1")); if (esp8266Module.find("OK")) { if(DEBUG){ Serial.println("Mode changed"); } return true; } else if(esp8266Module.find("NO CHANGE")){ if(DEBUG){ Serial.println("Already in mode 1"); } return true; } else { if(DEBUG){ Serial.println("Error while changing mode"); } return false; } } //------------------------------------------------------------------- // Following function connects esp8266 to wifi access point //------------------------------------------------------------------- bool connectToWiFi() { if(DEBUG){ Serial.println("inside connectToWiFi"); } String cmd = F("AT+CWJAP=\""); cmd += network; cmd += F("\",\""); cmd += password; cmd += F("\""); esp8266Module.println(cmd); delay(15000); if (esp8266Module.find("OK")) { if(DEBUG){ Serial.println("Connected to Access Point"); } return true; } else { if(DEBUG){ Serial.println("Could not connect to Access Point"); } return false; } } //------------------------------------------------------------------- // Following function sends sensor data to thingspeak.com //------------------------------------------------------------------- void updateTemp(String voltage1,String voltage2,String voltage3,String voltage4) { String cmd = "AT+CIPSTART=\"TCP\",\""; cmd += IP; cmd += "\",80"; esp8266Module.println(cmd); delay(5000); if(esp8266Module.find("Error")){ if(DEBUG){ Serial.println("ERROR while SENDING"); } return; } cmd = GET + "&field1=" + voltage1 + "&field2=" + voltage2 + "&field3=" + voltage3 + "&field4=" + voltage4 + "\r\n"; esp8266Module.print("AT+CIPSEND="); esp8266Module.println(cmd.length()); delay(15000); if(esp8266Module.find(">")) { esp8266Module.print(cmd); if(DEBUG){ Serial.println("Data sent"); } }else { esp8266Module.println("AT+CIPCLOSE"); if(DEBUG){ Serial.println("Connection closed"); } } } Library and code for Personal Weather Station Check out Readme https://github.com/jayraj4021/Personal-Weather-Station-14 SCHEMATICS Fritzing Schematic Schematic1 .fzz file schematic.fzz COMMENTS Please log in or sign up to comment. Giuliano Pisoni Giuliano Pisoni 2 years ago Can I suggest a BME280 instead of DHT11 + BMP180 ? And if you use any kind of devboard with ESP8266 the Arduino and LM2956 are redundant. 2 thanks EMC_squared EMC_squared 2 years ago Hi, Thanks for the interesting share. I tried replicating this project; however, the only output I get on serial (in DEBUG mode) is : "OK not found"! Can you guess what might be wrong? Separately, the ESP seems to work, I can make send and receive data. Jayraj Desai Jayraj Desai 2 years ago Try burning ESP firmware that I used, you can download it from github repository. EMC_squared EMC_squared 2 years ago Thanks for your reply. Could you please direct to an instruction/guide for burning the firmware? It might not be significant, but as the default baud rate for this board is 115200, in line 25 of the code( esp8266Module.begin(9600); ) shouldn't we set baud rate to 115200? Jayraj Desai Jayraj Desai 2 years ago Check this out--- http://www.instructables.com/id/Intro-Esp-8266-firmware-update/step5/Using-esp-flash-download-toll-v0931/ or https://www.youtube.com/watch?v=Gh_pgqjfeQc PS- Use the firmware that I have uploaded to github. 1 thank Ricky Lee Ricky Lee 2 years ago I built a similar project with DHT11 and found the results were "noisy", in that they had a random error on them. I changed to DHT22 and got much steadier results. It is possible that my DHT11 was faulty... or the DHT22 is just a better device. Anyway, you can see some Australian weather here: https://thingspeak.com/channels/148770 1 thank arijit_ghosh arijit_ghosh 9 months ago Hi Ricky... Can you please upload the code for DHT 11 +ESP 8266-01 with Arduino Uno to be visible in thingspeak.com.. You can also mail me:arijitghosh@yahoo.com Thanks in anticipation arijit_ghosh arijit_ghosh 9 months ago Plz reply.. Ricky Lee Ricky Lee 9 months ago //Hi Arijit, code below... //RL 27.7.16 Running with DHT22 to Thingspeak //RL 7.5.17 Got a new BME280 sensor. #include <DHT.h> //https://github.com/adafruit/DHT-sensor-library #include <ESP8266WiFi.h> // replace with your channel’s thingspeak API key and your SSID and password String apiKey = "yourapiKey"; //https://thingspeak.com/channels/xxxxx/api_keys const char* ssid = "yourssid"; const char* password = "yourpassword"; const char* server = "api.thingspeak.com"; #define DHTPIN D5 #define DHTTYPE DHT22 DHT dht(DHTPIN, DHTTYPE); #include "Adafruit_Sensor.h" #include "Adafruit_BME280.h" #include "SSD1306.h" const float SEA_LEVEL_PRESSURE_HPA = 1013.25; const int DELAY = 3000; const int STARTUP_DELAY = 500; Adafruit_BME280 bme; WiFiClient client; void setup() { Serial.begin(115200); dht.begin(); delay(3000); if(!bme.begin()) {Serial.println("Could not find a valid BME280 sensor, check wiring!"); while (1) {yield();delay(3000);}} WiFi.begin(ssid, password); Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); } void loop() { Serial.print("Reading DHT"); float dhth = dht.readHumidity(); float dhtt = dht.readTemperature(); if (isnan(dhth) || isnan(dhtt)) {Serial.print(".");return;}Serial.println(); //read the BME float bmet = bme.readTemperature(); //temp C float bmeh = bme.readHumidity(); float bmep = bme.readPressure(); // pascals printToSerial(bmet, bmeh, bmep); //end read BME if (client.connect(server,80)) { String postStr = apiKey; postStr +="&field1="; postStr += String(dhtt); postStr +="&field2="; postStr += String(dhth); //field3 is dewpoint - calculated in thingspeak postStr +="&field4="; postStr += String(bmet); postStr +="&field5="; postStr += String(bmeh); postStr +="&field6="; postStr += String(bmep); postStr += "\r\n\r\n"; client.print("POST /update HTTP/1.1\n"); client.print("Host: api.thingspeak.com\n"); client.print("Connection: close\n"); client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n"); client.print("Content-Type: application/x-www-form-urlencoded\n"); client.print("Content-Length: "); client.print(postStr.length()); client.print("\n\n"); client.print(postStr); Serial.print("Temperature: "); Serial.print(dhtt); Serial.print(" degrees Celsius Humidity: "); Serial.println(dhth); Serial.println("Sending data to Thingspeak"); } client.stop(); Serial.println("Waiting 5 minutes for next upload..."); // thingspeak needs at least a 15 sec delay between updates // 20 seconds to be safe //delay(20000); delay(5601000-3); //make that 5 mins. } //end loop void printToSerial(float tempC, float humidity, float pressurePascals) { // Temperature float tempF = 9.0/5.0 * tempC + 32.0; Serial.println("Temperature:"); printValueAndUnits(tempC, "*C"); printValueAndUnits(tempF, "*F"); //printValueAndUnits(tempC, "°C"); //printValueAndUnits(tempF, "°F"); Serial.println(""); // Barometric pressure float pressureHectoPascals = pressurePascals / 100.0; float pressureInchesOfMercury = 0.000295299830714 * pressurePascals; Serial.println("Pressure:"); printValueAndUnits(pressurePascals, "Pa"); printValueAndUnits(pressureHectoPascals, "hPa"); printValueAndUnits(pressureInchesOfMercury, "inHg"); Serial.println(""); // Humidity Serial.println("Humidity:"); printValueAndUnits(humidity, "%"); Serial.println(""); // Approximate altitude float altitudeMeters = bme.readAltitude(SEA_LEVEL_PRESSURE_HPA); float altitudeFeet = 3.28 * altitudeMeters; Serial.println("Approx. Altitude:"); printValueAndUnits(altitudeMeters, "m"); printValueAndUnits(altitudeFeet, "ft"); Serial.println(); } void printValueAndUnits(float value, String units) { Serial.print(" "); Serial.print(value); Serial.print(" "); Serial.println(units); } 1 thank Mugiwara303 Mugiwara303 2 years ago i have connected the esp8266 directly to 3.3v of arduino, but it's not connected to my AP, the communication led is not blinking, how to fix this please?! Jayraj Desai Jayraj Desai 2 years ago I hope you have connected Vcc pin of ESP to atleast 1A supply. Can you enable the debug mode in the code by making #define DEBUG 0 to #define DEBUG 1 and look at the messages on serial terminal. This will give you some insight in the problem. Mugiwara303 Mugiwara303 2 years ago i did it but i don't know which baud to select to get info from esp, and one other thing is when i connect the CH_PD to 3.3v the red led of esp turns off! how to solve this please, thanks Jayraj Desai Jayraj Desai 2 years ago Try this; I have uploaded the esp firmware that I used for this project on github, Download this esp8266 firmware and flash it to esp8266 (it will default to baud rate of 9600). If you don't know how to flash the firmware, just google it there is plenty of help available. Regarding CH_PD pin, lets first flash the firmware, we will take a look at it later. PS: pin connections while flashing are different to when esp is in use, you will need a usb to serial converter to flash the firmware. Mugiwara303 Mugiwara303 2 years ago thank you for your fast reply 😃 about the CH_PD problem is caused by low power supply, when i tried different one it worked fine, and for flashing the esp8266 i don't have a usb to ttl device i have to buy it, is this one good? https://www.aliexpress.com/item/Free-shipping-New-6Pin-CP2102-Module-USB-2-0-To-TTL-On-STC-for-arduino-Pro/32335363234.html Jayraj Desai Jayraj Desai 2 years ago It looks good, but depending on your location aliexpress will result in different delivery time. Might even be in months. Try local vendors they will generally deliver early. Mugiwara303 Mugiwara303 2 years ago this take about a month to arrive, local vendors are few and they are selling it with really high price about five times or more! anyway i will do nothing until the item arrive 😄 Jayraj Desai Jayraj Desai a year ago First remove if (!bmp.begin()) { if(DEBUG){ Serial.println("Could not find a valid BMP085 sensor, check wiring!"); } while (1) {} } from setup() next Inside loop() there is a statement that reads temp form bmp. i.e. double bmp_temp = bmp.readTemperature(); replace it with DHT temp reading command it must be something similar to DHT.temperature. You will also have to remove bmp.readPressure(). Remove corresponding variables from updateTemp also. I think this should work, if not let me know. Enable debug and see what error you get in case it errors out 1 thank Mugiwara303 Mugiwara303 a year ago thank you, i have found a better setup for this project using only esp8266 and dht11 without arduino and it's working fine arijit_ghosh arijit_ghosh 9 months ago Hello Mr. Desai.. Can you please upload the code for DHT 11 +ESP 8266-01 with Arduino Uno to be visible in thingspeak.com.. You can also mail me:arijitghosh@yahoo.com Thanks in anticipation arijit_ghosh arijit_ghosh 9 months ago Hi... If I flash using XTCOM_UTIL will it cause any problem? It is using boot_v1.1.bin arijit_ghosh arijit_ghosh 9 months ago Plz reply.. PULKIT_SHARMA PULKIT_SHARMA a year ago guys i am making a similar type of project in which i am monitoring temperature through LM35 can any one help me in the coding that hoe to update my data on thingspeak channel. your help will be very helpful in my project...!! rd00 rd00 a year ago I keep getting this error but I can see it connecting to the wifi at the same time via my mobile hotspot, anyone have any clue why? inside connectToWiFi Could not connect to Access Point Standa Šebek Standa Šebek 10 months ago Hello Jayraj Desai. Now I have similar parts of your weather station, connected to each other via Arduino Nano on breadboard. I load a code which you have here and nothing happens. All pins I have connected right like on Fritzing schematic. I think that if I open a serial monitor in Arduino IDE something must show here but no. What can i do? Thanks fo response. Standa Šebek Standa Šebek 10 months ago Okey I have it. I must overwrite a number in esp8266Module.begin. You have in code 9600 but i must write here 115200 and it works... thanks for this idea. 1 thank dgncsk dgncsk 10 months ago is there a default sketch for nodemcu? i only want to use bme280. none of codes i foudn works with that. i can read local temp and pressure but unable to find a base code to work on to upload to wunderground etc. Jayraj Desai Jayraj Desai 9 months ago I am not sure vinod_chinthoti vinod_chinthoti 10 months ago Thanks for giving wonderful view to understand IOT projects sir, I have one Query , I want to receive Data from cloud using ESP8266. please help to how to do it? Thanks Vinod Jayraj Desai Jayraj Desai 9 months ago Well I don't know how to do that either. Sorry. Jaroslav Jaroslav 4 months ago How to make this project with ESP826 12-E? Thanks Jaro AUTHOR Maxresdefault Jayraj Desai 6 PROJECTS 38 FOLLOWERS PUBLISHED ON September 3, 2016 MEMBERS WHO RESPECT THIS PROJECT IronmanAdambenzDefaultMitovCemclellanDefaultBadassDefault and 67 others
loading...
Comments
Post a Comment