Chat freely about anything...

User avatar
By WStan
#23904
WStan wrote:
wififofum wrote:
wififofum wrote:Use requestTemperaturesByAddress instead.

Have you tried this?

Not yet but I'll try soon
Sorry for the long silence.

wififofum You are great! :D
It is working with 7 DS18B20 sensors in Parasite Power Mode on ESP8266-01 module and 1k pull up resistor (recommended for ESP 3.3 V):
on about 40m line. See:
Code: Select allTester:26.44 TOutSouth:42.88 TOutNorth:32.69 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:0
Tester:26.44 TOutSouth:42.88 TOutNorth:32.69 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:1
Tester:26.44 TOutSouth:42.88 TOutNorth:32.69 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:2
Tester:26.44 TOutSouth:42.88 TOutNorth:32.69 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:3
Tester:26.44 TOutSouth:42.88 TOutNorth:32.69 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:4
Tester:26.44 TOutSouth:42.88 TOutNorth:32.50 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:5
Tester:26.44 TOutSouth:42.88 TOutNorth:32.50 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:6
Tester:26.44 TOutSouth:42.88 TOutNorth:32.50 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:7
Tester:26.44 TOutSouth:42.88 TOutNorth:32.50 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:8
Tester:26.44 TOutSouth:42.63 TOutNorth:32.50 TInFF:29.87 TInGFMRoom:26.31 THPIn:24.62 THPOut:24.81  Count:9


Thank You
User avatar
By WStan
#23956
wififofum wrote:Nice! Are you posting your code anywhere in case someone else needs it?

Of Course

Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

#include <OneWire.h>
//-------------------------------------------------------------------------------
/*
 DallasTemperature::requestTemperaturesByAddress doesn't work in parasite power mode then DallasTemperature.h download from:
 https://github.com/pezinek/Arduino-Temperature-Control-Library/tree/45b1236c9e8227e0c95961b1a5fe6e8b5953bd7e
 where the requestTemperaturesByAddress are fixed to work
*/
#include <DallasTemperature.h> 
//--------------------------------------------------------------------------------
#define ONE_WIRE_BUS 2  // DS18B20 pin GPIO 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

DeviceAddress AddressTInGFS   ={ 0x28, 0x49, 0x6D, 0x5C, 0x04, 0x00, 0x00, 0x54 };
DeviceAddress AddressTHPIn    ={ 0x28, 0xE2, 0xA3, 0x5C, 0x04, 0x00, 0x00, 0x70 };
DeviceAddress AddressTHPOut   ={ 0x28, 0x2A, 0x9E, 0x60, 0x03, 0x00, 0x00, 0x06 };
DeviceAddress AddressTOutSouth={ 0x28, 0xC4, 0xD4, 0xB7, 0x02, 0x00, 0x00, 0x44 };
DeviceAddress AddressTOutNorth={ 0x28, 0xE5, 0x29, 0x72, 0x02, 0x00, 0x00, 0x37 };
DeviceAddress AddressTInGFMR  ={ 0x28, 0x63, 0x04, 0x61, 0x03, 0x00, 0x00, 0x60 };
DeviceAddress AddressTInFFS   ={ 0x28, 0x7F, 0xE4, 0xB7, 0x02, 0x00, 0x00, 0x3F };
 
const char* ssid = "@HomeCA72";
const char* password = "";
MDNSResponder mdns;
ESP8266WebServer server(91);//<---------------------------------------------------
//const int led = 13;
char T0S[12];char T1S[12];char T2S[12];char T3S[12];char T4S[12];char T5S[12];char T6S[12];char T7S[12];char T8S[12];char T9S[12];char T10S[12];
float Te, THPIn, THPOut,TOutSouth,TInGFMR,TInFFS,TOutNorth,T5,T6,TInGFS,T4;

int Sec=0;
float TOutSouthMin=100;
float TOutSouthMax=-100;
float TOutNorthMin=100;
float TOutNorthMax=-100;
float WorkTime=0;
char WorkTimeS[12];

  long t = 0;
  word h = 0;
  byte m = 0;
//  byte s = 0;

int Count=0;

void handleRoot() {
 
dtostrf(TOutSouth, 6, 2, T0S);
dtostrf(TOutNorth, 6, 2, T1S);
dtostrf(TInGFS, 6, 2, T2S);
dtostrf(TInGFMR, 6, 2, T3S);
dtostrf(TInFFS, 6, 2, T4S);
dtostrf(THPIn, 6, 2, T5S);
dtostrf(THPOut, 6, 2, T6S);
dtostrf(WorkTime, 6, 2, WorkTimeS);
dtostrf(TOutSouthMin, 6, 2, T7S);
dtostrf(TOutSouthMax, 6, 2, T8S);
dtostrf(TOutNorthMin, 6, 2, T9S);
dtostrf(TOutNorthMax, 6, 2, T10S);

String stri= "ESP8266-01 No"+String(1)+" TOutSouth: "+T0S +" TOutNorth: "+ T1S  +" TInGFS: "+ T2S +
" TInGFMR: "+ T3S +" TInFFS: "+ T4S  +" THPIn: "+ T5S + " THPOut: "+ T6S + " TOutSouthMin: " + T7S +
" TOutSouthMax: " + T8S + " TOutNorthMin: " + T9S + " TOutNorthMax: " + T10S +" WorkTime="+WorkTimeS+"h";

server.send(200, "text/plain", stri);

}

void handleNotFound(){
//  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
  message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}
 
void setup(void){
   Serial.begin(115200);
   DS18B20.begin();

  WiFi.begin(ssid, password);
  //-------------------------------------------------------------------------------------------
  WiFi.config(IPAddress(192,168,24,118), IPAddress(192,168,24,10), IPAddress(255,255,255,0));
  //-------------------------------------------------------------------------------------------
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");

  }

  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
 
  if (mdns.begin("esp8266", WiFi.localIP())) {
    Serial.println("MDNS responder started");
  }
 
  server.on("/", handleRoot);
  server.on("/inline", [](){
  server.send(200, "text/plain", "Info 7 DS18B20 in Parasite Mode on ESP8266-01 ");
  });

  server.onNotFound(handleNotFound);
 
  server.begin();
  Serial.println("HTTP server started");
}
//---------------- LOOP -------------------------
void loop(void){
 float Te;
    WorkTime = millis() / 1000; 
    WorkTime= WorkTime/3600;
 t = millis() / 1000;
 h = t / 3600;
 m = (t / 60) % 60;
// s = t % 60;
 
Count++;
   
if (Count==1)  {
  DS18B20.requestTemperaturesByAddress(AddressTOutSouth);Te=DS18B20.getTempC(AddressTOutSouth); TOutSouth= Te;
  if (TOutSouth>TOutSouthMax)TOutSouthMax=TOutSouth;
  if (TOutSouth<TOutSouthMin)TOutSouthMin=TOutSouth;
  }
if (Count==2)  {
  DS18B20.requestTemperaturesByAddress(AddressTOutNorth);Te=DS18B20.getTempC(AddressTOutNorth);  TOutNorth= Te;
  if (TOutNorth>TOutNorthMax)TOutNorthMax=TOutNorth;
  if (TOutNorth<TOutNorthMin)TOutNorthMin=TOutNorth;
  }


if (Count==3) { DS18B20.requestTemperaturesByAddress(AddressTInGFS);Te=DS18B20.getTempC(AddressTInGFS);         TInGFS= Te;}
if (Count==4) { DS18B20.requestTemperaturesByAddress(AddressTInGFMR);Te=DS18B20.getTempC(AddressTInGFMR);      TInGFMR= Te;}
if (Count==5) { DS18B20.requestTemperaturesByAddress(AddressTInFFS);Te=DS18B20.getTempC(AddressTInFFS);         TInFFS= Te;}

if (Count==6) { DS18B20.requestTemperaturesByAddress(AddressTHPIn);Te=DS18B20.getTempC(AddressTHPIn);          THPIn = Te;}
if (Count==7) { DS18B20.requestTemperaturesByAddress(AddressTHPOut);Te=DS18B20.getTempC(AddressTHPOut);        THPOut= Te;}

if (Count==10)Count=0;
 
    Serial.print("TOutSouth:"); Serial.print(TOutSouth);Serial.print(" ");
    Serial.print("TOutNorth:"); Serial.print(TOutNorth);Serial.print(" ");
   
    Serial.print("TInGFS:"); Serial.print(TInGFS);Serial.print(" ");
    Serial.print("TInGFMRoom:"); Serial.print(TInGFMR);Serial.print(" ");
    Serial.print("TInFFS:"); Serial.print(TInFFS);Serial.print(" ");
   
    Serial.print("THPIn:"); Serial.print(THPIn);Serial.print(" ");
    Serial.print("THPOut:"); Serial.print(THPOut);Serial.print(" ");
 
    Serial.print(" Count:");
    Serial.println(Count);

    server.handleClient();
    delay(1000);
   
}

And here you can see it working: http://silesia-eco.ue.wroc.pl/Home/EcoHCentralH