NodeMCU v3. Licznik energii z czujnikami temperatury - tutorial

Lukasz_K
Posty: 9
Rejestracja: czw cze 06, 2019 1:02 pm

Witam.
Zmontowałem licznik energii na NodeMCU v3, wgrałem wszystko Flashem do modułu – działa super. Robiłem wszystko zgodnie z tutorialem z poniższego linka:
https://majsterkowo.pl/chcesz-oszczedza ... -impulsow/

Czy jest gdzieś dostępny podobny tutorial jak krok po kroku dodać do licznika (do supla.cloud) 2 lub 3 czujniki temperatury(DHT11, DHt22 lub BME280), tak by się wszystko wyświetlało w aplikacji SUPLA na Androidzie?
Wszystko - znaczy kWh, temperatura i wilgotność z 2-3 czujników.
https://lh3.googleusercontent.com/pJ8yK ... 36-h674-rw

Jestem laikiem jeśli chodzi o NodeMCU. Mam już Arduino IDE z zainstalownymi bibliotekami dla ESP8266...i tu się zatrzymałem. Szukam na forum i szukam ....i nic podobnego nie mogę znaleźć... Może chociaż ktoś by wsparł ..tak łopatologicznie...jak to oprogramować.
Z góry dziękuję.
Awatar użytkownika
slawek
Posty: 2465
Rejestracja: pn mar 14, 2016 11:48 pm
Lokalizacja: Biała Podlaska

Proponuję zacząć od FAQ - np. tu: viewtopic.php?f=23&t=4160
TEORIA jest wtedy gdy wszystko wiemy i nic nie działa
PRAKTYKA jest wtedy gdy wszystko działa a my nie wiemy dlaczego
My łączymy teorię z praktyką czyli nic nie działa i nikt nie wie dlaczego
Lukasz_K
Posty: 9
Rejestracja: czw cze 06, 2019 1:02 pm

Slawek, szukałem ... spędziłem dwa wieczory..noce.. i nie znalazłem tego o co mi chodzi.
Mianowicie - czy na jednym ESP8266 (NodeMCU) da sie zrobić licznik energii i np. 3 termometry (DHT lub DSP), tak by w aplikacji SUPLA na androida miec mozliwosc zapisu historii i trendów.
Jeśli chidzi o licznik to wgrałem tylko pliki .bin (tak jak w instrukcji) za pomocą Flash download tools, dodałem sprzęt do SUPLI i śmiga. Wgrałem 3 pliki. Czy może jest jakiś gotowy zestaw plików .bin do wgrania Flashem..? Czy może jest gotowy kod do Arduino IDE, który moge wgrać do ESP?
Próbowałem z plikami .bin z githuba - supla -> 2xdht -> ale coś mi nie chce działać.
Będę bardzdzo wdzięczny za jakiekolwiek wskazówki lub linka do zrozumiałej dla początkującego instrukcji - co i jak ...
Awatar użytkownika
pzygmunt
Posty: 18280
Rejestracja: wt sty 19, 2016 9:26 am
Lokalizacja: Paczków
Kontakt:

Gotowca nie ma ale jest to technicznie do osiągnięcia.
Lukasz_K
Posty: 9
Rejestracja: czw cze 06, 2019 1:02 pm

PZygmunt - A mógłyś udostępnić kompletny sketch licznika jednofazowego na Nodemcu ? - chyba, że da się jakoś to wygenerować z bliku bin?
Lukasz_K
Posty: 9
Rejestracja: czw cze 06, 2019 1:02 pm

Dzięki. Już na to wcześniej patrzyłem, ale po wklejeniu do Arduino IDE jest masa errorów po kompilacji...rozumiem, że trzeba coś dołożyć , coś zmienić...powalcze...może się uda. Poniżej co mi wuskoczyło po kompilacji

Kod: Zaznacz cały

licznik:22:3: error: '_supla_int64_t' does not name a type

   _supla_int64_t counter[IMPULSE_COUNTER_COUNT];

   ^

licznik:23:3: error: '_supla_int64_t' does not name a type

   _supla_int64_t copy[IMPULSE_COUNTER_COUNT];

   ^

licznik:29:3: error: '_supla_int64_t' does not name a type

   _supla_int64_t counter;

   ^

licznik:41:21: error: 'IMPULSE_COUNTER_COUNT' was not declared in this scope

 _ic_counter counter[IMPULSE_COUNTER_COUNT];

                     ^

licznik:411:35: error: variable or field 'supla_esp_board_set_channels' declared void

 void supla_esp_board_set_channels(TDS_SuplaDeviceChannel_C *channels,

                                   ^

licznik:411:35: error: 'TDS_SuplaDeviceChannel_C' was not declared in this scope

licznik:411:61: error: 'channels' was not declared in this scope

 void supla_esp_board_set_channels(TDS_SuplaDeviceChannel_C *channels,

                                                             ^

licznik:411:71: error: expected primary-expression before 'unsigned'

 void supla_esp_board_set_channels(TDS_SuplaDeviceChannel_C *channels,

                                                                       ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'char* supla_esp_board_cfg_html_template(char*, const char*, char)':

licznik:190:52: error: 'supla_esp_devconn_laststate' was not declared in this scope

   int bufflen = strlen(supla_esp_devconn_laststate()) + strlen(dev_name) +

                                                    ^

licznik:191:24: error: 'SUPLA_ESP_SOFTVER' was not declared in this scope

                 strlen(SUPLA_ESP_SOFTVER) + strlen(supla_esp_cfg.WIFI_SSID) +

                        ^

licznik:191:52: error: 'supla_esp_cfg' was not declared in this scope

                 strlen(SUPLA_ESP_SOFTVER) + strlen(supla_esp_cfg.WIFI_SSID) +

                                                    ^

licznik:194:18: error: 'user_cmd' was not declared in this scope

                 (user_cmd ? strlen(user_cmd) : 0) + 200;

                  ^

licznik:228:31: error: 'ets_snprintf' was not declared in this scope

       user_cmd ? user_cmd : "");

                               ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'void supla_esp_board_set_device_name(char*, uint8)':

licznik:237:54: error: 'ets_snprintf' was not declared in this scope

   ets_snprintf(buffer, buffer_size, "IMPULSE COUNTER");

                                                      ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'void supla_esp_board_gpio_init()':

licznik:253:25: error: 'REF_LED_PORT1' was not declared in this scope

   supla_esp_gpio_set_hi(REF_LED_PORT1, 0);

                         ^

licznik:253:41: error: 'supla_esp_gpio_set_hi' was not declared in this scope

   supla_esp_gpio_set_hi(REF_LED_PORT1, 0);

                                         ^

licznik:254:25: error: 'REF_LED_PORT2' was not declared in this scope

   supla_esp_gpio_set_hi(REF_LED_PORT2, 0);

                         ^

licznik:255:25: error: 'REF_LED_PORT3' was not declared in this scope

   supla_esp_gpio_set_hi(REF_LED_PORT3, 0);

                         ^

licznik:257:10: error: 'counter' was not declared in this scope

   memset(counter, 0, sizeof(_ic_counter));

          ^

licznik:259:21: error: 'IMPULSE_PORT1' was not declared in this scope

   counter[0].gpio = IMPULSE_PORT1;

                     ^

licznik:262:7: error: 'supla_esp_cfg' was not declared in this scope

       supla_esp_cfg.Time1[0] > 0 ? supla_esp_cfg.Time1[0] : 50000;

       ^

licznik:264:21: error: 'IMPULSE_PORT2' was not declared in this scope

   counter[1].gpio = IMPULSE_PORT2;

                     ^

licznik:269:21: error: 'IMPULSE_PORT3' was not declared in this scope

   counter[2].gpio = IMPULSE_PORT3;

                     ^

licznik:274:22: error: 'gpio16_output_conf' was not declared in this scope

   gpio16_output_conf();

                      ^

licznik:276:3: error: 'supla_input_cfg' was not declared in this scope

   supla_input_cfg[0].type = INPUT_TYPE_BTN_MONOSTABLE;

   ^

licznik:276:29: error: 'INPUT_TYPE_BTN_MONOSTABLE' was not declared in this scope

   supla_input_cfg[0].type = INPUT_TYPE_BTN_MONOSTABLE;

                             ^

licznik:277:32: error: 'B_CFG_PORT' was not declared in this scope

   supla_input_cfg[0].gpio_id = B_CFG_PORT;

                                ^

licznik:278:30: error: 'INPUT_FLAG_PULLUP' was not declared in this scope

   supla_input_cfg[0].flags = INPUT_FLAG_PULLUP | INPUT_FLAG_CFG_BTN;

                              ^

licznik:278:50: error: 'INPUT_FLAG_CFG_BTN' was not declared in this scope

   supla_input_cfg[0].flags = INPUT_FLAG_PULLUP | INPUT_FLAG_CFG_BTN;

                                                  ^

licznik:280:23: error: 'IMPULSE_COUNTER_COUNT' was not declared in this scope

   for (int a = 0; a < IMPULSE_COUNTER_COUNT; a++) {

                       ^

licznik:281:35: error: 'INPUT_TYPE_CUSTOM' was not declared in this scope

     supla_input_cfg[a + 1].type = INPUT_TYPE_CUSTOM;

                                   ^

licznik:284:66: error: 'gpio__input_get' was not declared in this scope

     counter[a].input_last_value = gpio__input_get(counter[a].gpio);

                                                                  ^

licznik:289:19: error: 'os_timer_func_t' was not declared in this scope

                  (os_timer_func_t *)supla_esp_board_on_storage_timer, NULL);

                   ^

licznik:289:36: error: expected primary-expression before ')' token

                  (os_timer_func_t *)supla_esp_board_on_storage_timer, NULL);

                                    ^

In file included from C:\Users\lku008\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266/pgmspace.h:12:0,

                 from C:\Users\lku008\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266/Arduino.h:258,

                 from C:\Users\lku008\AppData\Local\Temp\arduino_build_684103\sketch\licznik.ino.cpp:1:

licznik:290:33: error: 'SAVE_INTERVAL' was not declared in this scope

   os_timer_arm(&storage_timer1, SAVE_INTERVAL, 1);

                                 ^

C:\Users\lku008\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2/tools/sdk/include/osapi.h:61:52: note: in definition of macro 'os_timer_arm'

 #define os_timer_arm(a, b, c) ets_timer_arm_new(a, b, c, 1)

                                                    ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'void supla_esp_board_on_storage_timer(void*)':

licznik:303:25: error: 'IMPULSE_COUNTER_COUNT' was not declared in this scope

     for (int a = 0; a < IMPULSE_COUNTER_COUNT; a++) {

                         ^

licznik:304:15: error: 'struct _ic_storage_t' has no member named 'counter'

       storage.counter[a] = counter[a].counter;

               ^

licznik:304:28: error: 'counter' was not declared in this scope

       storage.counter[a] = counter[a].counter;

                            ^

licznik:305:15: error: 'struct _ic_storage_t' has no member named 'copy'

       storage.copy[a] = storage.counter[a];

               ^

licznik:305:33: error: 'struct _ic_storage_t' has no member named 'counter'

       storage.copy[a] = storage.counter[a];

                                 ^

licznik:309:28: error: 'CFG_SECTOR' was not declared in this scope

     spi_flash_erase_sector(CFG_SECTOR + STATE_SECTOR_OFFSET + storage_offset);

                            ^

licznik:309:41: error: 'STATE_SECTOR_OFFSET' was not declared in this scope

     spi_flash_erase_sector(CFG_SECTOR + STATE_SECTOR_OFFSET + storage_offset);

                                         ^

licznik:309:77: error: 'spi_flash_erase_sector' was not declared in this scope

     spi_flash_erase_sector(CFG_SECTOR + STATE_SECTOR_OFFSET + storage_offset);

                                                                             ^

licznik:312:62: error: 'spi_flash_write' was not declared in this scope

                     (uint32 *)&storage, sizeof(_ic_storage_t));

                                                              ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'uint8 supla_esp_board_load(uint8)':

licznik:320:7: error: 'SPI_FLASH_RESULT_OK' was not declared in this scope

   if (SPI_FLASH_RESULT_OK ==

       ^

licznik:322:12: error: 'CFG_SECTOR' was not declared in this scope

           (CFG_SECTOR + STATE_SECTOR_OFFSET + offset) * SPI_FLASH_SEC_SIZE,

            ^

licznik:322:25: error: 'STATE_SECTOR_OFFSET' was not declared in this scope

           (CFG_SECTOR + STATE_SECTOR_OFFSET + offset) * SPI_FLASH_SEC_SIZE,

                         ^

licznik:323:52: error: 'spi_flash_read' was not declared in this scope

           (uint32 *)&storage, sizeof(_ic_storage_t))) {

                                                    ^

licznik:325:27: error: 'IMPULSE_COUNTER_COUNT' was not declared in this scope

       for (int a = 0; a < IMPULSE_COUNTER_COUNT; a++) {

                           ^

licznik:326:21: error: 'struct _ic_storage_t' has no member named 'counter'

         if (storage.counter[a] != storage.copy[a]) {

                     ^

licznik:326:43: error: 'struct _ic_storage_t' has no member named 'copy'

         if (storage.counter[a] != storage.copy[a]) {

                                           ^

licznik:329:9: error: 'counter' was not declared in this scope

         counter[a].counter = storage.counter[a];

         ^

licznik:329:38: error: 'struct _ic_storage_t' has no member named 'counter'

         counter[a].counter = storage.counter[a];

                                      ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'void supla_esp_board_clear_measurements()':

licznik:342:43: error: 'supla_esp_ic_set_measurement_frequency' was not declared in this scope

   supla_esp_ic_set_measurement_frequency(0);  // Disabled

                                           ^

licznik:345:19: error: 'IMPULSE_COUNTER_COUNT' was not declared in this scope

   for (a = 0; a < IMPULSE_COUNTER_COUNT; a++) {

                   ^

licznik:346:5: error: 'counter' was not declared in this scope

     counter[a].counter = 0;

     ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'void supla_esp_ref_led_timer(void*)':

licznik:356:62: error: 'supla_esp_gpio_set_hi' was not declared in this scope

   supla_esp_gpio_set_hi(((_ic_counter *)ptr)->ref_led_gpio, 0);

                                                              ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'uint8 supla_esp_board_intr_handler(uint32)':

licznik:362:23: error: 'IMPULSE_COUNTER_COUNT' was not declared in this scope

   for (int a = 0; a < IMPULSE_COUNTER_COUNT; a++) {

                       ^

In file included from C:\Users\lku008\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266/esp8266_peri.h:24:0,

                 from C:\Users\lku008\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266/Arduino.h:38,

                 from C:\Users\lku008\AppData\Local\Temp\arduino_build_684103\sketch\licznik.ino.cpp:1:

licznik:363:27: error: 'counter' was not declared in this scope

     if (gpio_status & BIT(counter[a].gpio)) {

                           ^

C:\Users\lku008\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2/tools/sdk/include/c_types.h:78:42: note: in definition of macro 'BIT'

 #define BIT(nr)                 (1UL << (nr))

                                          ^

licznik:370:48: error: 'gpio__input_get' was not declared in this scope

       uint8 v = gpio__input_get(counter[a].gpio);

                                                ^

licznik:372:18: error: 'IMPULSE_TRIGGER_VALUE' was not declared in this scope

         if (v == IMPULSE_TRIGGER_VALUE &&

                  ^

licznik:373:29: error: 'system_get_time' was not declared in this scope

             system_get_time() - counter[a].input_last_time >=

                             ^

licznik:379:61: error: 'supla_esp_gpio_set_hi' was not declared in this scope

             supla_esp_gpio_set_hi(counter[a].ref_led_gpio, 1);

                                                             ^

licznik:383:29: error: 'os_timer_func_t' was not declared in this scope

                            (os_timer_func_t *)supla_esp_ref_led_timer,

                             ^

licznik:383:46: error: expected primary-expression before ')' token

                            (os_timer_func_t *)supla_esp_ref_led_timer,

                                              ^

licznik:389:54: error: 'system_get_time' was not declared in this scope

         counter[a].input_last_time = system_get_time();

                                                      ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: At global scope:

licznik:403:35: error: 'TDS_ImpulseCounter_Value' has not been declared

     unsigned char channel_number, TDS_ImpulseCounter_Value *icv) {

                                   ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: In function 'uint8 supla_esp_board_get_impulse_counter(unsigned char, int*)':

licznik:404:24: error: 'IMPULSE_COUNTER_COUNT' was not declared in this scope

   if (channel_number < IMPULSE_COUNTER_COUNT) {

                        ^

licznik:405:10: error: request for member 'counter' in '* icv', which is of non-class type 'int'

     icv->counter = counter[channel_number].counter;

          ^

licznik:405:20: error: 'counter' was not declared in this scope

     icv->counter = counter[channel_number].counter;

                    ^

C:\Users\lku008\Documents\Arduino\licznik\licznik.ino: At global scope:

licznik:411:35: error: variable or field 'supla_esp_board_set_channels' declared void

 void supla_esp_board_set_channels(TDS_SuplaDeviceChannel_C *channels,

                                   ^

licznik:411:35: error: 'TDS_SuplaDeviceChannel_C' was not declared in this scope

licznik:411:61: error: 'channels' was not declared in this scope

 void supla_esp_board_set_channels(TDS_SuplaDeviceChannel_C *channels,

                                                             ^

licznik:412:35: error: expected primary-expression before 'unsigned'

                                   unsigned char *channel_count) {

                                   ^

exit status 1
'_supla_int64_t' does not name a type
Awatar użytkownika
pzygmunt
Posty: 18280
Rejestracja: wt sty 19, 2016 9:26 am
Lokalizacja: Paczków
Kontakt:

To nie jest kod pod Arduino IDE.
Biblioteka dla Arduino tego nie używa.
Lukasz_K
Posty: 9
Rejestracja: czw cze 06, 2019 1:02 pm

aaa. ok.
To jeśli to jest pod Eclipsa C++ lub czymś podobnym to już chyba nie ogarne...
cino111
Posty: 714
Rejestracja: pn maja 07, 2018 8:00 pm

Jak trochę kumasz programowanie, to zobacz tutaj viewtopic.php?f=6&t=4735
ODPOWIEDZ

Wróć do „FAQ / Jak to zrobić”