Thanks a lot for your clear explanations ! Very useful !
and.. bravo ! for all your work
ricorico94
@ricorico94
Best posts made by ricorico94
-
RE: 💬 Building a Raspberry Pi Gateway
-
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.. ).- 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.
- 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.- 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 -
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 -
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 -
Using multiple frequencies
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 -
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!
-
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. -
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
Latest 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,
-
-
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!
-
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,
-
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 -
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 -
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
-
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 -
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 antennaAs 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..
- are these -21 or -40 values common values? is it normal to have -21 even at a few cm distance ?
- do you think the antennas I used are best otions to try going far away through several fllors of concrete ?
- 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 ?
- 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 ?
- 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 -
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 ?