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. Development
  3. rfm69 and atc

rfm69 and atc

Scheduled Pinned Locked Moved Development
49 Posts 13 Posters 15.5k Views 12 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.
  • FleischtorteF Offline
    FleischtorteF Offline
    Fleischtorte
    wrote on last edited by
    #27

    Hi Scalz,

    any progress here? Cant wait to use ATC and the rssi-value for my nodes :D
    Thanks for your work :thumbsup:

    regards
    david

    carlierdC 1 Reply Last reply
    0
    • FleischtorteF Fleischtorte

      Hi Scalz,

      any progress here? Cant wait to use ATC and the rssi-value for my nodes :D
      Thanks for your work :thumbsup:

      regards
      david

      carlierdC Offline
      carlierdC Offline
      carlierd
      wrote on last edited by
      #28

      @Fleischtorte So I am not the only one David waiting for ATC and RSSI ;)

      David.

      1 Reply Last reply
      0
      • FleischtorteF Offline
        FleischtorteF Offline
        Fleischtorte
        wrote on last edited by
        #29

        @carlierd Yeah Davids FTW :D

        1 Reply Last reply
        0
        • frenchoF Offline
          frenchoF Offline
          frencho
          wrote on last edited by
          #30

          @lafleur @scalz
          Hi guys,
          Have one of you succed with the PR, so we can enjoy at least the ATC feature.

          This is really the down side with the RFM69HW, power consumption so your work could be really helpfull !

          Really thank you for that

          Your second life begins when you understand you only have one !

          L 1 Reply Last reply
          0
          • frenchoF frencho

            @lafleur @scalz
            Hi guys,
            Have one of you succed with the PR, so we can enjoy at least the ATC feature.

            This is really the down side with the RFM69HW, power consumption so your work could be really helpfull !

            Really thank you for that

            L Offline
            L Offline
            lafleur
            wrote on last edited by lafleur
            #31

            @frencho

            I have it all working, but my development environment and Jenkins are not in alignment, so my PR was rejected by the development team. They provide me NO help in resolving the issue... They tend to favor and support only the older NRF24L01 radio and have little interests in the newer, better preforming RFM69 or RFM95 radios. So have a look at my code changes in the close PR. It was not hard to implement. I have move on.....

            frenchoF 1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by hek
              #32

              @lafleur

              I'm sorry if your feelings got hurt. But you simply wouldn't do what the team instructed you in PR #440 to get it merged.

              https://github.com/mysensors/MySensors/pull/440

              1 Reply Last reply
              1
              • L lafleur

                @frencho

                I have it all working, but my development environment and Jenkins are not in alignment, so my PR was rejected by the development team. They provide me NO help in resolving the issue... They tend to favor and support only the older NRF24L01 radio and have little interests in the newer, better preforming RFM69 or RFM95 radios. So have a look at my code changes in the close PR. It was not hard to implement. I have move on.....

                frenchoF Offline
                frenchoF Offline
                frencho
                wrote on last edited by
                #33

                Thanks @lafleur, found your PR, I will try to do my own thing based on your work. Shouldn't be a big deal.

                Your second life begins when you understand you only have one !

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lafleur
                  wrote on last edited by
                  #34

                  I did exactly what you ask, but it continued to fail in building the examples... In another PR, you pointed out that there were issue in building the examples under IDE 1.6.9.

                  My feeling were not hurt, but I did NOT want to wast anymore time in dealing with Jenkins with out guidance.... Also there is NO guide on what Jenkins expect to see in its development environment. it all trial and error...

                  FYI... I have developed RFM95 and TTN transport layers for my snapshot of your code.

                  1 Reply Last reply
                  0
                  • scalzS Offline
                    scalzS Offline
                    scalz
                    Hardware Contributor
                    wrote on last edited by
                    #35

                    @frencho @lafleur
                    sorry for this delay. i'm busy, running..sometimes i refresh myself doing some sw but I admit i spent more time on hw than looking how to cleanly do this PR. ouch :sweat: but for me it has to be hobby even if I'm always rushing myself.
                    you're not true ;) in fact mysensors team is not nrf24 only :)

                    as soon as i can, i will look. it could be a bit time consuming as it would be my first PR, why i always delay..boo lazy i am :blush: The best way I think (as, now, I'm not up to date with dev branch, I will need diffchecking my stuff):

                    • I would start/improve PR437 with minor changes needed. As mysensors drivers compiles ok, i would do in this way than taking lowpowerlab lib first (all warnings enabled of course)
                    • then a separated for ATC + or another one for ListenMode. to have a better history and not breaking anything.

                    so, I would separate the PR. I don't know if you tried like this (if i'm overhead), or what were your PR issue. I will look a bit later for curiosity or in case I would run in similar issue hihi.

                    Cool if you have it working :)

                    1 Reply Last reply
                    0
                    • FleischtorteF Offline
                      FleischtorteF Offline
                      Fleischtorte
                      wrote on last edited by
                      #36

                      @lafleur thanks for your work! On the weekend i was able to upgrade the driver and enable ATC with RSSI-Report. With the instructions from PR440 it was very easy :thumbsup:

                      frenchoF 1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        lafleur
                        wrote on last edited by
                        #37

                        It's great to see that you got it all working from the PR440. I hope others will find your work useful....

                        I'm my test,it works very well.....

                        B 1 Reply Last reply
                        0
                        • FleischtorteF Fleischtorte

                          @lafleur thanks for your work! On the weekend i was able to upgrade the driver and enable ATC with RSSI-Report. With the instructions from PR440 it was very easy :thumbsup:

                          frenchoF Offline
                          frenchoF Offline
                          frencho
                          wrote on last edited by
                          #38

                          @Fleischtorte would you accept to share the work ? I started to play with the RFM69, but didn't get to the ATC part yet. It could save me a couple of hours, and debug ^^

                          Your second life begins when you understand you only have one !

                          1 Reply Last reply
                          0
                          • L lafleur

                            It's great to see that you got it all working from the PR440. I hope others will find your work useful....

                            I'm my test,it works very well.....

                            B Offline
                            B Offline
                            BenCranston
                            wrote on last edited by
                            #39

                            @lafleur @Fleischtorte @frencho I think I'm a bit dense today. I don't understand where the code currently sits in terms of something that could be tested. I see that PR440 was closed and referenced to go back to PR437 or open a new PR? I'd love to give ATC code a go on my RFM69HW's. Is it being integrated into the development branch? How would I go about testing at this time? I did a quick look at the codebase in git and there is no mention of ATC in the MySensors dev branch... A quick diff of the RFM69.cpp code from Felix and MySensors shows a few differences, so they are not 100% in sync. Alas, I'm at a loss on how to apply the work already done to test.. I can "git clone" like a banshee, but beyond that I'm lost with Jenkins. Sorry, again, dense today...

                            Any advice on how I can help is appreciated. I can test pretty easily. All of my nodes are Moteino's with RFM69HW radios.

                            Thanks again for everyone's efforts and work to make ATC a reality in the MySensors codebase!

                            1 Reply Last reply
                            0
                            • FleischtorteF Offline
                              FleischtorteF Offline
                              Fleischtorte
                              wrote on last edited by Fleischtorte
                              #40

                              @frencho @BenCranston
                              This is my implementation of PR440

                              first download new RFM69 driver from LowPowerLab https://github.com/LowPowerLab/RFM69/archive/master.zip
                              Replace the files from libraries\MySensors\drivers\RFM69 (copy all and replace)

                              Change in file RFM69.cpp line 31-32

                              #include <RFM69.h>
                              #include <RFM69registers.h>
                              

                              to

                              #include "RFM69.h"
                              #include "RFM69registers.h"
                              

                              in RFM69_ATC.cpp line 32-34

                              #include <RFM69_ATC.h>
                              #include <RFM69.h>   // include the RFM69 library files as well
                              #include <RFM69registers.h>
                              

                              to

                              #include "RFM69_ATC.h"
                              #include "RFM69.h"   // include the RFM69 library files as well
                              #include "RFM69registers.h"
                              

                              i think this was the driver..

                              next was mysensors

                              in file libraries/MySensors/MySensor.h line 268

                              #include "drivers/RFM69/RFM69_ATC.cpp"
                              

                              in file libraries/MySensors/core/MyTransportRFM69.cpp
                              first in line 24

                              #include "drivers/RFM69/RFM69_ATC.h"
                              

                              line 25-26

                              RFM69 _radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                              uint8_t _address;
                              

                              to

                              #ifdef MY_RFM69_Enable_ATC
                                 RFM69_ATC 	_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                              #else
                                 RFM69 		_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);	
                              #endif
                              uint8_t _address;
                              

                              and line 53 idk if this is necessary

                              return _radio.sendWithRetry(to,data,len);
                              

                              to

                              	return _radio.sendWithRetry(to,data,len,5);
                              

                              btw i use not the dev version

                              https://github.com/mysensors/MySensors/pull/440 see comment from trlafleur

                              there is my testing node (molgan PIR )

                              /**
                               * The MySensors Arduino library handles the wireless radio link and protocol
                               * between your home built sensors/actuators and HA controller of choice.
                               * The sensors forms a self healing radio network with optional repeaters. Each
                               * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                               * network topology allowing messages to be routed to nodes.
                               *
                               * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                               * Copyright (C) 2013-2015 Sensnology AB
                               * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                               *
                               * Documentation: http://www.mysensors.org
                               * Support Forum: http://forum.mysensors.org
                               *
                               * This program is free software; you can redistribute it and/or
                               * modify it under the terms of the GNU General Public License
                               * version 2 as published by the Free Software Foundation.
                               *
                               *******************************
                               *
                               * REVISION HISTORY
                               * Version 1.0 - Henrik Ekblad
                               * 
                               * DESCRIPTION
                               * Motion Sensor example using HC-SR501 
                               * http://www.mysensors.org/build/motion
                               *
                               */
                              
                              // Enable debug prints
                              #define MY_DEBUG
                              
                              // Enable and select radio type attached
                              
                              #define MY_NODE_ID 4
                              #define MY_RADIO_RFM69
                              #define MY_RFM69_FREQUENCY RF69_868MHZ
                              #define MY_RFM69_NETWORKID 121
                              #define MY_RFM69_ENABLE_ENCRYPTION
                              #define MY_RFM69_Enable_ATC
                              #include <SPI.h>
                              #include <MySensors.h>
                              
                              unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                              #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                              #define CHILD_ID 1   // Id of the sensor child
                              #define CHILD_ID_RSSI 7 // Id for RSSI Value
                              
                              // Initialize motion message
                              MyMessage msg(CHILD_ID, V_TRIPPED);
                              // Initialize RSSI message
                              MyMessage rssiMsg(CHILD_ID_RSSI,V_TEXT);
                              void setup()  
                              {  
                                
                                
                                #ifdef MY_RFM69_Enable_ATC
                                  _radio.enableAutoPower(-70);
                                  Serial.println("ATC Aktiviert");
                                #endif
                                
                                pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                              }
                              
                              void presentation()  {
                                // Send the sketch version information to the gateway and Controller
                                sendSketchInfo("Molgan-PIR", "1.0");
                              
                                // Register all sensors to gw (they will be created as child devices)
                                present(CHILD_ID, S_DOOR);
                                present(CHILD_ID_RSSI, S_INFO);
                              }
                              
                              void loop()     
                              {     
                                // Read digital motion value
                                boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                                      
                                Serial.println(tripped);
                                send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
                                
                                int var1 = _radio.RSSI;
                                send(rssiMsg.set(var1));  // Send RSSI value to gw
                              
                                // Sleep until interrupt comes in on motion sensor. Send update every two minute.
                                sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
                              }
                              
                              

                              i hope this helps :) im just learing mysensors & co :expressionless:

                              david

                              B frenchoF 3 Replies Last reply
                              2
                              • FleischtorteF Fleischtorte

                                @frencho @BenCranston
                                This is my implementation of PR440

                                first download new RFM69 driver from LowPowerLab https://github.com/LowPowerLab/RFM69/archive/master.zip
                                Replace the files from libraries\MySensors\drivers\RFM69 (copy all and replace)

                                Change in file RFM69.cpp line 31-32

                                #include <RFM69.h>
                                #include <RFM69registers.h>
                                

                                to

                                #include "RFM69.h"
                                #include "RFM69registers.h"
                                

                                in RFM69_ATC.cpp line 32-34

                                #include <RFM69_ATC.h>
                                #include <RFM69.h>   // include the RFM69 library files as well
                                #include <RFM69registers.h>
                                

                                to

                                #include "RFM69_ATC.h"
                                #include "RFM69.h"   // include the RFM69 library files as well
                                #include "RFM69registers.h"
                                

                                i think this was the driver..

                                next was mysensors

                                in file libraries/MySensors/MySensor.h line 268

                                #include "drivers/RFM69/RFM69_ATC.cpp"
                                

                                in file libraries/MySensors/core/MyTransportRFM69.cpp
                                first in line 24

                                #include "drivers/RFM69/RFM69_ATC.h"
                                

                                line 25-26

                                RFM69 _radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                                uint8_t _address;
                                

                                to

                                #ifdef MY_RFM69_Enable_ATC
                                   RFM69_ATC 	_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                                #else
                                   RFM69 		_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);	
                                #endif
                                uint8_t _address;
                                

                                and line 53 idk if this is necessary

                                return _radio.sendWithRetry(to,data,len);
                                

                                to

                                	return _radio.sendWithRetry(to,data,len,5);
                                

                                btw i use not the dev version

                                https://github.com/mysensors/MySensors/pull/440 see comment from trlafleur

                                there is my testing node (molgan PIR )

                                /**
                                 * The MySensors Arduino library handles the wireless radio link and protocol
                                 * between your home built sensors/actuators and HA controller of choice.
                                 * The sensors forms a self healing radio network with optional repeaters. Each
                                 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                 * network topology allowing messages to be routed to nodes.
                                 *
                                 * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                 * Copyright (C) 2013-2015 Sensnology AB
                                 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                 *
                                 * Documentation: http://www.mysensors.org
                                 * Support Forum: http://forum.mysensors.org
                                 *
                                 * This program is free software; you can redistribute it and/or
                                 * modify it under the terms of the GNU General Public License
                                 * version 2 as published by the Free Software Foundation.
                                 *
                                 *******************************
                                 *
                                 * REVISION HISTORY
                                 * Version 1.0 - Henrik Ekblad
                                 * 
                                 * DESCRIPTION
                                 * Motion Sensor example using HC-SR501 
                                 * http://www.mysensors.org/build/motion
                                 *
                                 */
                                
                                // Enable debug prints
                                #define MY_DEBUG
                                
                                // Enable and select radio type attached
                                
                                #define MY_NODE_ID 4
                                #define MY_RADIO_RFM69
                                #define MY_RFM69_FREQUENCY RF69_868MHZ
                                #define MY_RFM69_NETWORKID 121
                                #define MY_RFM69_ENABLE_ENCRYPTION
                                #define MY_RFM69_Enable_ATC
                                #include <SPI.h>
                                #include <MySensors.h>
                                
                                unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                                #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                                #define CHILD_ID 1   // Id of the sensor child
                                #define CHILD_ID_RSSI 7 // Id for RSSI Value
                                
                                // Initialize motion message
                                MyMessage msg(CHILD_ID, V_TRIPPED);
                                // Initialize RSSI message
                                MyMessage rssiMsg(CHILD_ID_RSSI,V_TEXT);
                                void setup()  
                                {  
                                  
                                  
                                  #ifdef MY_RFM69_Enable_ATC
                                    _radio.enableAutoPower(-70);
                                    Serial.println("ATC Aktiviert");
                                  #endif
                                  
                                  pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                                }
                                
                                void presentation()  {
                                  // Send the sketch version information to the gateway and Controller
                                  sendSketchInfo("Molgan-PIR", "1.0");
                                
                                  // Register all sensors to gw (they will be created as child devices)
                                  present(CHILD_ID, S_DOOR);
                                  present(CHILD_ID_RSSI, S_INFO);
                                }
                                
                                void loop()     
                                {     
                                  // Read digital motion value
                                  boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                                        
                                  Serial.println(tripped);
                                  send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
                                  
                                  int var1 = _radio.RSSI;
                                  send(rssiMsg.set(var1));  // Send RSSI value to gw
                                
                                  // Sleep until interrupt comes in on motion sensor. Send update every two minute.
                                  sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
                                }
                                
                                

                                i hope this helps :) im just learing mysensors & co :expressionless:

                                david

                                B Offline
                                B Offline
                                BenCranston
                                wrote on last edited by
                                #41

                                @Fleischtorte Sweet!! This I can do. I'll make the changes and start testing tonight. thanks for the explicit help.

                                -Ben

                                frenchoF 1 Reply Last reply
                                0
                                • FleischtorteF Fleischtorte

                                  @frencho @BenCranston
                                  This is my implementation of PR440

                                  first download new RFM69 driver from LowPowerLab https://github.com/LowPowerLab/RFM69/archive/master.zip
                                  Replace the files from libraries\MySensors\drivers\RFM69 (copy all and replace)

                                  Change in file RFM69.cpp line 31-32

                                  #include <RFM69.h>
                                  #include <RFM69registers.h>
                                  

                                  to

                                  #include "RFM69.h"
                                  #include "RFM69registers.h"
                                  

                                  in RFM69_ATC.cpp line 32-34

                                  #include <RFM69_ATC.h>
                                  #include <RFM69.h>   // include the RFM69 library files as well
                                  #include <RFM69registers.h>
                                  

                                  to

                                  #include "RFM69_ATC.h"
                                  #include "RFM69.h"   // include the RFM69 library files as well
                                  #include "RFM69registers.h"
                                  

                                  i think this was the driver..

                                  next was mysensors

                                  in file libraries/MySensors/MySensor.h line 268

                                  #include "drivers/RFM69/RFM69_ATC.cpp"
                                  

                                  in file libraries/MySensors/core/MyTransportRFM69.cpp
                                  first in line 24

                                  #include "drivers/RFM69/RFM69_ATC.h"
                                  

                                  line 25-26

                                  RFM69 _radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                                  uint8_t _address;
                                  

                                  to

                                  #ifdef MY_RFM69_Enable_ATC
                                     RFM69_ATC 	_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                                  #else
                                     RFM69 		_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);	
                                  #endif
                                  uint8_t _address;
                                  

                                  and line 53 idk if this is necessary

                                  return _radio.sendWithRetry(to,data,len);
                                  

                                  to

                                  	return _radio.sendWithRetry(to,data,len,5);
                                  

                                  btw i use not the dev version

                                  https://github.com/mysensors/MySensors/pull/440 see comment from trlafleur

                                  there is my testing node (molgan PIR )

                                  /**
                                   * The MySensors Arduino library handles the wireless radio link and protocol
                                   * between your home built sensors/actuators and HA controller of choice.
                                   * The sensors forms a self healing radio network with optional repeaters. Each
                                   * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                   * network topology allowing messages to be routed to nodes.
                                   *
                                   * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                   * Copyright (C) 2013-2015 Sensnology AB
                                   * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                   *
                                   * Documentation: http://www.mysensors.org
                                   * Support Forum: http://forum.mysensors.org
                                   *
                                   * This program is free software; you can redistribute it and/or
                                   * modify it under the terms of the GNU General Public License
                                   * version 2 as published by the Free Software Foundation.
                                   *
                                   *******************************
                                   *
                                   * REVISION HISTORY
                                   * Version 1.0 - Henrik Ekblad
                                   * 
                                   * DESCRIPTION
                                   * Motion Sensor example using HC-SR501 
                                   * http://www.mysensors.org/build/motion
                                   *
                                   */
                                  
                                  // Enable debug prints
                                  #define MY_DEBUG
                                  
                                  // Enable and select radio type attached
                                  
                                  #define MY_NODE_ID 4
                                  #define MY_RADIO_RFM69
                                  #define MY_RFM69_FREQUENCY RF69_868MHZ
                                  #define MY_RFM69_NETWORKID 121
                                  #define MY_RFM69_ENABLE_ENCRYPTION
                                  #define MY_RFM69_Enable_ATC
                                  #include <SPI.h>
                                  #include <MySensors.h>
                                  
                                  unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                                  #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                                  #define CHILD_ID 1   // Id of the sensor child
                                  #define CHILD_ID_RSSI 7 // Id for RSSI Value
                                  
                                  // Initialize motion message
                                  MyMessage msg(CHILD_ID, V_TRIPPED);
                                  // Initialize RSSI message
                                  MyMessage rssiMsg(CHILD_ID_RSSI,V_TEXT);
                                  void setup()  
                                  {  
                                    
                                    
                                    #ifdef MY_RFM69_Enable_ATC
                                      _radio.enableAutoPower(-70);
                                      Serial.println("ATC Aktiviert");
                                    #endif
                                    
                                    pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                                  }
                                  
                                  void presentation()  {
                                    // Send the sketch version information to the gateway and Controller
                                    sendSketchInfo("Molgan-PIR", "1.0");
                                  
                                    // Register all sensors to gw (they will be created as child devices)
                                    present(CHILD_ID, S_DOOR);
                                    present(CHILD_ID_RSSI, S_INFO);
                                  }
                                  
                                  void loop()     
                                  {     
                                    // Read digital motion value
                                    boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                                          
                                    Serial.println(tripped);
                                    send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
                                    
                                    int var1 = _radio.RSSI;
                                    send(rssiMsg.set(var1));  // Send RSSI value to gw
                                  
                                    // Sleep until interrupt comes in on motion sensor. Send update every two minute.
                                    sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
                                  }
                                  
                                  

                                  i hope this helps :) im just learing mysensors & co :expressionless:

                                  david

                                  frenchoF Offline
                                  frenchoF Offline
                                  frencho
                                  wrote on last edited by
                                  #42

                                  @Fleischtorte
                                  thanks for the details, I'll look into it, as soon as I have my RFM69 GW talking to my RFM69 node

                                  Your second life begins when you understand you only have one !

                                  1 Reply Last reply
                                  0
                                  • FleischtorteF Fleischtorte

                                    @frencho @BenCranston
                                    This is my implementation of PR440

                                    first download new RFM69 driver from LowPowerLab https://github.com/LowPowerLab/RFM69/archive/master.zip
                                    Replace the files from libraries\MySensors\drivers\RFM69 (copy all and replace)

                                    Change in file RFM69.cpp line 31-32

                                    #include <RFM69.h>
                                    #include <RFM69registers.h>
                                    

                                    to

                                    #include "RFM69.h"
                                    #include "RFM69registers.h"
                                    

                                    in RFM69_ATC.cpp line 32-34

                                    #include <RFM69_ATC.h>
                                    #include <RFM69.h>   // include the RFM69 library files as well
                                    #include <RFM69registers.h>
                                    

                                    to

                                    #include "RFM69_ATC.h"
                                    #include "RFM69.h"   // include the RFM69 library files as well
                                    #include "RFM69registers.h"
                                    

                                    i think this was the driver..

                                    next was mysensors

                                    in file libraries/MySensors/MySensor.h line 268

                                    #include "drivers/RFM69/RFM69_ATC.cpp"
                                    

                                    in file libraries/MySensors/core/MyTransportRFM69.cpp
                                    first in line 24

                                    #include "drivers/RFM69/RFM69_ATC.h"
                                    

                                    line 25-26

                                    RFM69 _radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                                    uint8_t _address;
                                    

                                    to

                                    #ifdef MY_RFM69_Enable_ATC
                                       RFM69_ATC 	_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);
                                    #else
                                       RFM69 		_radio(MY_RF69_SPI_CS, MY_RF69_IRQ_PIN, MY_RFM69HW, MY_RF69_IRQ_NUM);	
                                    #endif
                                    uint8_t _address;
                                    

                                    and line 53 idk if this is necessary

                                    return _radio.sendWithRetry(to,data,len);
                                    

                                    to

                                    	return _radio.sendWithRetry(to,data,len,5);
                                    

                                    btw i use not the dev version

                                    https://github.com/mysensors/MySensors/pull/440 see comment from trlafleur

                                    there is my testing node (molgan PIR )

                                    /**
                                     * The MySensors Arduino library handles the wireless radio link and protocol
                                     * between your home built sensors/actuators and HA controller of choice.
                                     * The sensors forms a self healing radio network with optional repeaters. Each
                                     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                     * network topology allowing messages to be routed to nodes.
                                     *
                                     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                     * Copyright (C) 2013-2015 Sensnology AB
                                     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                     *
                                     * Documentation: http://www.mysensors.org
                                     * Support Forum: http://forum.mysensors.org
                                     *
                                     * This program is free software; you can redistribute it and/or
                                     * modify it under the terms of the GNU General Public License
                                     * version 2 as published by the Free Software Foundation.
                                     *
                                     *******************************
                                     *
                                     * REVISION HISTORY
                                     * Version 1.0 - Henrik Ekblad
                                     * 
                                     * DESCRIPTION
                                     * Motion Sensor example using HC-SR501 
                                     * http://www.mysensors.org/build/motion
                                     *
                                     */
                                    
                                    // Enable debug prints
                                    #define MY_DEBUG
                                    
                                    // Enable and select radio type attached
                                    
                                    #define MY_NODE_ID 4
                                    #define MY_RADIO_RFM69
                                    #define MY_RFM69_FREQUENCY RF69_868MHZ
                                    #define MY_RFM69_NETWORKID 121
                                    #define MY_RFM69_ENABLE_ENCRYPTION
                                    #define MY_RFM69_Enable_ATC
                                    #include <SPI.h>
                                    #include <MySensors.h>
                                    
                                    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                                    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                                    #define CHILD_ID 1   // Id of the sensor child
                                    #define CHILD_ID_RSSI 7 // Id for RSSI Value
                                    
                                    // Initialize motion message
                                    MyMessage msg(CHILD_ID, V_TRIPPED);
                                    // Initialize RSSI message
                                    MyMessage rssiMsg(CHILD_ID_RSSI,V_TEXT);
                                    void setup()  
                                    {  
                                      
                                      
                                      #ifdef MY_RFM69_Enable_ATC
                                        _radio.enableAutoPower(-70);
                                        Serial.println("ATC Aktiviert");
                                      #endif
                                      
                                      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                                    }
                                    
                                    void presentation()  {
                                      // Send the sketch version information to the gateway and Controller
                                      sendSketchInfo("Molgan-PIR", "1.0");
                                    
                                      // Register all sensors to gw (they will be created as child devices)
                                      present(CHILD_ID, S_DOOR);
                                      present(CHILD_ID_RSSI, S_INFO);
                                    }
                                    
                                    void loop()     
                                    {     
                                      // Read digital motion value
                                      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                                            
                                      Serial.println(tripped);
                                      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
                                      
                                      int var1 = _radio.RSSI;
                                      send(rssiMsg.set(var1));  // Send RSSI value to gw
                                    
                                      // Sleep until interrupt comes in on motion sensor. Send update every two minute.
                                      sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
                                    }
                                    
                                    

                                    i hope this helps :) im just learing mysensors & co :expressionless:

                                    david

                                    frenchoF Offline
                                    frenchoF Offline
                                    frencho
                                    wrote on last edited by
                                    #43

                                    @Fleischtorte is your code example working ? I mean do you see the RSSI going down to -70 ?
                                    Cause on this page https://lowpowerlab.com/2015/11/11/rfm69_atc-automatic-transmission-control/ Felix says we must use a radio.sendwithretry ?!
                                    I'm a little confused it not working so I'm digging

                                    Your second life begins when you understand you only have one !

                                    1 Reply Last reply
                                    0
                                    • B BenCranston

                                      @Fleischtorte Sweet!! This I can do. I'll make the changes and start testing tonight. thanks for the explicit help.

                                      -Ben

                                      frenchoF Offline
                                      frenchoF Offline
                                      frencho
                                      wrote on last edited by
                                      #44

                                      @BenCranston did you get it to work ?

                                      Your second life begins when you understand you only have one !

                                      1 Reply Last reply
                                      0
                                      • FleischtorteF Offline
                                        FleischtorteF Offline
                                        Fleischtorte
                                        wrote on last edited by Fleischtorte
                                        #45

                                        @Frencho radio.sendwithretry is used (see line 53 in libraries/MySensors/core/MyTransportRFM69.cpp) and ATC must be enabled on GW/Node (use _radio.enableAutoPower(-70); only on the node side).
                                        It seems you need continous traffic to see the effect of ATC (i use a simple relay sketch which reports the rssi with every switch command).

                                        1 Reply Last reply
                                        0
                                        • nagelcN Offline
                                          nagelcN Offline
                                          nagelc
                                          wrote on last edited by
                                          #46

                                          How is the ATC working out? I think it is a neat feature, but am reluctant to mess with the core MySensors libraries.

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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