Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. RFM69 ATC not working?

RFM69 ATC not working?

Scheduled Pinned Locked Moved Troubleshooting
39 Posts 6 Posters 3.6k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T TSD

    I want to use my MySensors/RFM69HW node with the lowest power possible. However, with ATC enabled, I noticed that the power is always adjusted to the maximum level possible. To investigate, I did an experiment in which I disabled ATC and increased the radio power from -2dBm to 13dBm and have the node send the receiving RSSI and sending RSSI. I recorded both the node voltage and current, as shown in the image below.

    0_1539512190978_e38431f0-03e6-44d1-82df-e9533d53cc23-image.png

    It is clear that the radio power is linearly increased, which is good. However, the reported receiving/sending RSSIs do not change, as shown by the following gateway log (format: TX power, receiving RSSI, sending RSSI):

    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-2.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-98.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-66.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-1.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-96.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-67.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:0.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-99.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-66.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:1.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-102.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-64.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:2.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-100.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-62.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:3.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-96.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-61.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:4.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-100.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-61.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:5.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-96.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-60.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:6.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-92.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-60.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:7.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-97.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-59.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:8.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-97.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-66.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:9.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-100.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-60.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:10.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-97.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-59.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:11.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-100.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-64.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:12.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-102.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-58.000
    
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:13.00
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-100.000
    TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-66.000
    

    The receiving RSSI is always about -100dBm and the sending RSSI is always around -60/-70 dBm.

    The RFM69HW has a 22uF ceramic capacitor and a 480uF elcap to decouple its power supply.

    I used MySensors 2.2.0 for this measurement, but I get the same result with 2.3.0.

    Does anyone have a clue what may be causing the RSSI to be independent of the transmit power?

    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by mfalkvidd
    #2

    @tsd are these numbers from the node’s own point of view, or the gateway’s? When (in the send/receive cycle) where they taken? How du you measure sending rssi?

    T 1 Reply Last reply
    0
    • mfalkviddM mfalkvidd

      @tsd are these numbers from the node’s own point of view, or the gateway’s? When (in the send/receive cycle) where they taken? How du you measure sending rssi?

      T Offline
      T Offline
      TSD
      wrote on last edited by
      #3

      @mfalkvidd
      These numbers are from the node point of view.

      In the main loop, there's a piece of code that contains the RSSI measurements:

      RFM69_setTxPowerLevel(i);
      
      txPower     = RFM69_getTxPowerLevel();
      rssiReceive = RFM69_getReceivingRSSI();
      rssiSend    = RFM69_getSendingRSSI();
      
      send(msgRSSI.set(txPower,2));		// Send receiving RSSI
      send(msgRSSI.set(rssiSend,3));		// Send sending RSSI
      send(msgRSSI.set(rssiReceive,3));		// Send sending RSSI
      

      Should I use these functions differently?

      mfalkviddM 1 Reply Last reply
      0
      • T TSD

        @mfalkvidd
        These numbers are from the node point of view.

        In the main loop, there's a piece of code that contains the RSSI measurements:

        RFM69_setTxPowerLevel(i);
        
        txPower     = RFM69_getTxPowerLevel();
        rssiReceive = RFM69_getReceivingRSSI();
        rssiSend    = RFM69_getSendingRSSI();
        
        send(msgRSSI.set(txPower,2));		// Send receiving RSSI
        send(msgRSSI.set(rssiSend,3));		// Send sending RSSI
        send(msgRSSI.set(rssiReceive,3));		// Send sending RSSI
        

        Should I use these functions differently?

        mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #4

        @tsd I have not used getSensdingRSSI but according to
        https://www.mysensors.org/apidocs/group__RFM69Newgrp.html#ga80da4f9f4e901b6ff7ed23e77484e8a2 ATC must be enabled for it to work.

        1 Reply Last reply
        0
        • mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by mfalkvidd
          #5

          Maybe measuring rssi at the gateway gives a better result? See https://github.com/mfalkvidd/Arduino-MySensors-ESP8266-RFM69-Gateway/blob/master/Arduino-MySensors-ESP8266-RFM69-Gateway.ino#L105 for how I’ve done that.

          1 Reply Last reply
          0
          • mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #6

            also, getReceivingRSSI will return the RSSI from the last received message. It shouldn't be affected by the TX power of the node, and it is probably only updated when a message is sent to the node.

            T 1 Reply Last reply
            0
            • mfalkviddM mfalkvidd

              also, getReceivingRSSI will return the RSSI from the last received message. It shouldn't be affected by the TX power of the node, and it is probably only updated when a message is sent to the node.

              T Offline
              T Offline
              TSD
              wrote on last edited by
              #7

              @mfalkvidd
              I added a sending a temperature measurement before RFM69_getReceivingRSSI and enabled ATC, but get a similar result. The code is now as follows (I cleaned up the comments):

              txPower = RFM69_getTxPowerLevel();       // Get TX power
              float temperature = readTemp705x();      // Read temperature
              
              send(msgTemp.set(temperature, 1),0);    // Send temperature
              
              rssiSend    = RFM69_getSendingRSSI();
              rssiReceive = RFM69_getReceivingRSSI();
              
              send(msgRSSI.set(txPower,2));		// Send TX power
              send(msgRSSI.set(rssiSend,3));		// Send sending RSSI
              send(msgRSSI.set(rssiReceive,3));	// Send receiving RSSI
              
              

              The gateway log shows that the power is increased until the maximum allowed (20 dBm), but no change in RSSI.

              TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:11.00
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-79.000
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-42.000
              
              TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:13.00
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-96.000
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-42.000
              
              TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:17.00
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-97.000
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-42.000
              
              TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:20.00
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-96.000
              TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-43.000
              

              Any idea why this doesn't work?

              I'm using a Raspberry Pi gateway now, is it easy to measure RSSI on that as well? I can switch to an Arduino gateway if required.

              mfalkviddM 1 Reply Last reply
              0
              • T TSD

                @mfalkvidd
                I added a sending a temperature measurement before RFM69_getReceivingRSSI and enabled ATC, but get a similar result. The code is now as follows (I cleaned up the comments):

                txPower = RFM69_getTxPowerLevel();       // Get TX power
                float temperature = readTemp705x();      // Read temperature
                
                send(msgTemp.set(temperature, 1),0);    // Send temperature
                
                rssiSend    = RFM69_getSendingRSSI();
                rssiReceive = RFM69_getReceivingRSSI();
                
                send(msgRSSI.set(txPower,2));		// Send TX power
                send(msgRSSI.set(rssiSend,3));		// Send sending RSSI
                send(msgRSSI.set(rssiReceive,3));	// Send receiving RSSI
                
                

                The gateway log shows that the power is increased until the maximum allowed (20 dBm), but no change in RSSI.

                TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:11.00
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-79.000
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-42.000
                
                TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:13.00
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-96.000
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-42.000
                
                TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:17.00
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-97.000
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-42.000
                
                TSF:MSG:READ,12-12-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.8
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:20.00
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-96.000
                TSF:MSG:READ,12-12-0,s=3,c=1,t=24,pt=7,l=5,sg=0:-43.000
                

                Any idea why this doesn't work?

                I'm using a Raspberry Pi gateway now, is it easy to measure RSSI on that as well? I can switch to an Arduino gateway if required.

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #8

                @tsd sorry, no idea at the moment.

                For the rpi gw, just edit https://github.com/mysensors/MySensors/blob/development/examples_linux/mysgw.cpp (add the receive function from my sketch and start from the make step)

                T 2 Replies Last reply
                0
                • mfalkviddM mfalkvidd

                  @tsd sorry, no idea at the moment.

                  For the rpi gw, just edit https://github.com/mysensors/MySensors/blob/development/examples_linux/mysgw.cpp (add the receive function from my sketch and start from the make step)

                  T Offline
                  T Offline
                  TSD
                  wrote on last edited by
                  #9

                  @mfalkvidd
                  OK, tnx for now. I'll look at gateway rssi tomorrow evening

                  1 Reply Last reply
                  1
                  • mfalkviddM mfalkvidd

                    @tsd sorry, no idea at the moment.

                    For the rpi gw, just edit https://github.com/mysensors/MySensors/blob/development/examples_linux/mysgw.cpp (add the receive function from my sketch and start from the make step)

                    T Offline
                    T Offline
                    TSD
                    wrote on last edited by
                    #10

                    @mfalkvidd
                    I modified my code to include your receive function, but I wasn't sure how to use it in the main loop.

                    #include <MySensors.h>
                    
                    
                    MyMessage msgTemp(1,V_TEMP);
                    MyMessage msgRSSI(2,V_LEVEL);
                    
                    #define ARDUINO 100
                    // This space is intended to be used to include arduino libraries
                    
                    #undef ARDUINO
                    
                    void setup()
                    {
                            // Setup locally attached sensors
                    }
                    
                    void presentation()
                    {
                            // Present locally attached sensors here
                    present(1,S_SOUND);
                    
                    }
                    
                    void loop()
                    {
                            // Send locally attached sensors data here
                    receive(msgTemp);
                    }
                    
                    void receive(const MyMessage &message)
                    {
                      int16_t rssiReceive = RFM69_getReceivingRSSI();
                      if (message.sender == 1 ) {
                        send(msgRSSI.set(rssiReceive,0));
                      }
                    }
                    
                    

                    I figured that you have to use your receive function to capture a message from the node and then do an RSSI measurement. Since I have a msgTemp coming from the node, I used that.

                    After compiling the code and running the SGW, I get the following error in the logs:

                    Serial - write failed: Resource temporarily unavailable
                    

                    Do you know what I did wrong?

                    mfalkviddM 1 Reply Last reply
                    0
                    • T TSD

                      @mfalkvidd
                      I modified my code to include your receive function, but I wasn't sure how to use it in the main loop.

                      #include <MySensors.h>
                      
                      
                      MyMessage msgTemp(1,V_TEMP);
                      MyMessage msgRSSI(2,V_LEVEL);
                      
                      #define ARDUINO 100
                      // This space is intended to be used to include arduino libraries
                      
                      #undef ARDUINO
                      
                      void setup()
                      {
                              // Setup locally attached sensors
                      }
                      
                      void presentation()
                      {
                              // Present locally attached sensors here
                      present(1,S_SOUND);
                      
                      }
                      
                      void loop()
                      {
                              // Send locally attached sensors data here
                      receive(msgTemp);
                      }
                      
                      void receive(const MyMessage &message)
                      {
                        int16_t rssiReceive = RFM69_getReceivingRSSI();
                        if (message.sender == 1 ) {
                          send(msgRSSI.set(rssiReceive,0));
                        }
                      }
                      
                      

                      I figured that you have to use your receive function to capture a message from the node and then do an RSSI measurement. Since I have a msgTemp coming from the node, I used that.

                      After compiling the code and running the SGW, I get the following error in the logs:

                      Serial - write failed: Resource temporarily unavailable
                      

                      Do you know what I did wrong?

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by mfalkvidd
                      #11

                      @tsd

                       present(1,S_SOUND);
                      

                      should be

                      present(2,S_SOUND);
                      

                      and you don’t need MyMessage msgTemp(1,V_TEMP);

                      I am not sure about the error. Are you using the rpi gw as serial, mqtt or ethernet gw? (What was your configure command?)

                      T 2 Replies Last reply
                      0
                      • mfalkviddM mfalkvidd

                        @tsd

                         present(1,S_SOUND);
                        

                        should be

                        present(2,S_SOUND);
                        

                        and you don’t need MyMessage msgTemp(1,V_TEMP);

                        I am not sure about the error. Are you using the rpi gw as serial, mqtt or ethernet gw? (What was your configure command?)

                        T Offline
                        T Offline
                        TSD
                        wrote on last edited by
                        #12

                        @mfalkvidd
                        I improved the power supply of the RFM (added linear regulator) on the gateway and the error is gone.

                        The code doesn't compile if I don't declare msgTemp, as I use msgTemp in the main loop.

                        Where should I see the message the GW is sending? On the node? I'm using a custom node without a serial connection, so I can't see incoming messages on the node. Is there a way to have the GW send the RSSI to its own log?

                        mfalkviddM 1 Reply Last reply
                        0
                        • mfalkviddM mfalkvidd

                          @tsd

                           present(1,S_SOUND);
                          

                          should be

                          present(2,S_SOUND);
                          

                          and you don’t need MyMessage msgTemp(1,V_TEMP);

                          I am not sure about the error. Are you using the rpi gw as serial, mqtt or ethernet gw? (What was your configure command?)

                          T Offline
                          T Offline
                          TSD
                          wrote on last edited by
                          #13

                          @mfalkvidd
                          I was using serial gateway by the way.

                          1 Reply Last reply
                          0
                          • T TSD

                            @mfalkvidd
                            I improved the power supply of the RFM (added linear regulator) on the gateway and the error is gone.

                            The code doesn't compile if I don't declare msgTemp, as I use msgTemp in the main loop.

                            Where should I see the message the GW is sending? On the node? I'm using a custom node without a serial connection, so I can't see incoming messages on the node. Is there a way to have the GW send the RSSI to its own log?

                            mfalkviddM Offline
                            mfalkviddM Offline
                            mfalkvidd
                            Mod
                            wrote on last edited by mfalkvidd
                            #14

                            @tsd I don’t know. I've always connected the gateways to my controller where I get logs and graphs.

                            Maybe you can use GATEWAY_DEBUG(text)

                            T 1 Reply Last reply
                            0
                            • mfalkviddM mfalkvidd

                              @tsd I don’t know. I've always connected the gateways to my controller where I get logs and graphs.

                              Maybe you can use GATEWAY_DEBUG(text)

                              T Offline
                              T Offline
                              TSD
                              wrote on last edited by
                              #15

                              @mfalkvidd

                              #define GATEWAY_DEBUG(text)
                              

                              or

                              #define MY_DEBUG
                              

                              doesn't show any additional messages in the log, besides the node messages.

                              In the mean time I installed Domoticz to try it your way, but don't see the USB port that I tried to make by installing the serial gateway (ttyUSB020, which is not in /dev yet, so should be free).

                              This command should take care of that, right?

                              ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
                              

                              Sorry to be such a pain, but I would really like to get this sorted out.

                              mfalkviddM 1 Reply Last reply
                              0
                              • T TSD

                                @mfalkvidd

                                #define GATEWAY_DEBUG(text)
                                

                                or

                                #define MY_DEBUG
                                

                                doesn't show any additional messages in the log, besides the node messages.

                                In the mean time I installed Domoticz to try it your way, but don't see the USB port that I tried to make by installing the serial gateway (ttyUSB020, which is not in /dev yet, so should be free).

                                This command should take care of that, right?

                                ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
                                

                                Sorry to be such a pain, but I would really like to get this sorted out.

                                mfalkviddM Offline
                                mfalkviddM Offline
                                mfalkvidd
                                Mod
                                wrote on last edited by
                                #16

                                @tsd sorry for being unclear. This is how to use GATEWAY_DEBUG:

                                GATEWAY_DEBUG("This message will be sent to the debug log")
                                

                                But I am not sure it is available in sketches and I don't have access to a computer at the moment.

                                The configure command looks good. After running configure, did you continue with make, etc?

                                T 1 Reply Last reply
                                0
                                • mfalkviddM mfalkvidd

                                  @tsd sorry for being unclear. This is how to use GATEWAY_DEBUG:

                                  GATEWAY_DEBUG("This message will be sent to the debug log")
                                  

                                  But I am not sure it is available in sketches and I don't have access to a computer at the moment.

                                  The configure command looks good. After running configure, did you continue with make, etc?

                                  T Offline
                                  T Offline
                                  TSD
                                  wrote on last edited by
                                  #17

                                  @mfalkvidd
                                  Do you mean

                                  #define MY_DEBUG_VERBOSE_GATEWAY
                                  

                                  That uses the GATEWAY_DEBUG("text") macro that you are referring to. I tried that, but it doesn't give any additional output in the log.

                                  Yes, this is the complete code I run:

                                  sudo ./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
                                  sudo make install
                                  sudo systemctl start mysgw.service
                                  

                                  But ttyUSB020 doesn't appear in /dev afterwards, nor does Domoticz list it.

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • T TSD

                                    @mfalkvidd
                                    Do you mean

                                    #define MY_DEBUG_VERBOSE_GATEWAY
                                    

                                    That uses the GATEWAY_DEBUG("text") macro that you are referring to. I tried that, but it doesn't give any additional output in the log.

                                    Yes, this is the complete code I run:

                                    sudo ./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
                                    sudo make install
                                    sudo systemctl start mysgw.service
                                    

                                    But ttyUSB020 doesn't appear in /dev afterwards, nor does Domoticz list it.

                                    mfalkviddM Offline
                                    mfalkviddM Offline
                                    mfalkvidd
                                    Mod
                                    wrote on last edited by mfalkvidd
                                    #18

                                    @tsd I think you'll need to run make before make install.

                                    configure prepares the settings for make
                                    make compiles the code into an executable file called mysgw, including changes to the cpp file and the settings from the configure command
                                    make install copies the mysgw executable to /etc/init.d/

                                    1 Reply Last reply
                                    0
                                    • T Offline
                                      T Offline
                                      TSD
                                      wrote on last edited by
                                      #19

                                      If I run "make install" while the code has not compiled yet, it will compile before installing. If you first run "make" seperately, "make install" will only install.

                                      I'm almost there. I configured an Ethernet gateway (couldn't get serial gateway to work) and can now see the temperature, receive RSSI and sending RSSI from the node in Domoticz.

                                      The gateway receive function shows up as "S_ARDUINO_REPEATER_NODE", but there's no data yet.

                                      What data should I pass on to your receive function? My gateway code is now as follows:

                                      #define MY_DEBUG_VERBOSE_GATEWAY
                                      #include <MySensors.h>
                                      
                                      
                                      MyMessage msgTemp(1,V_TEMP);
                                      MyMessage msgRSSI(2,V_LEVEL);
                                      
                                      #define ARDUINO 100
                                      // This space is intended to be used to include arduino libraries
                                      
                                      #undef ARDUINO
                                      
                                      void setup()
                                      {
                                              // Setup locally attached sensors
                                      }
                                      
                                      void presentation()
                                      {
                                              // Present locally attached sensors here
                                      present(2,S_SOUND);
                                      }
                                      
                                      void loop()
                                      {
                                              // Send locally attached sensors data here
                                      receive(msgTemp);
                                      }
                                      
                                      void receive(const MyMessage &message)
                                      {
                                        int16_t rssiReceive = RFM69_getReceivingRSSI();
                                        if (message.sender == 1 ) {
                                          send(msgRSSI.set(rssiReceive,0));
                                        }
                                      }
                                      
                                      
                                      mfalkviddM 1 Reply Last reply
                                      1
                                      • T TSD

                                        If I run "make install" while the code has not compiled yet, it will compile before installing. If you first run "make" seperately, "make install" will only install.

                                        I'm almost there. I configured an Ethernet gateway (couldn't get serial gateway to work) and can now see the temperature, receive RSSI and sending RSSI from the node in Domoticz.

                                        The gateway receive function shows up as "S_ARDUINO_REPEATER_NODE", but there's no data yet.

                                        What data should I pass on to your receive function? My gateway code is now as follows:

                                        #define MY_DEBUG_VERBOSE_GATEWAY
                                        #include <MySensors.h>
                                        
                                        
                                        MyMessage msgTemp(1,V_TEMP);
                                        MyMessage msgRSSI(2,V_LEVEL);
                                        
                                        #define ARDUINO 100
                                        // This space is intended to be used to include arduino libraries
                                        
                                        #undef ARDUINO
                                        
                                        void setup()
                                        {
                                                // Setup locally attached sensors
                                        }
                                        
                                        void presentation()
                                        {
                                                // Present locally attached sensors here
                                        present(2,S_SOUND);
                                        }
                                        
                                        void loop()
                                        {
                                                // Send locally attached sensors data here
                                        receive(msgTemp);
                                        }
                                        
                                        void receive(const MyMessage &message)
                                        {
                                          int16_t rssiReceive = RFM69_getReceivingRSSI();
                                          if (message.sender == 1 ) {
                                            send(msgRSSI.set(rssiReceive,0));
                                          }
                                        }
                                        
                                        
                                        mfalkviddM Offline
                                        mfalkviddM Offline
                                        mfalkvidd
                                        Mod
                                        wrote on last edited by
                                        #20

                                        @tsd MySensors will automatically call receive() when the node receives a message. It should not be called manually.

                                        1 Reply Last reply
                                        0
                                        • gohanG Offline
                                          gohanG Offline
                                          gohan
                                          Mod
                                          wrote on last edited by
                                          #21

                                          This is how I monitor RSSI and power % from the node: sending RSSI should be close to the RSSI target value set in the config file. I left atc enabled and if I move the node away from the gateway I see the power % going up while RSSI value stays more or less the same.

                                          #ifdef MY_RADIO_RFM69
                                          	rssi = RFM69_getSendingRSSI();             // read RSSI in RFM69. Measure reception signal from gw
                                          	send(msgRSSI1.set(rssi));                  // send RSSI level
                                          	wait(500);                                 // wait to get idle
                                          
                                          	rssi = RFM69_getReceivingRSSI();           // read RSSI in RFM69. Wait and measure background noise
                                          	send(msgRSSI2.set(rssi));                  // send RSSI level
                                          	wait(200);                                 // wait for next send
                                          
                                          	PwrPcnt = RFM69_getTxPowerPercent();      // read TX Power in RFM69
                                          	send(msgPWR.set(PwrPcnt));				  // send TX Power
                                          #endif
                                          
                                          T 1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          12

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular