W5100 i DS18B20

Philip
Posts: 8
Joined: Sun Jan 21, 2024 8:10 pm

Post

Dobry wieczór,
Mam pytanie odnośnie czujników DS18B20 podłączonych do Arduino Mega z nakładką Ethernetową W5100. Docelowo chciałbym podłączyć więcej niż 20 czujników temperatury. Próbowałem zmieniać rozmiar tablicy adresów (wielkość 8) w klasie OneWireBus w bibliotece

Code: Select all

#include <supla/sensor/DS18B20.h>
oraz czas kolejnych wywołań w klasie DS18B20.
Niestety bezskutecznie. Po dodaniu Arduino do SuplaCloud z tak dużą liczbą czujników od razu połączenie internetowe się zrywa. Po kilku sekundach w przypadku kilkunastu czy kilkudziesięciu czujników oraz po kilku minutach w przypadku mniejszej ilości czujników.

Zamieszczam poniżej kod programu:

Code: Select all

#include <SuplaDevice.h>
// Add include to DS sensor
#include <supla/sensor/DS18B20.h>

#include <supla/io.h>
#include <supla/control/relay.h>
#include <supla/control/button.h>
#include <supla/sensor/binary.h>

#define STORAGE_OFFSET 100
#include <supla/storage/fram_spi.h>
Supla::FramSpi fram(52,50,51,53,STORAGE_OFFSET);



// Choose proper network interface for your card:
#ifdef ARDUINO_ARCH_AVR
  // Arduino Mega with EthernetShield W5100:
  #include <supla/network/ethernet_shield.h>
  // Ethernet MAC address
  uint8_t mac[6] = {0x04, 0x04, 0x05, 0x05 0x05, 0x05};
  Supla::EthernetShield ethernet(mac);

#endif


void setup() {

  Serial.begin(115200);

  // Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
  char GUID[SUPLA_GUID_SIZE] = {0xEA,0x45,0x04,0xD0,0xA8,0xB9,0x9E,0x95,0xCE,0xE2,0x96,0x97,0x4A,0xBF,0xCD,0x5E};

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0xE9,0x74,0xA8,0x2E,0x10,0x26,0xDE,0x31,0x31,0x23,0x04,0x7A,0x2F,0xE0,0x5D,0xDF};


  /*
   * Having your device already registered at cloud.supla.org,
   * you want to change CHANNEL sequence or remove any of them,
   * then you must also remove the device itself from cloud.supla.org.
   * Otherwise you will get "Channel conflict!" error.
   */

  DeviceAddress ds1 = {0x28, 0x3D, 0x9A, 0xEC, 0x7, 0x0, 0x0, 0x92}; 
 [...]
  DeviceAddress ds24 = {0x28, 0xD7, 0xB9, 0xEB, 0x7, 0x0, 0x0, 0x44}; 
  
  new Supla::Sensor::DS18B20(ONEWIRE_PIN_A, ds1); 
[...]
  new Supla::Sensor::DS18B20(ONEWIRE_PIN_D, ds24); 
  

 
  /*
   * SuplaDevice Initialization.
   * Server address, LocationID and LocationPassword are available at https://cloud.supla.org 
   * If you do not have an account, you can create it at https://cloud.supla.org/account/create
   * SUPLA and SUPLA CLOUD are free of charge
   * 
   */

  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    "svrX.supla.org",  // SUPLA server address
                    "mail",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
    
}

void loop() {
  SuplaDevice.iterate();
  
}
Czy ma ktoś pomysł co można zmienić albo w bibliotece albo w hardwarze?
User avatar
Duch__
Posts: 2199
Joined: Wed Aug 24, 2016 7:26 pm
Location: Opole
Been thanked: 6 times

Post

Nie możesz przejść na coś na wifi? Arduino mega jest słabiutkie.
Philip
Posts: 8
Joined: Sun Jan 21, 2024 8:10 pm

Post

Nie za bardzo. To jest takie rozwiązanie, że potrzebne połączenie jest po Ethernecie.
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79

Return to “Pomoc”