top of page
Sensorflow
K6a4aIRll5uIFCyEE
Product Dashboard
Product Name
Sensorflow DHT11
Product Type
Hardware
Product ID
kqp4hNFnliJVgq9J
Product Info
Heading 5
Properties/ Schema
Check
Product Firmware
Your content has been submitted
An error occurred. Try again later
Production
Device Name
User ID
Lastseen
Sensorflow DHT11 Saffron
Fri Apr 05 2024 04:13 PM
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
Sensorflow DHT11
kqp4hNFnliJVgq9J
#include //----read and write RAM
#include "BluetoothSerial.h" //----BT Recive data about setup config
#include
#include
#include
#include
#include
#include
BluetoothSerial SerialBT;
Preferences preferences;
#define DHTPIN 4
#define buzz 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
const int lcdColumns = 16;
const int lcdRows = 2;
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);
String NAME = "
";
String header;
String apikey;
String userid;
String deviceid;
String ssid;
String pass;
String TEMP;
String HUMIDITY;
HYPERWISOR_IOT Hyperwisorsensor;
int restartcpount = 0;
int E_delay;
char buffer[10];
float temperature = 0.0;
float humidity = 0.0;
void setup() {
esp_task_wdt_init(10, true); // Set the watchdog timer to 10 seconds
Serial.begin(115200);
// Disable sleep modes
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_ON);
delay(500);
Wire.begin();
pinMode(buzz, OUTPUT);
dht.begin();
delay(500);
// Initialize the LCD
lcd.begin(lcdColumns, lcdRows);
// initialize LCD
lcd.init();
//delayTime = 1000;
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Sensorflow");
lcd.setCursor(0, 1);
lcd.print("Humidity & Temp");
delay(3000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("--Powered by");
lcd.setCursor(0, 1);
lcd.print("NIKOLAINDUSTRY");
delay(3000);
Serial.println();
// sensors.begin();
delay(500);
preferences.begin("my-app", false);
delay(500);
apikey = preferences.getString("apikey");
userid = preferences.getString("userid");
deviceid = preferences.getString("deviceid");
ssid = preferences.getString("ssid");
pass = preferences.getString("pass");
Hyperwisorsensor.init(apikey);
delay(500);
WiFi.disconnect();
delay(50);
Serial.println("connecting...");
WiFi.setHostname(NAME.c_str());
WiFi.begin(ssid.c_str(), pass.c_str());
delay(240000);
Serial.println("connected to");
Serial.println(ssid);
Serial.println(pass);
Serial.println(WiFi.localIP());
digitalWrite(buzz, HIGH);
delay(2000);
digitalWrite(buzz, LOW);
lcd.clear();
delay(100);
}
void loop() {
esp_task_wdt_reset(); // Reset the watchdog timer
if ((WiFi.status() == WL_CONNECTED)) {
showvalue();
String mysensordata = ("&HUMIDITY=" + String(humidity) + "&AIRTEMPERATURE=" + String(temperature));
String jsonobj = Hyperwisorsensor.sendData(mysensordata);
Serial.print(jsonobj);
String response = Hyperwisorsensor.get_schema();
String delayvalue = Hyperwisorsensor.extractor(response, "delay");
int delayint = delayvalue.toInt();
Serial.println("getschema");
Serial.println(response);
Serial.println("send data");
Serial.println(jsonobj);
Serial.println("extractor delay");
Serial.println(delayint);
digitalWrite(buzz, LOW);
delay(delayint);
} else {
showvalue();
restartcpount++;
if (restartcpount == 250) {
ESP.restart();
}
startBT();
digitalWrite(buzz, HIGH);
}
}
void startBT() {
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
SerialBT.begin(NAME.c_str());
if (SerialBT.available()) {
String btdata = SerialBT.readString();
Serial.println(btdata);
StaticJsonDocument jsonDoc;
DeserializationError error = deserializeJson(jsonDoc, btdata);
if (error) {
Serial.print("deserializeJson() failed: ");
Serial.println(error.c_str());
return;
}
String datatype = jsonDoc["Datatype"];
if (datatype == "wifiupdate") {
String Nssid = jsonDoc["ssid"];
String Npass = jsonDoc["pass"];
preferences.putString("ssid", Nssid);
preferences.putString("pass", Npass);
Serial.println("wifiinfoupdated");
digitalWrite(buzz, HIGH);
delay(5000);
digitalWrite(buzz, LOW);
delay(10);
ESP.restart();
} else if (datatype == "wifiinfo") {
Serial.println("datatype = wifiinfo");
String apikey = jsonDoc["apikey"];
String userid = jsonDoc["userid"];
String deviceid = jsonDoc["deviceid"];
String ssid = jsonDoc["ssid"];
String pass = jsonDoc["pass"];
if (ssid.length() > 0 && pass.length() > 0 && apikey.length() > 0) {
preferences.putString("apikey", apikey);
preferences.putString("userid", userid);
preferences.putString("deviceid", deviceid);
preferences.putString("ssid", ssid);
preferences.putString("pass", pass);
Serial.println(apikey);
Serial.println(userid);
Serial.println(ssid);
Serial.println(pass);
digitalWrite(buzz, HIGH);
delay(2000);
digitalWrite(buzz, LOW);
delay(1000);
digitalWrite(buzz, HIGH);
delay(2000);
digitalWrite(buzz, LOW);
delay(1000);
ESP.restart();
}
}
}
}
void showvalue() {
temperature = dht.readTemperature();
humidity = dht.readHumidity();
delay(500);
Serial.print("Temperature dht: ");
Serial.print(temperature);
Serial.print(" °C, Humidity dht: ");
Serial.print(humidity);
Serial.println("%");
delay(500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Humidity");
lcd.setCursor(0, 1);
lcd.print(String(humidity) + " %");
lcd.setCursor(9, 0);
lcd.print("Temp");
lcd.setCursor(9, 1);
lcd.print(String(temperature) + " C");
}
Collapsible text is great for longer section titles and descriptions. It gives people access to all the info they need, while keeping your layout clean. Link your text to anything, or set your text box to expand on click. Write your text here...
bottom of page