Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. ricorico94
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by ricorico94

    • RE: 💬 Building a WiFi Gateway using ESP8266

      Hi,
      I answer to myself as it may help some other beginners like me.

      • there's a way to get the debug info via telnet session to the ESP8266 gateway: look fro MyNetDebug library in this forum.
        https://forum.mysensors.org/topic/7044/debug-messages-over-wi-fi

      • be careful if you reuse sketches from 2.2.0 with 2.3.0 library release : now instead of
        #define MY_ESP8266_SSID "MySSID"
        #define MY_ESP8266_PASSWORD "MyVerySecretPassword"

      you should use:
      #define MY_WIFI_SSID "MySSID"
      #define MY_WIFI_PASSWORD "MyVerySecretPassword"

      br,

      posted in Announcements
      ricorico94
      ricorico94
    • RE: Debug messages over Wi-Fi

      Hi,
      I found the cause of the error..
      Since 2.3.0, we shouldn't write anymore:

      #define MY_ESP8266_SSID "MySSID"
      #define MY_ESP8266_PASSWORD "MyVerySecretPassword"
      

      but:

      #define MY_WIFI_SSID "MySSID"
      #define MY_WIFI_PASSWORD "MyVerySecretPassword"
      

      I found because I discovered than compiling was OK with 2.2.0 and not anymore with 2.3.0 (even without the MyNetDebug library) and I looked at the example in the 2.3.0 library..
      I had been misleaded by the fact than in release description, it was stated that 2.3 is backward compatible and that network had not to be modified.. So I had thought that no change was required in the sketch..

      I could test the library MyNetDebug and it seems working: the only thing is that it seems slow. Letters show up one after the other fairly slowly (much more slowly than if Serial Monitor used alone). I hope it's not disturbing radio communication..
      But it's great to be able to catch debug messages without plugging the ESP8266 in a computer ! I'll have to investigate if the debug status can be switched on/off by a remote command to the ESP8266 gateway to avoid overloading the device if not necessary.

      Thanks again for your efforts!

      posted in Development
      ricorico94
      ricorico94
    • RE: Debug messages over Wi-Fi

      Hi,
      Thanks for your help.
      Yes, I defined them before the Mysesnors.h.
      here's my ino (I anonymised ssid and password):

      // Application details
      #define APPLICATION_NAME    "Gateway RFM95 Eric"
      #define APPLICATION_VERSION "0.0.0.Beta Eric"
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
      #define MY_BAUD_RATE 115200 
      
      // Enable and select radio type attached
      #define   MY_RADIO_RFM95
      
      #define   MY_DEBUG_VERBOSE_RFM95
      //#define   MY_DEBUG_VERBOSE_RFM95_REGISTERS
      //#define MY_RFM95_ATC_TARGET_RSSI (-70)  // target RSSI -70dBm
      //#define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
      #define   MY_RFM95_FREQUENCY (RFM95_434MHZ)
      //#define   MY_RFM95_MODEM_CONFIGRUATION (RFM95_BW500CR45SF128)
      //below was used in first successful testings then modified to try improving coverage
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
      #define MY_RFM95_MODEM_CONFIGRUATIONRFM95_BW125CR48SF4096
      #define MY_TRANSPORT_STATE_TIMEOUT_MS  (3*1000ul)
      #define RFM95_RETRY_TIMEOUT_MS  (3000ul) 
      
      #define   MY_RFM95_IRQ_PIN 5
      #define   MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
      #define   MY_RFM95_CS_PIN 15
      
      
      #define MY_GATEWAY_ESP8266
      
      
      // Set WIFI SSID and password
      #define MY_ESP8266_SSID "nameofmywifi"
      #define MY_ESP8266_PASSWORD "mypassword"
      
      #define MY_HOSTNAME "lora-gateway"
      
      #define MY_PORT 5003
      
      //added for MyNetdebug
      // How many clients should be able to connect to this gateway (default 1)
      #define MY_GATEWAY_MAX_CLIENTS 2
      
      #if defined(MY_USE_UDP)
      #include <WiFiUdp.h>
      #endif
      // end added for Mynetdebug
      
      #include <ESP8266WiFi.h>
      
      //added for Mynetdebug
      #include <MyNetDebug.h>
      #define MY_SERIALDEVICE NetDebug
      // end added
      
      #include <MySensors.h>
      
      void setup()
      {
        //all block below added for Mynetdebug
      
           // Echo all data sent by the debug client
        NetDebug.echo(true);
        // Send a carriage return before each line feed
        NetDebug.crBeforeLF(true);
        // If you want the debug message to also be sent to Serial port
        NetDebug.mirror(&Serial);
        // Initialize the serial port if you plan to use it in your sketch or if you are using the mirror function
        // MySensors usually does this for us, however, since we've set up our serial device to be NetDebug,
        // we have to do it ourselves
        Serial.begin(MY_BAUD_RATE);
      
        // end added Mynetdebug
          // Setup locally attached sensors
      }
      
      void presentation()
      {
          // Present locally attached sensors here
        sendSketchInfo(APPLICATION_NAME, APPLICATION_VERSION);
      
      }
      
      void loop()
      {
        //added for Mynetdebug
         (void)NetDebug.available();
      // end added for Mynetdebug
          
          // Send locally attached sensors data here
      
      
      }
      

      For your info, before I make these changes, it was compiling OK. My changes are embedded within the comments "added for Mynetdebug".
      In IDE, I use the setting wemos D1R2 & mini, 80MHz and "4M(3M SPIFFS)".
      Maybe I installed the library i a wrong manner ? Shoudl I move the .h and .cpp one level up in folders ?

      Thanks,

      posted in Development
      ricorico94
      ricorico94
    • RE: Debug messages over Wi-Fi

      Hi,
      Your initiative seems a bright idea, thanks for that !
      I tried your library to debug a gateway on a wemos D1 mini with Mysensors 2.3.0, but I got error messages when compiling. Maybe it's because I didn't follow proper installation of your library as I'm not friendly with Arduino IDE library system.
      I did symply download your folders from github and installed Mynetdebug-master folder in same folder than Mysensors library folder. IN the Mynetdebug folder, I have a keywords.txt file and a library.json and library.master, and a src folder where I have the .cpp and .h files.
      Is it correct ?
      I used your example for ESP8266 to modify my working gateway .ino.
      Then, when I compiled, I got following error messages:

      Arduino: 1.8.5 (Windows 7), Board: "WeMos D1 R2 & mini, 80 MHz, 115200, 4M (3M SPIFFS)"
      
      WARNING: Category 'MySensors' in library MyNetDebug is not valid. Setting to 'Uncategorized'
      In file included from d:\userdata\myname\My Documents\Arduino\libraries\MySensors/MySensors.h:212:0,
      
                       from D:\userdata\myname\My Documents\Arduino\LoraGTWperso04Mynetdebug\LoraGTWperso04Mynetdebug.ino:67:
      
      d:\userdata\myname\My Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportInit()':
      
      d:\userdata\myname\My Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:28:22: error: 'MY_ESP8266_SSID' was not declared in this scope
      
       #define MY_WIFI_SSID MY_ESP8266_SSID
      
                            ^
      
      d:\userdata\myname\My Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:163:19: note: in expansion of macro 'MY_WIFI_SSID'
      
        (void)WiFi.begin(MY_WIFI_SSID, MY_WIFI_PASSWORD, 0, MY_WIFI_BSSID);
      
                         ^
      
      d:\userdata\myname\My Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:34:26: error: 'MY_ESP8266_PASSWORD' was not declared in this scope
      
       #define MY_WIFI_PASSWORD MY_ESP8266_PASSWORD
      
                                ^
      
      d:\userdata\myname\My Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:163:33: note: in expansion of macro 'MY_WIFI_PASSWORD'
      
        (void)WiFi.begin(MY_WIFI_SSID, MY_WIFI_PASSWORD, 0, MY_WIFI_BSSID);
      
                                       ^
      
      exit status 1
      Error compiling for board WeMos D1 R2 & mini.
      
      This report would have more information with
      "Show verbose output during compilation"
      option enabled in File -> Preferences.
      
      
      

      Can you help me ?
      br,
      Ricorico94

      posted in Development
      ricorico94
      ricorico94
    • RE: 💬 Building a WiFi Gateway using ESP8266

      Hi,
      I built a ESP8266 gateway using a wemos D1 mini and RFM95. I'd like to debug some communications with sensors with being attached to serial port of a computer, so I tried to connect via telnet.
      I can connect as telnet, but I don't see many details.. First, text in telnet is not aligned on the left, and second, it only lists some raw values instead of displaying same kind of verbose debug info like in the serial monitor.
      Is there a way to display same verbose text than in serial monitor ?

      Thanks,
      ricorico94

      posted in Announcements
      ricorico94
      ricorico94
    • RE: Any success story on LoRa(RFM95) module and MySensors?

      THanks a lot for your explanations. I should have thought about that indeed..
      I tried to play with antenna positonning to see impact on RSSI, but it was not obvious (a few dB maybe). Maybe it was because I made the test at very close distance (30 cms.. between antennas) and so strength is too high to get meaningfull readings.

      Do you know until which RSSI level, we can have reliable communication ? -80? -120 ?..

      Regarding the lower frequency band mentioned by mfalkvidd, does it exist in RFM95 compatible devices ?

      Ricorico94

      posted in General Discussion
      ricorico94
      ricorico94
    • Controller for storing and displaying raw data from sensors

      Hi,
      I'm currently using MYsensors with Domoticz, which is a great controller. But I'd like to be able to store all datas coming from some sensors and displaying them (as graph or at least table) : I don't think Domoticz is suitable for that because it's averaging values over time, so it's difficult to do fine analysis of datas received or to analyse them a long after (I don't care about volume of stored data).
      For instance, I'd like to visualize radio signal strengths when I move a sensor... but I couldn't find how to do it with Domoticz if I don't have the arduino software conected to gateway with its serial monitor (well, there's way y clicking on settings of the hardware device in domoticz and showing childs then their values, but it requires to be permanently in fron of screen and I can't look at historical data..)

      Any idea on which controller I could use or also how to do it with Domoticz ?

      br
      Ricorico94

      posted in Controllers
      ricorico94
      ricorico94
    • RE: Any success story on LoRa(RFM95) module and MySensors?

      Hello,

      I tried to build a Mysensors gateway based on LORA using the ideas above. I used a RA-O2 SX1278 connected with a wemos D1 mini as a LAN gateway and connected with a pro mini as a sensor.
      (the radio module I used is:
      aliexpress SX1278 RA-02
      As antennas, I used 2 like this:
      link to antenna
      and I also tried replacing the gateway antenna by this one:
      link to high gain antenna

      As wiring, I used the one from jkandasa above and I used the following settings:

      #define MY_DEBUG
      #define MY_BAUD_RATE 115200 // or 9600 ?
      #define   MY_RADIO_RFM95
      #define   MY_DEBUG_VERBOSE_RFM95
      #define   MY_RFM95_FREQUENCY (RFM95_434MHZ)
      #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
      #define   MY_RFM95_IRQ_PIN 5
      #define   MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
      #define   MY_RFM95_CS_PIN 15
      #define MY_GATEWAY_ESP8266 
      

      and I used the default gateway sketch from website (I did not use the OTA version which I'm not familiar with).

      For the node, I used these settings:

      #define   MY_RADIO_RFM95
      #define   MY_DEBUG_VERBOSE_RFM95
      #define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
      #define   MY_RFM95_FREQUENCY (RFM95_434MHZ)
      #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
      #define MY_DEBUG
      
      #define NODE_ID (int8_t) AUTO
      #include <MySensors.h>
      
      int Send_rssi, Rec_rssi;                     // RSSI RFM95 chip
      #define CHILD_ID_RSSI_HIGH  7                // RSSI received signal level
      #define CHILD_ID_RSSI_LOW   8                // RSSI background noise level
      #define CHILD_ID_BATTERY 1
      MyMessage msgRSSI1(CHILD_ID_RSSI_HIGH, V_LEVEL);
      MyMessage msgRSSI2(CHILD_ID_RSSI_LOW, V_LEVEL);
      MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
      

      and I used a basic node sketch in which I send a simple counter and also send an indicator copied from sketches in above posts but which I don't fully understand..:

      Send_rssi = transportGetSendingRSSI();  // read RSSI in RFM95. Measure reception signal from gw
      

      In practice, the value sent for send_RSSI is about (-21) when antennas are in direct sight at approx 20-30cm distance. I tried to move the node to the lower floor (ie one concrete floor between gateway and node in a building) and it says -38 or -44. I tried to go to basement (10 floors below) and I receive nothing.. whereas that was my main motivation for trying long range LORA radio...
      I had selected the 433MHz version as I though the lower frequency would go further through walls than the 868MHz.

      So I have a few questions..

      1. are these -21 or -40 values common values? is it normal to have -21 even at a few cm distance ?
      2. do you think the antennas I used are best otions to try going far away through several fllors of concrete ?
      3. in terms of wiring, I simply connected the wemos D1 mini and the pro mini to the RA-02 without any capacitor. Is it like NRF24 where adding some capacitors could help ?
      4. in terms of settings, I did not try yet all the settings mentioned in previous posts. I'll try the modem config with slow setting, but I'm not sure about the other settings: I guess I would need maximum power, maximum sensitivity, etc. Maybe also using the timeout setting used by jkandasa. What could you advise me ?
      5. do you think I'd have better result with a LORA of another frequency ?

      In case it matters: I don't plan sending a lot of data through the sensor. Target would be to use it to detect opening of a door

      Thanks a lot for your help,
      Ricorico94

      posted in General Discussion
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Thank you for the clarification !

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      @mfalkvidd : thanks a lot ! I had searched for such version history and couldn't find it.
      Indeed it seems introduction of the switches for log files was introduced in February, so I should probably update my install.

      Precisely, talking about upgrade process: I read in previous posts that we should uninstall/unregister the install/service. WHat would be commands to do so ? Should it be:

      sudo systemctl disable mysgw.service
      

      and executed before anything else ? So upgrade process would be:

      sudo systemctl disable mysgw.service
      make
      sudo make install
      sudo systemctl enable mysgw.service
      

      (and maybe test the gateway before the "systemctl enable..")
      Is there anyfile to remove manually ? or any other command to apply before or after ?

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Battery Powered Sensors

      oups, indeed. I'll edit my post as well to avoid confusion as well. Thank you for your support, I appreciated a lot.
      By the way, I could never find how to get the logs in my gateway installed on raspPI. But that's another post. 😉

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Battery Powered Sensors

      Thanks to another arduino forum, I found what was wrong.. probably indeed a stability of power due to step-up converter. In that forum, they were explaining that receiving is more sensitive to power noise than sending data and that in such case, it's good to add a 100uF capacitor on 3.3V and GRD of radio module. I tried 100uF and it worked.. I then tried with 47uF and it's still working. (I had tried with 0.47uF and it was not working at all)

      In the "Connect Radio" guidelines, of Mysensors, it is stated that a capacitor of 0,47-47uF is improving reliability but that "the exact size usually doesn't matter" which was misleading in my case.
      Could I suggest to rephrase that sentence into "the exact size usually doesn't matter, but you can try 47uF if 0.47uF still doesn't work, especially if sending data works well and not receiving data." ?

      Edit for Erratum: please read 4.7-47uF instead of 0,47uF-47uF. Tests I had made were with 4.7uF as well, not 0.47uF
      br,
      Ricorico94

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Selecting a Gateway

      Thank you for this explanation. So I guess in my case, I have the gtw as server since I had to fil in Domoticz the IP address of the gtw (even though it was 127.0.. as local IP).
      Is there any difference of behavior between the 2 settings ? Like if the Mysensor gtw is in server mode, it means that multiple controllers could connect to it and receive the sensors flux ?
      I tried to find some documentation on that but no success so far. It's more for my own curiosity at this stage. 😉

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 3dprint case for motion, temp and humidity sensors with radio and batteries

      @ikkeT : would you mind sharing full details of your sketch and hardware setup (diagrams, ..) ?
      That would be great since you already share the 3D case print.
      Thanks,
      ricorico94

      posted in My Project
      ricorico94
      ricorico94
    • RE: 💬 Selecting a Gateway

      Hi,
      Reading again various pages to try solving a problem, I noticed this statement (in the raspberry pi gateway):
      "To set the gateway as a client that connects to a controller, use:"
      What does it mean ? what is the difference between a client or not ? I saw nothing in the "getting started pages" or in "selecting gateways" explaining that.

      br,
      Ricorico94

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Hi,
      I try to access log info from my gateway installed on my domoticz raspberry pi, but I get no success..
      First, I can't find the mysensors.conf file : nothing in the /etc folder. I tried to use "find / -name 'mysensors.conf' 2>/dev/null" command, but it finds nothing.
      I tried creating such a file (then it's found by the fond command above) and in which I have the lines

      log_pipe=0
      log_pipe_file=/tmp/mysgw.pipe
      

      as instructed above.
      I restarted the wole Raspberry PI, then tried the command cat /tmp/mysgw.pipe but error message:

      cat: /tmp/mysgw.pipe: Aucun fichier ou dossier de ce type
      

      (= no file or folder like that)
      I then tried this: sudo mysgw -c /etc/mysensors.conf and I got also error message:

      mysgw: invalid option -- 'c'
      

      I installed the Mysensor gateway on 17th October 2017 and my raspberry pi is working on Wheezy. In Domoticz, I see the Mysensor gateway has version 2.1.1.
      MY gateway seems working fine, communicating properly with sensors (both ways). I'm trying to find log because I face an issue with a new sensor which works properly when powered with external FTDI 3.3V and only 1 way (sensor to gateway only) when powered on battery (I raised question in another post, where I was suggested to check log fil on gtw side..)

      Any idea of what I should do (except "reinstall whole raspberry pi with latest OS..) ?
      Thanks a lot,
      Ricorico

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Battery Powered Sensors

      Thanks for the advice, I'll try that.
      For the log on the gateway side : I use a gateway on the raspberry pi itself (as per https://www.mysensors.org/build/raspberry ) of my Domoticz installation. Is there an easy way (like via telnet) to get the logs other than by creating the new line in the config file ? Maybe the 3rd option proposed with "mysgw.pipe" ? (in such case, do I need to reboot whole raspberry after modifying the config file?)

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Battery Powered Sensors

      Hi,
      As regulator I use a stepup like that one:
      https://fr.aliexpress.com/item/DC-DC-0-8-3-3V-to-3-3V-Step-Up-Boost-Power-Module-For-Arduino/32819660926.html?spm=a2g0s.9042311.0.0.27426c37HEbdcz

      I use a NRF24L01 as radio module following the connection guidelines from Mysensors. I did not add any capacitor to 3.3 and ground of the NRF24L01.
      I connected the vO of the stepup to the VCC (the VCC between RX and GRD and not the RAW) of the arduino pro mini 3.3V as indicated in this post:https://forum.mysensors.org/topic/4045/solar-powered-soil-moisture-sensor
      I use indeed a similar lamp with its small NiMh battery (1.2v) and its solar panel.
      The NRF24L01 is connected on GRD (between RST and RAW) and on VCC (between A3 and RST). I hadn't put any capacitor.
      I tried following your advice to add a 0.1uF ceramic capcitor between VCC (the one between RX and GRD) of pro mini and its ground, but apparently, I face same issue.
      (I did not solder the capcitor yet, I only connected through the pins I usually use for the FTDI)

      16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0
      26 TSM:INIT
      28 TSF:WUR:MS=0
      34 TSM:INIT:TSP OK
      36 TSF:SID:OK,ID=4
      38 TSM:FPAR
      75 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      2084 !TSM:FPAR:NO REPLY
      2086 TSM:FPAR
      2123 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      4130 !TSM:FPAR:NO REPLY
      4132 TSM:FPAR
      4169 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6176 !TSM:FPAR:NO REPLY
      6178 TSM:FPAR
      6215 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      8222 !TSM:FPAR:FAIL
      8224 TSM:FAIL:CNT=1
      8226 TSM:FAIL:DIS
      8228 TSF:TDI:TSL
      18229 TSM:FAIL:RE-INIT
      18231 TSM:INIT
      18237 TSM:INIT:TSP OK
      18241 TSF:SID:OK,ID=4
      18243 TSM:FPAR
      18280 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      20289 !TSM:FPAR:NO REPLY
      20291 TSM:FPAR
      20328 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      22337 !TSM:FPAR:NO REPLY
      22339 TSM:FPAR
      22376 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      24385 !TSM:FPAR:NO REPLY
      24387 TSM:FPAR
      24424 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      26433 !TSM:FPAR:FAIL
      26435 TSM:FAIL:CNT=2
      26437 TSM:FAIL:DIS
      26439 TSF:TDI:TSL
      36442 TSM:FAIL:RE-INIT
      36444 TSM:INIT
      36450 TSM:INIT:TSP OK
      36454 TSF:SID:OK,ID=4
      36456 TSM:FPAR
      36493 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      38502 !TSM:FPAR:NO REPLY
      38504 TSM:FPAR
      38541 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      40550 !TSM:FPAR:NO REPLY
      40552 TSM:FPAR
      40589 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      42598 !TSM:FPAR:NO REPLY
      42600 TSM:FPAR
      42637 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      44646 !TSM:FPAR:FAIL
      44648 TSM:FAIL:CNT=3
      44650 TSM:FAIL:DIS
      44652 TSF:TDI:TSL
      54657 TSM:FAIL:RE-INIT
      54659 TSM:INIT
      54665 TSM:INIT:TSP OK
      54669 TSF:SID:OK,ID=4
      54671 TSM:FPAR
      54708 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      56717 !TSM:FPAR:NO REPLY
      56719 TSM:FPAR
      56756 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      57493 TSF:MSG:READ,0-0-4,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      57499 TSF:MSG:FPAR OK,ID=0,D=1
      58765 TSM:FPAR:OK
      58767 TSM:ID
      58767 TSM:ID:OK
      58769 TSM:UPL
      58806 !TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      60815 TSM:UPL
      60852 !TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=NACK:1
      62861 TSM:UPL
      62863 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=2,st=OK:1
      64872 TSM:UPL
      64909 !TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      66918 !TSM:UPL:FAIL
      66920 TSM:FPAR
      66957 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
      68964 !TSM:FPAR:NO REPLY
      68966 TSM:FPAR
      69003 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      71012 !TSM:FPAR:NO REPLY
      71014 TSM:FPAR
      71051 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      73060 !TSM:FPAR:NO REPLY
      73062 TSM:FPAR
      73099 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      75108 !TSM:FPAR:FAIL
      75110 TSM:FAIL:CNT=4
      75112 TSM:FAIL:DIS
      75114 TSF:TDI:TSL
      

      Apparently, it sends correctly packets but can't receive any ACK or message from the gateway.
      I got this log by connecting a FTDI adapter with only the RX/TX cables. If ever I connect also the GRD and 3.3V of the FTDI, then I get no error message at all (even without the capacitor) and Domoticz receives all updates (and also sends as I use Domoticz to send customized sleep duration to the sensor).

      Should I try adding both the 0.1uF to VCC/GRD of arduino and also a 4.7uF to the 3.3/GRD of the NRF24 as suggested in the "Connect the Radio" page ?
      Any idea ?
      br,
      Rico

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Battery Powered Sensors

      Hi,
      I'm trying to build a Soil Moisture sensor with NiMh battery and solar panel as in another post. I use a stepup converter to 3.3V connected on the VCC of a pro-mini 3.3V. The sensor seems working when connected to FTDI USB device, ut once I remove the power from FTDI, no more communication. I measured the voltage on the output of the stepup which indicates 3.26V. Is it norml or a defective step-up ? And should I remove the regulator of the pro-mini as suggested above or not ? (in article above, it states the regulator is not necessary, but it doesn't say if pro-mini would still work if regulator remains there).
      Thanks for your support

      posted in Announcements
      ricorico94
      ricorico94
    • RE: LoRa Gateway

      This is even one step further as I understand you get rid of the sandwich Arduino pro mini by soldering directly an ATMEGA328p. It makes the overall setup much more dense indeed. Congratulations !

      Could you share the details on software (scripts..) you used for the whole setup ?
      I'm also interested in settings you use, because based on another thread, I had seen that some settings for RFM95 had an impact on error rates.

      posted in My Project
      ricorico94
      ricorico94
    • RE: LoRa Gateway

      I think I could understand the wiring thanks to your other projects (the shield for ESP-link on Wemos D1 mini), but I'd appreciate if you could clarify it -just to make sure since I see the 90° connector on picture is not like the one in your shield)
      Could you detail also the SW/scripts and settings you use ?
      Thanks,
      Ricorico94

      posted in My Project
      ricorico94
      ricorico94
    • RE: LoRa Gateway

      Hi,
      Seems a great project !
      Can you clarify the difference with your previous minimalist gateway : the new one is linked to Domoticz controller through wifi, but how was the minimalist linked to controller ? Wasnt'it already through wifi ? Or do you mean this new approach enhances the wifi connectivity by using ESP-Link ? (to be frank, I don't really understand what makes ESP-Link so good, as I never investigated it)

      br,
      Ricorico94

      posted in My Project
      ricorico94
      ricorico94
    • RE: Conflicts with neighbour's gateways ?

      I understand everyone prefers using different radio channels, but no one knows how to use the MY_RF24_BASE_RADIO_ID setting and what are the pros/cons ?

      posted in General Discussion
      ricorico94
      ricorico94
    • RE: Conflicts with neighbour's gateways ?

      Hi,
      Thanks for these hints.
      Changing the frequency is probably easy, but does it prevent a new Node to ask for a NodeID from another gateway ?

      Regarding the solution with base Node ID, I don't understand how to use that setting. Documentation states :

      /**
       * @def MY_RF24_BASE_RADIO_ID
       * @brief RF24 radio network identifier.
       *
       * This acts as base value for sensor nodeId addresses. Change this (or channel) if you have more
       * than one sensor network.
       */
      #ifndef MY_RF24_BASE_RADIO_ID
      #define MY_RF24_BASE_RADIO_ID 0x00,0xFC,0xE1,0xA8,0xA8
      

      but I don't understand how to use that.. I searched the forum and the internet, but I could not find examples. What mean "0x00,0xFC,0xE1,0xA8,0xA8" ? Are they random values I can decide by myself (and then use the same for each of my sensors) ? Like I could state:
      #define MY_RF24_BASE_RADIO_ID 0x01,0x02,0x03,0x04,0xFF
      ??

      Is there a downside of using that setting compared to changing radio frequency ? (it still looks much more simple than using the security.. I couldn't find a tutorial that I can understand.. but I admit I didn't spend hours on investigating security yet. That's on my mid-term to-do-list)

      br,
      Ricorico94

      posted in General Discussion
      ricorico94
      ricorico94
    • Conflicts with neighbour's gateways ?

      Hi,
      A neighbour is about to build its own MySensors network.. and I already have mine.. Reading the main documenttation, I can't understand if there's a risk of conflict between sensors.
      For instance, I read that on one network, there can be only one gateway. However, I also read that if you use NRF24 sensors, you can use different radio channels.
      So, how should we manage the various MySensors networks appearing with neighbours ? For instance, during "presentation" phase, the sensor gets a unique nodeID, but is there a risk it asks the gateway from neighbour and get an ID already existing in my own network ?
      Later on, how a sensor can send info to a specific gateway ? (here, my guess is that unless we introduce the security options, then all gateways coul read the sensors).
      On the opposite, if a sensor is requesting info from controller (requesting time or any other setting), how do we make sure that it asks from correct gateway ? Is it only by setting up different radio channels (and thus ask your neighbour to use a differetnh channel than yours?)

      br,
      Ricorico94

      posted in General Discussion
      ricorico94
      ricorico94
    • RE: Using multiple frequencies

      Hi,
      Thank you for your replies.
      @skywatch : I'm not sure to understand the setup and the configuration. If you know where it would be explained, I'd appreciate a link with technical explanations (HW+SW setup).

      My target is not to avoid HW at all costs, but more select the easiest & most stabme approach.. If I must purchase 1 or 2 minis or even a raspberry, it's not end of the world (but a mini is more "envionment friendly than a raspberry which consumes more power, I think).

      My main purpose would be to install a garage door sensor on ground -2 of my building while I leave on +7.. so 9 concrete floors in between..I think it's difficult with traditional NRF24, but I admit that I did not try.

      Another usage (well, if the other works, that one is more for fun ), I would install a similar sensor in another garage door which is at approx 500m from my building in -1 flor of another buildin (with a couple other in between) : for that one, it would be to see "if loar really works far away" 😉

      One of my worries is that Lora does not seem to be well documented on this forum/website. I did post a couple questions several days ago, but despite it seems feasible in Mysensors, I got no answer, so I'm aware I might face heavy difficulties.

      posted in General Discussion
      ricorico94
      ricorico94
    • Using multiple frequencies

      Re: 💬 Selecting a Gateway

      Hi,

      There's something I did not understand in how a Mysensors network should be organised : how can we use various frequencies depending on sensors ?

      For instance, I built my gateway by installing a NRF24 on my raspberry PI (already used for Domoticz) and I have several sensors using also NRF24.
      Now, I'd like to add LoRa radio to handle some sensors which are a bit too far: should I create a second gateway (ethernet gateway for instance on standalone arduino) with the Lora radio, and this second gateway would also be integrated in Domoticz ?
      Or should I create a new sensor with repeater capabilities, attached to my current NRF24 gateway, meaning the new repeater sensor should have both NRF24 and Lora modules ?

      br,
      ricorico94

      posted in General Discussion
      ricorico94
      ricorico94
    • RE: Any RFM95 user reports?

      Hi,

      I'm very interested in the LoRa thing : it' probably the only way to connect a node to a gateway through several floors of concrete in building.. (or do you think the NRF24 could do it ?)

      Could you share your experience on how you wired your hardware ? (including how you power the RFM95 if the arduino pins can not supply enough power -I read somewhere that Lora require up to 200mA, more than the 20-40mA available on Arduino Pro Mini for instance).

      br,

      posted in Hardware
      ricorico94
      ricorico94
    • RE: 💬 Connecting the Radio

      Hi,
      I'm interested in using long range sensors based on LoRa and I saw on this forum that LORA radios should be supported with the RFM95. But I did not see any explanation or advice on hardware, pins, etc.
      Could anyone confirm that the type of radio to attach on the gateway and the sensor is like:
      link to aliexpress RFM95 radio

      I see the chip mentioned is "RF96", but I did not see that name on the forum..(it was SX1276 I think), so I don't know.
      Regarding frequency, I uderstood from other websites that in France, the frequency should be 868MHz, correct ? No risk to interfere with EnOcean/Zwave devices ?

      I see also that these RFM95 radios have many more pins than the NRF24L01 : should I use the same pins than for NRF24 and leave the others unused ?
      and then in the sketch, use the #define RFM95 statement ? Is it all that simple ?

      And then I install the RFM95 as a second MySensors gateway on my network (for instance as an ethernet gateway) ?

      br,
      Ricorico94

      posted in Announcements
      ricorico94
      ricorico94
    • RE: Requesting value from Domoticz

      Hi,
      I finally got it working ! Thanks to 3 changes.. Two which I understand why, the other, well, not really..
      Here's what I did or let's say, my findings..(well, I did much more than that, multiplying tests during several hours..😓 ).

      1. I had thought that since S_INFO was displayed in Domoticz, everything was OK in domoticz. Actually not, and on top of presenting this Child, it seems you need to send whatever value to Domoticz as V_TEXT to initiate that variable. I had read some allusions to that fact (in message from dbemowsk for example) without understanding that it had to be done not for the S_INFO but also for each variable (V_TEXT , V_VAR1,.. any to be used). In sketch I showed I was sending that command for V_VAR1, but when I was trying similar skecth for V_TEXT , I was still ending only to V_VAR1. Once I tried to send the message to V_TEXT, I could see a value V_TEXT appearing in Domoticz under the S_Info line.
      2. As per my previous post, I was not seeing any READ statement in serial monitor after the initial setup phase. Here, I tried to add a "wait" command after the request, instead of looping immediately as per the sketch of Pulse Water sensor. So my loop is now:
      if (!pcReceived) {
            request(CHILD_ID_SLEEP_S, V_TEXT);
            Serial.print("Requested time sleep from gw TEXT");
            wait(5000,2,V_TEXT); // wait for 5s or until a message of type V_TEXT is received
      }
      

      and now, I can see READ messages and also receive and handle them !
      I don't know why I must add this wait statement whereas the Pulse Water Meter sketch can work without it. Maybe linked to hardware used (I did not try to upload that sketch to my sensor to see if it would work). I also removed the "return" command which was present in Pulse Water sketch and which was preventing the rest of the loop() to be executed.

      1. Instead of trying to use V_VAR1 as per the Water Pulse Meter sketch, I use V_TEXT everywhere. In fact, I found a unique, old (in 2015) and very short comment on a forum (I can't remember if it's here on another one.. I searched so many times..) that V_VARx can not be setup or read by Domoticz and they can only be modified by a sensor and read by that sensor or another sensor to store information on the controller side. So, indeed, that works for the pulse water meter, but not for my need since I need interactions with the controller.

      So now it works. Learning curve was painful, but I think I understand the mechanism.

      If one of the admins of Mysensor reads my post, I could suggest the following:

      • in the Controller webpage, instead of stating Y* and "* limited functionality" for V_VAR1..5 variables, you could add a different comment Y*** "can be used for storing values on controller side, but can not be modified/read by Domoticz once it has been initialized with "send" command" and for V_TEXT : Y* "**** only variable which can be used for exchanging data between Domoticz and sensors in both ways and need an initial initialisation by sensor node by send command"
      • in Pulse Water Meter sketch, since it is often referred to as an example, you could add a few comments on why it is using V_VAR1 and not V_TEXT and why V_VAR1 can not be used for exchanging info with Domoticz controller. Also, I would add a comment in the !pcreceived loop proposing to add a "wait" command in case it does not work that way.

      If you plan to write a tutorial on this topic, I can propose my help.

      Thanks a lot to the persons who tried to help me.

      br,
      ricorico94

      posted in Domoticz
      ricorico94
      ricorico94
    • RE: Requesting value from Domoticz

      HI again,
      I noticed that I never see any "read" line in the serial monitor (except at the very beginning when I restart the sensor". Is it normal ?
      Here are snapshots of a couple messages (among the thousands appearing on Serial monitor)
      Seen right after restart of sensor:

      0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
      4 TSM:INIT
      4 TSF:WUR:MS=0
      12 TSM:INIT:TSP OK
      14 TSF:SID:OK,ID=1
      16 TSM:FPAR
      51 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      585 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      591 TSF:MSG:FPAR OK,ID=0,D=1
      2060 TSM:FPAR:OK
      2060 TSM:ID
      2062 TSM:ID:OK
      2064 TSM:UPL
      2068 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      2074 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      2080 TSF:MSG:PONG RECV,HP=1
      2084 TSM:UPL:OK
      2086 TSM:READY:ID=1,PAR=0,DIS=1
      2091 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      2099 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      2107 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
      2121 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      2570 TSF:MSG:READ,0-0-1,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      2576 MCO:REG:REQ
      2580 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      2588 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      2594 MCO:PIM:NODE REG=1
      2596 MCO:BGN:STP
      3201 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=25,sg=0,ft=0,st=OK:Plant moisture solar prot
      3213 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      3223 TSF:MSG:SEND,1-1-0-0,s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      3481 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=OK:
      3491 TSF:MSG:SEND,1-1-0-0,s=2,c=0,t=36,pt=0,l=0,sg=0,ft=0,st=OK:
      3502 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=24,pt=2,l=2,sg=0,ft=0,st=OK:11
      3508 MCO:BGN:INIT OK,TSP=1
      3512 MCO:SLP:MS=1000,SMS=0,I1=255,M1=255,I2=255,M2=255
      3518 MCO:SLP:TPD
      3520 MCO:SLP:WUP=-1
      3524 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:0.0
      242
      0.78
      3534 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:252
      3545 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:0.781
      3555 TSF:MSG:SEND,1-1-0-0,s=2,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
      Requested time sleep from gw VAR13565 TSF:MSG:SEND,1-1-0-0,s=2,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
      Requested time sleep from gw TEXT3573 MCO:SLP:MS=1000,SMS=0,I1=255,M1=255,I2=255,M2=255
      

      and then messages which keeps repeating (no read message):

      10414 TSF:MSG:SEND,1-1-0-0,s=2,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
      Requested time sleep from gw VAR110424 TSF:MSG:SEND,1-1-0-0,s=2,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
      Requested time sleep from gw TEXT10432 MCO:SLP:MS=1000,SMS=0,I1=255,M1=255,I2=255,M2=255
      10438 MCO:SLP:TPD
      10440 MCO:SLP:WUP=-1
      10448 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:0.0
      189
      0.61
      10461 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:214
      10471 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:0.610
      10479 TSF:MSG:SEND,1-1-0-0,s=2,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
      Requested time sleep from gw VAR110489 TSF:MSG:SEND,1-1-0-0,s=2,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
      Requested time sleep from gw TEXT10498 MCO:SLP:MS=1000,SMS=0,I1=255,M1=255,I2=255,M2=255
      

      Any idea of what might happen ? (or not happen..)
      NB: in snapshots above, I'm requesting both V_VAR1 and V_TEXT vaues with these commands looping:

      if (!pcReceived) {
            //Last sleept time not yet received from controller, request it again
            request(CHILD_ID_SLEEP_S, V_VAR1);
            Serial.print("Requested time sleep from gw VAR1");
            request(CHILD_ID_SLEEP_S, V_TEXT);
            Serial.print("Requested time sleep from gw TEXT");
            return;
          }```
      
      ricorico94
      posted in Domoticz
      ricorico94
      ricorico94
    • RE: Requesting value from Domoticz

      well, one of my issues is that I don't understand how the V_VAR1 is managed by Domoticz. The website states that V_VARx exist for any kind of sensor, but in such case I don't understand how to define its value in Domoticz as V_VAR1 appears nowhere. So I used an integer user variable, then transtype to text and in my receive(à procedure, I was trying to transtype again to integer (or unsigned long)..
      It's also why I had tried to replace all my V_VAR1 by V_TEXT, to be more homogenous.

      posted in Domoticz
      ricorico94
      ricorico94
    • RE: Requesting value from Domoticz

      Hi,
      I've been trying to modify the sketch of Solar Powered Plant moisture sensor so that I can remotely control the sleep time from Domoticz.. But so far I failed.. ;-(
      Sorry for the long post below, but I try to provide all details, as I don't understand what I did wrong..

      I tried to understand several contributions including the ones above from dbemowsk (thank you also for your chat messages!) and tomek_olo, as well as the Water Pulse meter sensor , but I still don't succeed having the sensor receiving data from Domoticz.

      Here's what I tried to do.
      In Sensor, I reused the code from solar powered moisture sensor from other post (and that code is working on another sensor) then I modified it to:

      • present an additional child to Domoticz (CHILD_ID_SLEEP 2 with S_INFO) in setup
      • send a value (here 11) of V_VAR1 in setup as per the advise from dbemowsk so that domotic recognize that data field
      • then in Loop(), I have (apart the code for moisture sensor) a loop for requesting V_VAR1 (copied that from the water pulse meter sensor code)
      • outside Loop() (at bottom of script), I created the receive(const MyMessage &message) procedure (in code below, I tried to print to serial several debugging messages...)

      Here's below the whole code:

      #include <SPI.h>
      #define MY_RADIO_NRF24
      #define MY_DEBUG
      #include <MySensors.h>
      
      #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
      #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
      
      #define CHILD_ID_MOISTURE 0
      #define CHILD_ID_BATTERY 1
      #define CHILD_ID_SLEEP_S 2
      // #define SLEEP_TIME_S 100 // Sleep time between reads (in seconds)
      #define THRESHOLD 1.1 // Only make a new reading with reverse polarity if the change is larger than 10%.
      #define STABILIZATION_TIME 1000 // Let the sensor stabilize before reading default BOD settings.
      const int SENSOR_ANALOG_PINS[] = {A4, A5}; // Sensor is connected to these two pins. Avoid A3 if using ATSHA204. A6 and A7 cannot be used because they don't have pullups.
      
      // MySensor gw;
      MyMessage msg(CHILD_ID_MOISTURE, V_HUM);
      MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
      MyMessage sleep_msg(CHILD_ID_SLEEP_S, V_VAR1);
      unsigned long SLEEP_TIME_S = 10;
      unsigned long SLEEP_TIME = 10000;
      long oldvoltage = 0;
      byte direction = 0;
      int oldMoistureLevel = -1;
      float batteryPcnt;
      float batteryVolt;
      int LED = 5;
      bool pcReceived = false;
      
      void setup()
      {
        pinMode(LED, OUTPUT);
        digitalWrite(LED, HIGH);
        delay(200);
        digitalWrite(LED, LOW);
        delay(200);
        digitalWrite(LED, HIGH);
        delay(200);
        digitalWrite(LED, LOW);
        SLEEP_TIME=SLEEP_TIME_S*1000;
      
      
      sendSketchInfo("Plant moisture solar proto", "1.0");
      // request(CHILD_ID_SLEEP_S, V_VAR1);
      present(CHILD_ID_MOISTURE, S_HUM);
        delay(250);
      present(CHILD_ID_BATTERY, S_MULTIMETER);
        for (int i = 0; i < N_ELEMENTS(SENSOR_ANALOG_PINS); i++) {
          pinMode(SENSOR_ANALOG_PINS[i], OUTPUT);
          digitalWrite(SENSOR_ANALOG_PINS[i], LOW);
        }
      present(CHILD_ID_SLEEP_S, S_INFO);
      send(sleep_msg.set(11));
      }
      
      void loop()
      {
        pcReceived = false;
        int moistureLevel = readMoisture();
      
        // Send rolling average of 2 samples to get rid of the "ripple" produced by different resistance in the internal pull-up resistors
        // See http://forum.mysensors.org/topic/2147/office-plant-monitoring/55 for more information
        if (oldMoistureLevel == -1) { // First reading, save current value as old
          oldMoistureLevel = moistureLevel;
        }
        if (moistureLevel > (oldMoistureLevel * THRESHOLD) || moistureLevel < (oldMoistureLevel / THRESHOLD)) {
          // The change was large, so it was probably not caused by the difference in internal pull-ups.
          // Measure again, this time with reversed polarity.
          moistureLevel = readMoisture();
        }
      send(msg.set((moistureLevel + oldMoistureLevel) / 2.0 / 10.23, 1));
        oldMoistureLevel = moistureLevel;
        
        int sensorValue = analogRead(A0);
        Serial.println(sensorValue);
        float voltage=sensorValue*(3.3/1023);
        Serial.println(voltage);
        batteryPcnt = (sensorValue - 248) * 0.72;
        batteryVolt = voltage;
      sendBatteryLevel(batteryPcnt);
        resend((voltage_msg.set(batteryVolt, 3)), 10);
      
      if (!pcReceived) {
            //Last sleept time not yet received from controller, request it again
            request(CHILD_ID_SLEEP_S, V_VAR1);
            Serial.print("Requested time sleep from gw VAR1");
            return;
          }
      
      
        digitalWrite(LED, HIGH);
        delay(200);
        digitalWrite(LED, LOW);
      SLEEP_TIME=SLEEP_TIME_S*1000;  
      sleep(SLEEP_TIME);
      }
      
      void resend(MyMessage &msg, int repeats)
      {
        int repeat = 1;
        int repeatdelay = 0;
        boolean sendOK = false;
      
        while ((sendOK == false) and (repeat < repeats)) {
          if (send(msg)) {
            sendOK = true;
          } else {
            sendOK = false;
            Serial.print("Error ");
            Serial.println(repeat);
            repeatdelay += 500;
          } repeat++; delay(repeatdelay);
        }
      }
      
      
      int readMoisture() {
        pinMode(SENSOR_ANALOG_PINS[direction], INPUT_PULLUP); // Power on the sensor
        analogRead(SENSOR_ANALOG_PINS[direction]);// Read once to let the ADC capacitor start charging
        sleep(STABILIZATION_TIME);
        int moistureLevel = (1023 - analogRead(SENSOR_ANALOG_PINS[direction]));
      
        // Turn off the sensor to conserve battery and minimize corrosion
        pinMode(SENSOR_ANALOG_PINS[direction], OUTPUT);
        digitalWrite(SENSOR_ANALOG_PINS[direction], LOW);
      
        direction = (direction + 1) % 2; // Make direction alternate between 0 and 1 to reverse polarity which reduces corrosion
        return moistureLevel;
      }
      
      void receive(const MyMessage &message)
      {
        if (message.type==V_TEXT) {
          // unsigned long infosleep=message.getULong();
          String infosleepstr=message.getString();
          unsigned long infosleep=infosleepstr.toInt();
          Serial.print("Received time sleep as string from gw:");
          Serial.println(infosleepstr);
          Serial.print("fin de msg");
          SLEEP_TIME_S = infosleep;
          pcReceived = true;
        }
        if (message.type==V_VAR1) {
          unsigned long infosleep=message.getULong();
          //unsigned long infosleep=message.getString();
          
          Serial.print("Received time sleep as VAR1 ULOng from gw:");
          Serial.println(infosleep);
          Serial.print("fin de msg");
          SLEEP_TIME_S = infosleep;
          pcReceived = true;
        }  
      }
      

      In Domoticz, in hardware I can see this:
      0_1509627328360_hardware view.png
      The sensor is the "proto" one (ID 1) where I can see the various children (Humidity=0 is normal as I did not attach the soil sensor and voltage is weird as it's not connected either).
      In devices view, I have:
      0_1509627449535_devices view.png
      where I can see the text sensor of S_INFO which is set to "5" thanks to a user variable (see LUA script below).
      0_1509628921576_button view.png
      I created a user variable "SondeSleep" with a LUA script (type "variables") to update the text sensor whenever the suer variable changes:

      commandArray = {}
      if ( uservariablechanged['SondeSleep']) then
      print ("nouvelle valeur Level1 de SondeSleep:" .. uservariables['SondeSleep']);
      ttidx=otherdevices_idx['SondeSolProto_Text_Sensor'];
      commandArray['UpdateDevice']=ttidx..'|1|' .. uservariables['SondeSleep'] 
      end
      return commandArray 
      

      This script seems working since it replicates properly the vriable value to the text_sensor. I'm just confused by the command

      commandArray['UpdateDevice']=ttidx..'|1|' .. uservariables['SondeSleep']
      

      where I couldn't understand the meaning of the value between the || (here |1|).

      The Domoticz website refers to LUA and JSON page, but I coudn't find the explanation. In 1 script of this post, I saw a 0, in another a 1.. I tried with both and also wit 2 (just in case it refers to Child ID ..) but no better result.
      Could someone clarifies the meaning ?

      When I run the sensor, I can only see (in serial monitor) the message "Requested time sleep from gw VAR1" from the "request" loop. and in Domoticz log, I can see that the sensor updates the humidity and voltage values, but that's all.

      I'm also surprised I do'nt see any value in S_INFO child, but maybe it's normal.
      I had tried to use V_TEXT instead of V_VAR1 everhwhere, but same result. There's definitely something I misunderstood somewehere.

      Anyone could help me ?
      ricorico94

      posted in Domoticz
      ricorico94
      ricorico94
    • RE: Understanding syntax

      Hi,

      Thanks a lot !
      This is precisely what I hadn't understood when reading various websites about arduino language and C language. Now I understand the difference between the #define and the definition of variables.
      So thanks again for this pragmatic explanations.

      br,
      ricorico94

      posted in Development
      ricorico94
      ricorico94
    • Understanding syntax

      Hi,
      I have a question on the syntax used in the Soil Moisture sensor (solar powered version). I usually understand most of code, but I'm still lacking a lot of the detailed mechanisms of such powerful language.
      I read in the code:

      #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
      const int SENSOR_ANALOG_PINS[] = {A4, A5};
      

      then later on:

      for (int i = 0; i < N_ELEMENTS(SENSOR_ANALOG_PINS); i++) {
      

      I don't understand the sequence: how the Define statement can dimension the array N_Elements before the code defines the array itself ? Also I don't understand the formula in the define statement (a division? and the [0] ?)
      Could someone help me understand the detailed syntax and logic of that code ?

      And by the way, I saw in Arduino's website that they recommend not to use the #define statements (#define comments) . Do they recommend to avoid only due to "readibility"? Is there another way to code above statements without the #define ?

      Thanks,

      ricorico94

      posted in Development
      ricorico94
      ricorico94
    • RE: Solar Powered Soil Moisture Sensor

      Hi,
      I started building this great idea of solar powered soil moisture sensor. Not integrated yet in a solar light as above, but still on my desk.
      I tested the sensor in salted water and I get a report of 78% moisture : based on your experience, is it normal ? Then I pushed the sensor in a very humid plant pot and read 71%. I would have expected mroe differenc ecompared to salted water.
      So, would you advise to caliber ? I guess I could modify the calculation formula in the script..

      Precisely, is it possible with Mysensor technology and Domoticz to push to a sensor a new setting (for instance to caliber using Domoticz each different sensor) ?

      And another question.. Is it possible to ask Domoticz to show the result of moisure reading in the Weather or Measures category rather than in the Temperature menu ?

      br,
      Ricorico94

      posted in My Project
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Hi,
      Thanks to @marceloaqno and @Gohan and @arraWX , I could progress somewhow.. but still not working.

      When listing the versions as per Marceloagno advice, I could see gcc-4.6 and -4.7 and 4.8 but nothing else (no 4.9).
      I then decided to take the risk of installing the 4.8.. The commands from Marcelagno did not work (well, I mean gcc - v was still showing 4.6).
      Then I followed this tutorial on upgrade step by step to upgrade to gcc-4.8 and then the make command apparently succeeded (well, plenty messages, some warnings.. but no error apparently, as ar as I could see. I dd not find the folders desribed in website, but the commands were still ok.. weird, but I'm too rookie..)

      I then followed again the Mysensors tutorial with
      sudo ./bin/mysgw -h
      sudo ./bin/mysgw -d (and no error message. great!)
      sudo make install
      but then I ran
      sudo systemctl enable mysgw.service
      and I got error message

      sudo: systemctl: command not found
      

      After some search, I saw that it's a Jessie command whereas I discovered that my good old version of Rasp Pi, which was built from the standard Domoticz image in 2015 is still Wheezy

      pi@raspberrypi ~/MySensors $ cat /etc/os-release
      PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
      NAME="Raspbian GNU/Linux"
      VERSION_ID="7"
      VERSION="7 (wheezy)"
      ID=raspbian
      ID_LIKE=debian
      ANSI_COLOR="1;31"
      HOME_URL="http://www.raspbian.org/"
      SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
      BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
      

      Any idea of what I should do now?..
      another commande equivalent to the systemctl ?
      an upgrade to Jessie (any risk ? and how to do it safely ?)

      br,
      Ricorico94

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohan : JUst tried it, but same result.. no change on version number.
      is there something like apt-get install to be done also ?

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Hi,
      I tried to update gcc, just in case.. though I'm not sure of what I do.😕
      I ran:

      pi@raspberrypi ~/MySensors $ sudo apt-get upgrade gcc
      

      and after a little while, it ended without obvious mistake.
      but if I do gcc -v again, I still get
      gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
      (even after reboot)
      Is there another step to be done, or am I using wrong command ?

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Hi,
      @arraWX : I looked at your post. Unfortunately, the error I face is before the start, as it's during the make, so it appears I follow the first steps you describe (config & make), but I still don't know how to solve the make errors.

      In case it can help understanding what's going on or what to do, I ran the command:

      gcc -v 
      

      which displayed: gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
      Could it be an issue this "+rpi1" whreas I've a PI 2 ?

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Hi,
      I'm trying to install the gateway on a Raspberry Pi 2 hosting Domoticz already (I had used the standard Domoticz image).
      I receive an error message on the make step, but maybe I've not properly understood instructions (not very friendly with raspberry and linux environment).
      First, I wired the NRF24 with PA (meaning I used an adapter and the 5V physical PIN#4) and the IRQ (wired on physical pin #15)
      Then I logged into my raspberry and staid in initial directory (pi@raspberrypi )
      I then typed:

      pi@raspberrypi ~ $ git clone https://github.com/mysensors/MySensors.git --branch master
      Cloning into 'MySensors'...
      remote: Counting objects: 14895, done.
      remote: Compressing objects: 100% (8/8), done.
      remote: Total 14895 (delta 0), reused 5 (delta 0), pack-reused 14887
      Receiving objects: 100% (14895/14895), 12.17 MiB | 1.68 MiB/s, done.
      Resolving deltas: 100% (9022/9022), done.
      pi@raspberrypi ~ $ cd MySensors
      pi@raspberrypi ~/MySensors $ ./configure --help
      

      Hopefully I did it in adequate folder ? (now I see a Mysensors folder in my /home/pi folder).
      Then I typed:

      pi@raspberrypi ~/MySensors $ --my-transport=nrf24
      -bash: --my-transport=nrf24 : commande introuvable
      pi@raspberrypi ~/MySensors $ ./configure --my-transport=nrf24
      [SECTION] Detecting target machine.
        [OK] machine detected: SoC=BCM2836, Type=Rpi2, CPU=armv7l.
      [SECTION] Detecting SPI driver.
        [OK] SPI driver detected:BCM.
      [SECTION] Detecting init system.
        [OK] init system detected: sysvinit.
      [SECTION] Saving configuration.
      [SECTION] Cleaning previous builds.
      [OK] Finished.
      
      

      So far, no error.. but should I have typed "./configure --my-transport=nrf24 --my-rf24-irq-pin=15" to implement the IRQ ? If yes, can I retype that command with new settings without issue ?

      Then I understaood I had to run make command:

      pi@raspberrypi ~/MySensors $ make
      gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/RPi -I./drivers/BCM -c drivers/Linux/log.c -o build/drivers/Linux/log.o
      cc1: error: bad value (cortex-a7) for -mtune switch
      Makefile:118: recipe for target 'build/drivers/Linux/log.o' failed
      make: *** [build/drivers/Linux/log.o] Error 1
      
      

      But errors... 😧
      I tried to search on forum, and saw someone else meniotning a smilar error, but people were answering about OrangePI, whereas I use a Rasp PI 2.
      I probably misunderstood some steps.. Could someone help me ?

      Note: in instructions, there's a statement I don't understand for ethernet gateway: "To set the gateway as a client that connects to a controller, use:--my-gateway=ethernet --my-controller-url-address=YOUR-CONTROLLER-ADDRES" . IN which case do we need that ? (as said, I plan to simply use this gateway on My dodmoticz rasp PI).

      br,
      Ricorico94

      posted in Announcements
      ricorico94
      ricorico94
    • RE: Weird behavior of email confirmation

      I did contact postmasters of free.fr with the errors you reported as well as a copy of the email I had receievd on my other email address. They replied to me that they need to receive the email directly from sender so that they can replicate the issue. IN parallel, I'm supposed to send the same email to a second address to let them know of the error.
      The detailed process to be followed is:

      • resend the same email to my email address (****@free.fr) with nospam@nospam.proxad.net in BCC using the same tools than the "standard" email
      • then send another email to postmaster@proxad.net to let them know the issue detailing in it the sender, the topic and the error messages received.

      If you're willing to follow that process, of course I'd be happy (and maybe it can be useful for other French people since free.fr is a common email provider). But if you don't, don't worry, I understand you're very busy and you have more exciting things to do.

      I was thinking trying to do it myself by utsing the email address they mentioned, but I'd miss the BCC recipient.

      posted in General Discussion
      ricorico94
      ricorico94
    • RE: Weird behavior of email confirmation

      Thank you @mfalkvidd and @hek for your support and your investigation.
      This is really weird : this email address is very old, and following your answer I checked again the settings I have access to. I had some filtering rules, but nothing which should impact this email. I tried however to disable these rules, but problem persists.. What is incredible is that when I see the volum of SPAMs I receive on that email address, it's really bad luck that one site I want is not working. 😟
      I sent a request to postmaster of my email, let's see.. Meanwhile, I'll use the other email address.
      Thanks again, and I'll let you know.

      posted in General Discussion
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Thanks a lot for your clear explanations ! Very useful !
      and.. bravo ! for all your work

      posted in Announcements
      ricorico94
      ricorico94
    • RE: 💬 Building a Raspberry Pi Gateway

      Hi,
      This seems a great job, but despite I had a look at many posts (yes, many out of the dozens of pages.. 😉 ), I still can't figure out some questions..

      • Beyond the obvious advantage of saving an arduino (and power supply, space..), is there an advantage for having the gateway hosted by the raspberry PI hosting my Domoticz ? (like more CPU available for handling communications or for signing ? or on the opposite more risks to overload the PI CPU -despite only a couple persons have complained about high CPU load))
      • the default setup is Ethernet. What are the pros and cons of ethernet vs serial setup ? (speed? reliability ? possibility to move to other gateway?..)
      • Is signing now implemented in this setup ? I didn't see it explicitely described, but some posts seem related to signing.
      • if I want to use an external antenna and the high power NRF24, should I use an aother power source than raspberry PI ? (or maybe sharing the same USB charger, but diverting the power in parallel of the PI ?)
      • is there a tutorial somewhere detailing how to uninstall and migrate to an external gateway ? During such migration, would I need to "touch" again my sensors and would I lose history logs of these sensors in Domoticz ?

      Sorry for all these questions..

      br,
      Ricorico94

      posted in Announcements
      ricorico94
      ricorico94
    • Weird behavior of email confirmation

      Hi,
      I've registered to Mysensors site recently, and I face a weird behavior of confirmation emails.. When I use my mostly used email (ending in @free.fr ), I receive no email at all.. (I checked in spams, junk,.. etc. and I tried asking for resending email).. so I can't confirm my email..
      If I use another email on @yahoo.fr, then the email is properly received.. but I wouldn't want to use an new email address just for Mysensors.
      Is there anyone within admins who could check what might happening ?
      ricorico94

      posted in General Discussion
      ricorico94
      ricorico94
    • RE: Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

      Hi,
      I plan using a gateway with Mydomoticz and this solution seems great. However, I might want to use later signing or the high Amplifier NRF24 or even the version 2 which seem not suitable for this project.
      How easy is it to start with this gateway, then migrate to an external ethernet gateway ?
      I saw this gateway can be uninstalled, but should I then modify anything on sensors to move them to new gateway ? will I lose log datas in Domoticz ?

      br,
      Ricorico94

      posted in Hardware
      ricorico94
      ricorico94