Navigation

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

    qobouky

    @qobouky

    4
    Reputation
    14
    Posts
    293
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    qobouky Follow

    Best posts made by qobouky

    • RE: Cannot add Nodes trough RS 485

      Of course it was issue on my side. My understanding was that GW baud rate in mycontroller should be baud rate of RS485. When I changed baud rate to correct value everything works well. Nod is added automatically.

      But I would like to kindly ask you for next suggestion.

      I plan to use one Arduino to monitor Temp, Hum and CO2. Those sensors are presented in MyController as static now.

      Additionally script should control 3 relays. I added relay script from My sensors but I have no idea where I should see those relays in MyController and how to control them manually

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable RS485 transport layer
      #define MY_RS485
      
      // Define this to enables DE-pin management on defined pin
      #define MY_RS485_DE_PIN 2
      
      // Set RS485 baud rate to use
      #define MY_RS485_BAUD_RATE 9600
      
      // Enable this if RS485 is connected to a hardware serial port
      //#define MY_RS485_HWSERIAL Serial1
      
      #define MY_NODE_ID 20
      
      #include <MySensors.h>
      
      static const uint64_t UPDATE_INTERVAL = 10000;
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_CO2 2
      
      #define RELAY_PIN 10  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 3 // Total number of attached relays
      #define RELAY_ON 1  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgCo2(CHILD_ID_CO2, V_LEVEL);
      MyMessage msgCo2b(CHILD_ID_CO2, V_UNIT_PREFIX);
      
      // ----------------------------------------------------------------------------
      
      void before()
      {
          for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
              // Then set relay pins in output mode
              pinMode(pin, OUTPUT);
              // Set relay to last known state (using eeprom storage)
              digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
          }
      }
      
      void presentation()  
      { 
        // Send the sketch version information to the gateway
        sendSketchInfo("Lihen", "1.0");
        
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP);
        present(CHILD_ID_CO2, S_AIR_QUALITY);
        send(msgCo2b.set("ppm"));
      
        for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_BINARY);
        }
      }
      
      // ----------------------------------------------------------------------------
      void setup()
      {
        Serial.println( F("Arduino MySensors RS485 Node test") );    // Fonction F() permet de placer la chaine dans la mémoire eprogramme (Arduino IDE 1.0).
        analogReference(INTERNAL);
        delay(1000);
      }
      
      
      void loop()
      {
          Serial.println( F("Loop ...") );
          TempHum();
          readCO2(); 
          // Sleep for a while to save energy
          sleep(UPDATE_INTERVAL); 
      }
      
      void TempHum ()
      {
          int temperature = 30;
          int humidity = 50;
          Serial.print(F("Tmp: "));
          Serial.println(temperature);
          Serial.print(F("Hum: "));
          Serial.println(humidity);
      
          send(msgTemp.set(temperature, 1));
          send(msgHum.set(humidity, 1));
      }
      
      int readCO2()
      {
          int CO2value = 1550;
          Serial.print(F("CO2: "));
          Serial.println(CO2value);
      
          send(msgCo2.set(CO2value)); 
      }
      
      void receive(const MyMessage &message)
      {
          // We only expect one type of message from controller. But we better check anyway.
          if (message.getType()==V_STATUS) {
              // Change relay state
              digitalWrite(message.getSensor()-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
              // Store state in eeprom
              saveState(message.getSensor(), message.getBool());
              // Write some debug info
              Serial.print("Incoming change for sensor:");
              Serial.print(message.getSensor());
              Serial.print(", New status: ");
              Serial.println(message.getBool());
          }
      }
      
      posted in MyController.org
      qobouky
      qobouky
    • RE: WeMos D1 mini and NRF24

      Thank you very much for great explanation!!!

      But is there a way how to connect ESP8266 to Controller. In MySensors are available just ethernet or serial gateway with NRF. Of course I can connect ESP to NRF and then use serial gateway but then there is no difference if I use ESP or nano.

      My idea is that I want to use wireless network for sensors. One of my sensor should be LCD/TFT with touch so I wanted to prevent to use NRF (it occuy SPI)
      https://forum.mysensors.org/topic/9276/home-automation-tft-touch-display

      posted in Development
      qobouky
      qobouky
    • RE: MQ135 with RS485

      I found an root cause.

      In pin definition was

      #define AIQ_SENSOR_ANALOG_PIN 1
      

      but should be

      #define AIQ_SENSOR_ANALOG_PIN A1
      

      I do not know why with first definition it worked with nano but did not work with mini.

      posted in Troubleshooting
      qobouky
      qobouky

    Latest posts made by qobouky

    • RE: Cannot add Nodes trough RS 485

      Sorry but do I understand correctly that relay should be visible as a Sensor in MyController?

      Sensor_Relay.PNG

      posted in MyController.org
      qobouky
      qobouky
    • RE: Cannot add Nodes trough RS 485

      Of course it was issue on my side. My understanding was that GW baud rate in mycontroller should be baud rate of RS485. When I changed baud rate to correct value everything works well. Nod is added automatically.

      But I would like to kindly ask you for next suggestion.

      I plan to use one Arduino to monitor Temp, Hum and CO2. Those sensors are presented in MyController as static now.

      Additionally script should control 3 relays. I added relay script from My sensors but I have no idea where I should see those relays in MyController and how to control them manually

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable RS485 transport layer
      #define MY_RS485
      
      // Define this to enables DE-pin management on defined pin
      #define MY_RS485_DE_PIN 2
      
      // Set RS485 baud rate to use
      #define MY_RS485_BAUD_RATE 9600
      
      // Enable this if RS485 is connected to a hardware serial port
      //#define MY_RS485_HWSERIAL Serial1
      
      #define MY_NODE_ID 20
      
      #include <MySensors.h>
      
      static const uint64_t UPDATE_INTERVAL = 10000;
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_CO2 2
      
      #define RELAY_PIN 10  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 3 // Total number of attached relays
      #define RELAY_ON 1  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgCo2(CHILD_ID_CO2, V_LEVEL);
      MyMessage msgCo2b(CHILD_ID_CO2, V_UNIT_PREFIX);
      
      // ----------------------------------------------------------------------------
      
      void before()
      {
          for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
              // Then set relay pins in output mode
              pinMode(pin, OUTPUT);
              // Set relay to last known state (using eeprom storage)
              digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
          }
      }
      
      void presentation()  
      { 
        // Send the sketch version information to the gateway
        sendSketchInfo("Lihen", "1.0");
        
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP);
        present(CHILD_ID_CO2, S_AIR_QUALITY);
        send(msgCo2b.set("ppm"));
      
        for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_BINARY);
        }
      }
      
      // ----------------------------------------------------------------------------
      void setup()
      {
        Serial.println( F("Arduino MySensors RS485 Node test") );    // Fonction F() permet de placer la chaine dans la mémoire eprogramme (Arduino IDE 1.0).
        analogReference(INTERNAL);
        delay(1000);
      }
      
      
      void loop()
      {
          Serial.println( F("Loop ...") );
          TempHum();
          readCO2(); 
          // Sleep for a while to save energy
          sleep(UPDATE_INTERVAL); 
      }
      
      void TempHum ()
      {
          int temperature = 30;
          int humidity = 50;
          Serial.print(F("Tmp: "));
          Serial.println(temperature);
          Serial.print(F("Hum: "));
          Serial.println(humidity);
      
          send(msgTemp.set(temperature, 1));
          send(msgHum.set(humidity, 1));
      }
      
      int readCO2()
      {
          int CO2value = 1550;
          Serial.print(F("CO2: "));
          Serial.println(CO2value);
      
          send(msgCo2.set(CO2value)); 
      }
      
      void receive(const MyMessage &message)
      {
          // We only expect one type of message from controller. But we better check anyway.
          if (message.getType()==V_STATUS) {
              // Change relay state
              digitalWrite(message.getSensor()-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
              // Store state in eeprom
              saveState(message.getSensor(), message.getBool());
              // Write some debug info
              Serial.print("Incoming change for sensor:");
              Serial.print(message.getSensor());
              Serial.print(", New status: ");
              Serial.println(message.getBool());
          }
      }
      
      posted in MyController.org
      qobouky
      qobouky
    • RE: Cannot add Nodes trough RS 485

      Gateway
      Gateway.PNG

      Node
      Node.PNG

      Unfortunately function discover does not add anything

      posted in MyController.org
      qobouky
      qobouky
    • Cannot add Nodes trough RS 485

      Hello,

      I would like to ask you for your help. I frozen on adding a Nodes to Mycontroller.

      I am using Serial RS485 gateway - This I managed to add to MyController
      ![0_1626943900630_Gateway.JPG](Uploading 100%)

      As a Nod I am using DHT sketch with RS485 enabled and NOD definition

      #define MY_NODE_ID 22
      #define MY_PARENT_NODE_ID 0
      

      If I try to add Node manually Node is in status down
      ![0_1626944062318_Node.JPG](Uploading 100%)

      Communication between GW and Node works well

      0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RSNGA---,FQ=16,REL=255,VER=2.3.2
      0;255;3;0;9;5 TSM:INIT
      0;255;3;0;9;7 TSF:WUR:MS=0
      0;255;3;0;9;10 TSM:INIT:TSP OK
      0;255;3;0;9;13 TSM:INIT:GW MODE
      0;255;3;0;9;15 TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;19 MCO:REG:NOT NEEDED
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.3.2
      0;255;3;0;9;23 MCO:BGN:STP
      0;255;3;0;9;29 MCO:BGN:INIT OK,TSP=1
      0;255;3;0;9;33 TSM:READY:NWD REQ
      0;255;3;0;9;53 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
      0;255;3;0;9;7954 TSF:MSG:READ,22-22-0,s=0,c=1,t=1,pt=7,l=5,sg=0:41.0
      22;0;1;0;1;41.0
      

      Thank you very much for any advice

      posted in MyController.org
      qobouky
      qobouky
    • RE: RS485, no communication

      This solved my issue!! Thank you!!

      posted in Troubleshooting
      qobouky
      qobouky
    • RE: RS485, no communication

      Hi,

      I have the same issue.

      I used example library and upload Serial Gateway RS485 and Motion Sensor RS485. Both to Arduino UNO. Wiring according to (https://forum.mysensors.org/assets/uploads/files/1585670689122-example-rs485-mqtt.p)

      Gateway Log

      0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RSNGA---,FQ=16,REL=255,VER=2.3.2
      0;255;3;0;9;5 TSM:INIT
      0;255;3;0;9;7 TSF:WUR:MS=0
      0;255;3;0;9;10 TSM:INIT:TSP OK
      0;255;3;0;9;13 TSM:INIT:GW MODE
      0;255;3;0;9;15 TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;19 MCO:REG:NOT NEEDED
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.3.2
      0;255;3;0;9;23 MCO:BGN:STP
      0;255;3;0;9;29 MCO:BGN:INIT OK,TSP=1
      0;255;3;0;9;33 TSM:READY:NWD REQ
      0;255;3;0;9;53 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
      

      NOD Log

      16 MCO:BGN:INIT NODE,CP=RSNNA---,FQ=16,REL=255,VER=2.3.2
      26 TSM:INIT
      28 TSF:WUR:MS=0
      29 TSM:INIT:TSP OK
      31 TSF:SID:OK,ID=123
      32 TSM:FPAR
      51 ?TSF:MSG:SEND,123-123-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      2059 !TSM:FPAR:NO REPLY
      2061 TSM:FPAR
      2078 ?TSF:MSG:SEND,123-123-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      4086 !TSM:FPAR:NO REPLY
      4088 TSM:FPAR
      4106 ?TSF:MSG:SEND,123-123-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6114 !TSM:FPAR:NO REPLY
      6116 TSM:FPAR
      6133 ?TSF:MSG:SEND,123-123-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      8141 !TSM:FPAR:FAIL
      8142 TSM:FAIL:CNT=1
      8144 TSM:FAIL:DIS
      8146 TSF:TDI:TSL
      18148 TSM:FAIL:RE-INIT
      18150 TSM:INIT
      18151 TSM:INIT:TSP OK
      18153 TSF:SID:OK,ID=123
      18155 TSM:FPAR
      18173 ?TSF:MSG:SEND,123-123-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      20182 !TSM:FPAR:NO REPLY
      

      Try with NODE ID definition or without

      #define MY_PARENT_NODE_ID 0
      

      Thnak you for any help!!

      posted in Troubleshooting
      qobouky
      qobouky
    • RE: MQ135 with RS485

      I found an root cause.

      In pin definition was

      #define AIQ_SENSOR_ANALOG_PIN 1
      

      but should be

      #define AIQ_SENSOR_ANALOG_PIN A1
      

      I do not know why with first definition it worked with nano but did not work with mini.

      posted in Troubleshooting
      qobouky
      qobouky
    • RE: MQ135 with RS485

      @rejoe2 said in MQ135 with RS485:

      NodeID

      Hmm, I tried to define sensor as 30 but still the same result. In log of sensor I can see

      114875 !TSM:FPAR:NO REPLY
      114877 TSM:FPAR
      114895 TSF:MSG:SEND,30-30-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      

      I think that it is not a case. As I told everything works with arduino nano.

      How I can check if data from sensor are reading?
      It seems that code does not continue if sensor is not connected to gateway.

      posted in Troubleshooting
      qobouky
      qobouky
    • RE: MQ135 with RS485

      Now I replaced mini pro and used nano instead. Data were send successfully.

      Do you have any idea what can be wrong with mini pro?

      posted in Troubleshooting
      qobouky
      qobouky