Need help for my first time



  • Hello,
    I finally decided to give a try to my sensors but with no luck yet.
    I have configured my sensors gateway as a MGTT on a RPI 3 on with I am running Domoticz

    I wanted to test a first sensor based on the MQ135 gaz sensor.
    I have uploaded on my Arduino nano the sketch AirQualitySensor.ino

    But it looks that the Arduino is booting every few seconds.

    Whats wrong ?

    The serial monitor logs :

    16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
    26 TSM:INIT
    27 TSF:WUR:MS=0
    33 TSM:INIT:TSP OK
    35 TSM:FPAR
    37 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    429 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    434 TSF:MSG:FPAR OK,ID=0,D=1
    2046 TSM:FPAR:OK
    2048 TSM:ID
    2049 TSM:ID:REQ
    2052 TSF:MSG:SEND,255-255-0-0,s=1,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    4059 TSM:ID
    4060 TSM:ID:REQ
    4062 TSF:MSG:SEND,255-255-0-0,s=220,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    6070 TSM:ID
    6071 TSM:ID:REQ
    6073 TSF:MSG:SEND,255-255-0-0,s=183,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    8081 TSM:ID
    8082 TSM:ID:REQ
    8084 TSF:MSG:SEND,255-255-0-0,s=146,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    10092 !TSM:ID:FAIL
    10093 TSM:FAIL:CNT=1
    10095 TSM:FAIL:DIS
    10097 TSF:TDI:TSL
    20100 TSM:FAIL:RE-INIT
    20102 TSM:INIT
    20108 TSM:INIT:TSP OK
    20110 TSM:FPAR
    20113 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    22120 !TSM:FPAR:NO REPLY
    22122 TSM:FPAR
    22124 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    23088 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    23093 TSF:MSG:FPAR OK,ID=0,D=1
    24132 TSM:FPAR:OK
    24133 TSM:ID
    24135 TSM:ID:REQ
    24137 TSF:MSG:SEND,255-255-0-0,s=71,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    26145 TSM:ID
    26146 TSM:ID:REQ
    26149 TSF:MSG:SEND,255-255-0-0,s=34,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    28157 TSM:ID
    28158 TSM:ID:REQ
    28162 TSF:MSG:SEND,255-255-0-0,s=254,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    30169 TSM:ID
    30170 TSM:ID:REQ
    30173 TSF:MSG:SEND,255-255-0-0,s=218,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    32180 !TSM:ID:FAIL
    32181 TSM:FAIL:CNT=2
    32183 TSM:FAIL:DIS
    32185 TSF:TDI:TSL
    42188 TSM:FAIL:RE-INIT
    42190 TSM:INIT
    42196 TSM:INIT:TSP OK
    42199 TSM:FPAR
    42202 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    44209 !TSM:FPAR:NO REPLY
    44211 TSM:FPAR
    44213 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    46221 !TSM:FPAR:NO REPLY
    46223 TSM:FPAR
    46225 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    46716 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    46722 TSF:MSG:FPAR OK,ID=0,D=1
    48233 TSM:FPAR:OK
    48234 TSM:ID
    48235 TSM:ID:REQ
    48238 TSF:MSG:SEND,255-255-0-0,s=107,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    50246 TSM:ID
    50247 TSM:ID:REQ
    50250 TSF:MSG:SEND,255-255-0-0,s=71,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    52257 TSM:ID```

  • Mod

    Hi @redfirebrooks, welcome to the MySensors community!

    !TSM:ID:FAIL
    

    means that the node did not receive any id from the controller. I don't think Domoticz supports dynamic id assignment over mqtt. You'll need to assign id to your nodes manually by adding

    #define MY_NODE_ID 42
    

    before including MySensors.h, where 42 is the unique number (1-254) you want to give the node. More info: https://www.mysensors.org/apidocs/group__RoutingNodeSettingGrpPub.html#gac677233da7f20bbf93cb479471e3234e

    The node is not rebooting. If it was rebooting you would see MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1 over and over again.

    If you haven't already, check out https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/ for the most common problem and how to troubleshoot them most efficiently, including how touse the log parser to translate the logs to something that's easer to read.



  • Thanks, looks promising

    my serial monitor gives now

    16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
    26 TSM:INIT
    27 TSF:WUR:MS=0
    33 TSM:INIT:TSP OK
    35 TSM:INIT:STATID=42
    37 TSF:SID:OK,ID=42
    39 TSM:FPAR
    75 TSF:MSG:SEND,42-42-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    91 TSF:MSG:READ,0-0-42,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    96 TSF:MSG:FPAR OK,ID=0,D=1
    2083 TSM:FPAR:OK
    2084 TSM:ID
    2085 TSM:ID:OK
    2087 TSM:UPL
    2093 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2099 TSF:MSG:READ,0-0-42,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2104 TSF:MSG:PONG RECV,HP=1
    2107 TSM:UPL:OK
    2108 TSM:READY:ID=42,PAR=0,DIS=1
    2113 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2122 TSF:MSG:READ,0-0-42,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2129 TSF:MSG:SEND,42-42-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1
    2139 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    4150 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=OK:Air Quality Sensor
    4159 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    4167 TSF:MSG:SEND,42-42-0-0,s=0,c=0,t=22,pt=0,l=0,sg=0,ft=0,st=OK:
    4173 MCO:REG:REQ
    4177 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    4184 TSF:MSG:READ,0-0-42,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    4189 MCO:PIM:NODE REG=1
    4191 MCO:BGN:STP
    29201 MCO:BGN:INIT OK,TSP=1
    0
    LPG:0ppm    CO:0ppm    SMOKE:0ppm
    30211 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
    30216 TSF:TDI:TSL
    30218 MCO:SLP:WUP=-1
    30220 TSF:TRI:TSB
    0
    LPG:0ppm    CO:0ppm    SMOKE:0ppm
    31232 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
    31238 TSF:TDI:TSL````
    

    So values are always 0 so something is wrong with the sensor.
    And I can't find it in Domoticz also.

    Not so easy 😞


  • Mod

    Nice work @redfirebrooks

    The log shows that the sensor does not send any values. Domoticz only shows sensors after they have sent their first value, so that's why the sensor does not show in Domoticz. (Why Domoticz behaves like this is a mystery to everyone.)

    I don't have experience with this sensor, but my guess would be a problem with the wiring. Could you post photos of the wiring? A second pair of eyes is often helpful to spot problems.



  • alt text
    Not sure it will help

    Have tested the wiring with another sketch and it is good, it returns me values

    /*
      Programme de test du MQ135 permettant de mesurer la présence de polluants dans l'atmosphère (CO, CO2 Alcool, fumées...)
      Pour plus d'infos ici https://www.projetsdiy.fr/mq135-mesure-qualite-air-polluant-arduino
      Utilise la librairie mq135.cpp mise à disposition par Georg Krocker https://github.com/GeorgK/MQ135
      Projets DIY - Mars 2016 - www.projetsdiy.fr
    */
    
    #include "MQ135.h"
    const int mq135Pin = 0;     // Pin sur lequel est branché de MQ135
    
    MQ135 gasSensor = MQ135(mq135Pin);  // Initialise l'objet MQ135 sur le Pin spécifié
    
    void setup()
    {
        Serial.begin(9600);     // Initialise le port série à 9600 bps 
        //float rzero = gasSensor.getRZero();
        //Serial.print("R0: ");
        //Serial.println(rzero);  // Valeur à reporter ligne 27 du fichier mq135.h après 48h de préchauffage
        
    }
    
    void loop()
    {
        float ppm = gasSensor.getPPM();
        float rzero = gasSensor.getRZero();
        Serial.print("R0: ");
        Serial.print(rzero);
        Serial.print(" A0: ");
        Serial.print(analogRead(mq135Pin));
        Serial.print(" ppm CO2: ");
        Serial.println(ppm);
        delay(1000);        // Actualise la mesure chaque seconde```


  • Ok so I managed to make it works using a specific MQ135 sketch, I thought the one in the examples folder was compatible with a MQ135...

    But, even if now I have readings, I do not see them in Domoticz.
    Something wrong on the Domoticz side ? but what ?

    16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
    26 TSM:INIT
    27 TSF:WUR:MS=0
    33 TSM:INIT:TSP OK
    35 TSF:SID:OK,ID=42
    37 TSM:FPAR
    73 TSF:MSG:SEND,42-42-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    679 TSF:MSG:READ,0-0-42,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    684 TSF:MSG:FPAR OK,ID=0,D=1
    2081 TSM:FPAR:OK
    2082 TSM:ID
    2083 TSM:ID:OK
    2085 TSM:UPL
    2088 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2095 TSF:MSG:READ,0-0-42,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2100 TSF:MSG:PONG RECV,HP=1
    2103 TSM:UPL:OK
    2104 TSM:READY:ID=42,PAR=0,DIS=1
    2109 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2115 TSF:MSG:READ,0-0-42,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2123 TSF:MSG:SEND,42-42-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.1
    2131 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    4141 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=11,pt=0,l=16,sg=0,ft=0,st=OK:AIQ Sensor MQ135
    4150 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    4158 TSF:MSG:SEND,42-42-0-0,s=0,c=0,t=22,pt=0,l=0,sg=0,ft=0,st=OK:
    4164 MCO:REG:REQ
    4168 TSF:MSG:SEND,42-42-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    4174 TSF:MSG:READ,0-0-42,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    4179 MCO:PIM:NODE REG=1
    4182 MCO:BGN:STP
    4184 MCO:BGN:INIT OK,TSP=1
    0
    Val / Ro / value:19523 / 30443.00 / 0.004188 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
    4195 TSF:TDI:TSL
    4197 MCO:SLP:WUP=-1
    4199 TSF:TRI:TSB
    0
    Val / Ro / value:22654 / 35325.00 / 0.004206 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
    4213 TSF:TDI:TSL
    4215 MCO:SLP:WUP=-1
    4217 TSF:TRI:TSB
    0
    Val / Ro / value:29383 / 45818.00 / 1217.494228 TSF:MSG:SEND,42-42-0-0,s=0,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=OK:1617
    4234 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
    4239 TSF:TDI:TSL
    4241 MCO:SLP:WUP=-1
    4243 TSF:TRI:TSB
    0
    Val / Ro / value:27682 / 43165.00 / 1436.084253 TSF:MSG:SEND,42-42-0-0,s=0,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=OK:1836
    4259 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
    4264 TSF:TDI:TSL```

  • Mod

    @redfirebrooks according to the log, the node is not sending any measurement data. It just goes to sleep over and over again.

    Hard to tell why this happens without seeing the exact sketch code. Would you mind posting it?

    EDIT: Sorry, was on mobile and didn't see that the values were being sent, just not on the first two sleep periods. These lines show that the node is sending values (first the value 1617, later the value 1846).

    TSF:MSG:SEND,42-42-0-0,s=0,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=OK:1617
    TSF:MSG:SEND,42-42-0-0,s=0,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=OK:1836
    

    So it seems like the problem is that Domoticz is unable to display the information.

    What does the Hardware->Setup page looks for the MySensors gateway?
    What is shown on the "Devices" page in Domoticz?


 

193
Online

8.7k
Users

9.5k
Topics

99.5k
Posts