Components and supplies
Slide Switch
Resistor 1k ohm
Wemos D1 Mini
Buzzer, Piezo
LED (generic)
Temperature Sensor
Rechargeable Battery, Lithium Ion
Apps and platforms
Arduino IDE
Project description
Code
Pango band code
c_cpp
1#include <ESP8266WiFi.h> //includes wifi modules library 2#include <Scheduler.h> 3const char* APssid = "Pango band"; //the acess point credintails of the device 4const char* APpassword = "life or death"; 5const int RSSI_MAX =-71;// maximum strength of signal in dBm 6const int RSSI_MIN =-74;// minimum strength of signal in dBm 7int LM35=A0; 8#define LED1 D0 9#define LED2 D1 10#define buz D2 11void setup() 12{ 13pinMode(LED2,OUTPUT); 14pinMode(LED1,OUTPUT); 15pinMode(buz,OUTPUT); 16WiFi.disconnect(); 17delay(100); //this part turns off the wifi and resets it if it was already on 18Serial.begin(115200); 19WiFi.mode(WIFI_OFF); 20Serial.println(); 21WiFi.mode(WIFI_AP_STA); //configuring the board in hybrid mode 22Serial.print("Configuring access point..."); 23WiFi.softAP(APssid, APpassword); 24Serial.println(WiFi.softAPIP()); 25Scheduler.startLoop(loop2); 26} 27void loop() 28{ 29Serial.println("Wifi scan started"); 30int n = WiFi.scanNetworks(); //assigns the scanned value to n 31Serial.println("Wifi scan ended"); 32if (n == 0) 33{ 34Serial.println("no networks found"); 35} 36else 37{ 38Serial.print(n); 39Serial.println(" networks found"); 40for (int i = 0; i < n; ++i) { 41// Print SSID and RSSI for each network found 42Serial.print(i + 1); 43Serial.print(") "); 44Serial.print(WiFi.SSID(i));// SSID 45Serial.print(WiFi.RSSI(i));//Signal strength in dBm 46Serial.print("dBm ("); 47if(WiFi.SSID(i) == "Pango band") 48{ 49if(WiFi.RSSI(i) > -71 )//THIS -71 is the key this is the threshold value btw this value is set according to the distance of 1m 50{ 51int i=1; 52for(i=1;i<=10;i++) 53{ 54digitalWrite(LED2,HIGH); 55delay(1000); 56digitalWrite(LED2,LOW); 57delay(1000); 58} 59Serial.println("A BAND WAS FOUND") 60break; 61} 62} 63else 64{ 65digitalWrite(LED2,LOW); 66} 67} 68delay(100); 69} 70Serial.println(""); 71delay(100); 72int analogValue = analogRead(LM35); 73float millivolts = (analogValue/1024.0) * 3300; //3300 is the voltage provided by NodeMCU 74float celsius = millivolts/10; 75Serial.print("Temp in celsius= "); 76Serial.println(celsius); 77if(celsius>37) 78{ 79digitalWrite(LED1,HIGH); 80Serial.println("led on"); 81delay(1000); 82} 83else 84{ 85digitalWrite(LED1,LOW); 86Serial.println("led off"); 87} 88} 89void loop2() 90{ 91tone(buz,1000); //send 1khz sound signal 92delay(3000); 93noTone(buz); //no sound 94delay(18000000); 95} 96
Pango band code
c_cpp
1#include <ESP8266WiFi.h> //includes wifi modules library 2#include <Scheduler.h> 3const char* APssid = "Pango band"; //the acess point credintails of the device 4const char* APpassword = "life or death"; 5const int RSSI_MAX =-71;// maximum strength of signal in dBm 6const int RSSI_MIN =-74;// minimum strength of signal in dBm 7int LM35=A0; 8#define LED1 D0 9#define LED2 D1 10#define buz D2 11void setup() 12{ 13pinMode(LED2,OUTPUT); 14pinMode(LED1,OUTPUT); 15pinMode(buz,OUTPUT); 16WiFi.disconnect(); 17delay(100); //this part turns off the wifi and resets it if it was already on 18Serial.begin(115200); 19WiFi.mode(WIFI_OFF); 20Serial.println(); 21WiFi.mode(WIFI_AP_STA); //configuring the board in hybrid mode 22Serial.print("Configuring access point..."); 23WiFi.softAP(APssid, APpassword); 24Serial.println(WiFi.softAPIP()); 25Scheduler.startLoop(loop2); 26} 27void loop() 28{ 29Serial.println("Wifi scan started"); 30int n = WiFi.scanNetworks(); //assigns the scanned value to n 31Serial.println("Wifi scan ended"); 32if (n == 0) 33{ 34Serial.println("no networks found"); 35} 36else 37{ 38Serial.print(n); 39Serial.println(" networks found"); 40for (int i = 0; i < n; ++i) { 41// Print SSID and RSSI for each network found 42Serial.print(i + 1); 43Serial.print(") "); 44Serial.print(WiFi.SSID(i));// SSID 45Serial.print(WiFi.RSSI(i));//Signal strength in dBm 46Serial.print("dBm ("); 47if(WiFi.SSID(i) == "Pango band") 48{ 49if(WiFi.RSSI(i) > -71 )//THIS -71 is the key this is the threshold value btw this value is set according to the distance of 1m 50{ 51int i=1; 52for(i=1;i<=10;i++) 53{ 54digitalWrite(LED2,HIGH); 55delay(1000); 56digitalWrite(LED2,LOW); 57delay(1000); 58} 59Serial.println("A BAND WAS FOUND") 60break; 61} 62} 63else 64{ 65digitalWrite(LED2,LOW); 66} 67} 68delay(100); 69} 70Serial.println(""); 71delay(100); 72int analogValue = analogRead(LM35); 73float millivolts = (analogValue/1024.0) * 3300; //3300 is the voltage provided by NodeMCU 74float celsius = millivolts/10; 75Serial.print("Temp in celsius= "); 76Serial.println(celsius); 77if(celsius>37) 78{ 79digitalWrite(LED1,HIGH); 80Serial.println("led on"); 81delay(1000); 82} 83else 84{ 85digitalWrite(LED1,LOW); 86Serial.println("led off"); 87} 88} 89void loop2() 90{ 91tone(buz,1000); //send 1khz sound signal 92delay(3000); 93noTone(buz); //no sound 94delay(18000000); 95} 96
Downloadable files
Image
Its the circuit diagram of our project
Image
Comments
Only logged in users can leave comments