Licznik impulsów, brak reakcji.

sztajek
Posts: 19
Joined: Wed May 04, 2016 8:18 pm

Post

Mam problem z licznikiem. Licznik nie przesyła mi danych do chmury. Impulsy są poprawnie zliczane przez układ. Dioda na module miga równocześnie wraz z dioda na liczniku. Żaden impuls nie jest pomijany. Układ jest widziany na stronie poprawnie, jako licznik energii.
Mam wgrany na modemcu przykład z arduino ide. Esp jest połączone z licznikem do wyjścia impulsowego. Masa oraz pin d4. Na żadnym innym pinie nie ma reakcji esp. Układ pracował całą noc, ani jeden impuls nie został policzony. Jeszcze kiedy esp testowałem na biurku, w histori pomiarów pojawiały się dziwne wykresy. Po kilku "impulsach" miałem pomiar ok 4tyś kw... Po podłączeniu do licznika, już nic się nie pokazuje.

Code: Select all

*/

#include <SuplaDevice.h>
#include <supla/sensor/impulse_counter.h>

// Choose where Supla should store counter data in persistant memory
// We recommend to use external FRAM memory 
#define STORAGE_OFFSET 100
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom(STORAGE_OFFSET);
// #include <supla/storage/fram_spi.h>
// Supla::FramSpi fram(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] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
  Supla::EthernetShield ethernet(mac);

  // Arduino Mega with ENC28J60:
  // #include <supla/network/ENC28J60.h>
  // Supla::ENC28J60 ethernet(mac);
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  // ESP8266 and ESP32 based board:
  #include <supla/network/esp_wifi.h>
  Supla::ESPWifi wifi("xxxxxx", "xxxx");
#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] = {xxxx};

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {xxxxxx};

  /*
   * 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.
   */
    
  // CHANNEL0 - Impulse Counter on pin 34, counting raising edge (from LOW to HIGH), no pullup on pin, and 10 ms debounce timeout
  new Supla::Sensor::ImpulseCounter(34, true, false, 100);
  
  // CHANNEL1 - Impulse Counter on pin 35, counting falling edge (from HIGH to LOW), with pullup on pin, and 50 ms debounce timeout
  new Supla::Sensor::ImpulseCounter(35, false, true, 500);
  

  /*
   * Server address is 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 
                    "svr1.supla.org",  // SUPLA server address
                    "XXXXX",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
    
}

void loop() {
  SuplaDevice.iterate();
}
Last edited by sztajek on Tue Feb 02, 2021 7:54 pm, edited 1 time in total.
User avatar
klew
Posts: 13907
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Ten przykład nie ma sygnalizacji zliczenia impulsu w postaci migania diody.
W tym przykładzie są dwa liczniki - jeden z pullupa, drugi bez. Do tego numery pin są raczej spoza zakresu ESP.
Musisz te parametry ustawić zgodnie ze sprzętem który podłączasz.
Jeśli nadal nie będzie działać, to pokaż logi z seriala
Najlepsze suple dla Twojego domu :mrgreen:
sztajek
Posts: 19
Joined: Wed May 04, 2016 8:18 pm

Post

Myślałem, że może sygnalizacja impulsu jest poprostu zaszyta w bibliotece. Próbowałem zmieniać piny, ale bez większych sukcesów.
Na serialu cisza.
sztajek
Posts: 19
Joined: Wed May 04, 2016 8:18 pm

Post

WiFi station disconnected
WiFi station disconnected
local IP: 192.168.1.27
subnetMask: 255.255.255.0
gatewayIP: 192.168.1.1
Signal strength (RSSI): -59 dBm
Current status: [9] Not connected to Supla server
Establishing Secured connection without certificate matching with: svr1.supla.org (port: 2016)
Connected to Supla Server
Current status: [10] Register in progress
Sending: [53 55 50 4C 41 C 1 0 0 0 45 0 0 0 7A 2 0 0 73 7A 74 61 6A 65 6B 40 69 6E 74 65 72 69 61 2E 70 6C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 B8 7 4A 6D C0 1D 36 32 90 F6 16 66 1B 47 78 88 7B 16 55 C2 A3 15 1 5C E2 31 6A A7 C9 18 5D 20 45 53 50 38 32 36 36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 73 65 72 20 53 57 2C 20 6C 69 62 20 32 2E 33 2E 32 0 0 0 73 76 72 31 2E 73 75 70 6C 61 2E 6F 72 67 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 92 13 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 92 13 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ]
Sending: [53 55 50 4C 41 ]
Received: [53 55 50 4C 41 C 1 0 0 0 46 0 0 0 7 0 0 0 3 0 0 0 78 D 1 53 55 50 4C 41 ]
Device registered (activity timeout 120 s, server version: 13, server min version: 1)
Current status: [17] Registered and ready.
Changing activity timeout to 30
Sending: [53 55 50 4C 41 C 2 0 0 0 D2 0 0 0 1 0 0 0 1E ]
Sending: [53 55 50 4C 41 ]
Received: [53 55 50 4C 41 C 2 0 0 0 DC 0 0 0 3 0 0 0 1E A F0 53 55 50 4C 41 ]
Activity timeout set to 30 s
Sending: [53 55 50 4C 41 C 3 0 0 0 28 0 0 0 10 0 0 0 20 0 0 0 0 0 0 0 9D 30 3 0 0 0 0 0 ]
Sending: [53 55 50 4C 41 ]
Received: [53 55 50 4C 41 C 3 0 0 0 32 0 0 0 10 0 0 0 AA 81 19 60 0 0 0 0 74 F9 C 0 0 0 0 0 53 55 50 4C 41 ]
User avatar
klew
Posts: 13907
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Do jakiego gpio podłączasz sygnał impulsowy? Ten sam pin musisz ustawić w kodzie. Trzeba też ustawić czy na być pullup robiony przez ESP, czy stosujesz zewnętrzny. Pokaż zdjęcie jak to masz podłączone albo schemat/rysunek.
Najlepsze suple dla Twojego domu :mrgreen:
sztajek
Posts: 19
Joined: Wed May 04, 2016 8:18 pm

Post

W takiej konfiguracji dioda na mcu miga w tym samym momecie jak dioda na liczniku
Last edited by sztajek on Tue Feb 02, 2021 7:07 pm, edited 2 times in total.
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

1. Przeczytaj jeszcze raz to co @klew napisał
2. Wprowadź zmiany w kodzie
3. Sprawdź czy działa. Jeśli nie to wróć do pkt 1.
SUPLA.... Nareszcie w domu.

Return to “Pomoc”