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. My Project
  3. Advice about RF nRF24L01+ to send/receive sensory information

Advice about RF nRF24L01+ to send/receive sensory information

Scheduled Pinned Locked Moved My Project
29 Posts 3 Posters 9.3k Views 2 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.
  • mfalkviddM mfalkvidd

    Welcome to the MySensors forum @Walyson-Albuquerque-Machado

    What you are describing should be pretty easy. The radios will not interfere with eachother.

    An example for how to use MySensors with a display is available at https://www.mysensors.org/build/display but don't use the code there (it is for MySensors 1.x), use the RealTimeClockDisplaySensor example included in https://github.com/mysensors/MySensorsArduinoExamples

    Instructions on how to measure and report battery level is available at https://www.mysensors.org/build/battery#measuring-and-reporting-battery-level

    Using a controller would probably be overkill for this project, unless you want graphs of the battery level. Read more about the differenc components in a MySensors network at https://www.mysensors.org/about/network

    If you don't use a controller you'll need to set CHILD_ID in the sketch.

    Start small, perhabs by building the lcd device and making it display some text. What that is working, move on to the next step. Don't try to build everything at once.

    Walyson Albuquerque MachadoW Offline
    Walyson Albuquerque MachadoW Offline
    Walyson Albuquerque Machado
    wrote on last edited by
    #3

    @mfalkvidd Thank you! I really appreciated your advices.

    I'm using two Arduinos UNO and at the moment I can see battery level using a lcd and a voltage sensor module.

    Now I'm going to build the nRF module, but I have a doubt about the Arduino UNO pin using SPI interface MOSI, MISO and SCK.

    One UNO with nRF > pin 11, 12 and 13 / SD card > pin 11, 12 and 13

    Another UNO with nRF > pin 11, 12 and 13 / lcd > pin 11, 12, 2, 3, 4 and 5

    They use the same pins, what am I gonna do? Put them in parallel?

    Thanks!

    mfalkviddM 1 Reply Last reply
    0
    • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

      @mfalkvidd Thank you! I really appreciated your advices.

      I'm using two Arduinos UNO and at the moment I can see battery level using a lcd and a voltage sensor module.

      Now I'm going to build the nRF module, but I have a doubt about the Arduino UNO pin using SPI interface MOSI, MISO and SCK.

      One UNO with nRF > pin 11, 12 and 13 / SD card > pin 11, 12 and 13

      Another UNO with nRF > pin 11, 12 and 13 / lcd > pin 11, 12, 2, 3, 4 and 5

      They use the same pins, what am I gonna do? Put them in parallel?

      Thanks!

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

      @Walyson-Albuquerque-Machado it depends on which libraries and which lcd and sd card reader you are using. Some can be put in parallell, with addition of a slave select pin. An alternative is to use softspi as described in https://www.mysensors.org/build/ethernet_gateway and https://github.com/mysensors/MySensors/blob/development/examples/GatewayW5100/GatewayW5100.ino#L57

      With softspi, an extra spi bus is created and one of the components (the w5100 ethernet module in the above example) is connected to the extra bus so it does not interfere with the nrf.

      https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi is a good start if you want to learn more about spi.

      1 Reply Last reply
      1
      • Walyson Albuquerque MachadoW Offline
        Walyson Albuquerque MachadoW Offline
        Walyson Albuquerque Machado
        wrote on last edited by Walyson Albuquerque Machado
        #5

        Hey!
        Thanks @mfalkvidd !

        I'm trying to make the module nRF24l01+ work with the micro SD card in parallell and I'm having some trouble.

        The micro SD card is working, but the nRF24l01+ not.
        The nRF24l01+ works fine when there's no micro SD card.

        Can anyone give me a help, please!?

        TX:

        #include <SPI.h>
        #include <RF24.h>
        
        #define REFRESH_TIME 1000
        
        RF24 radio (9, 10);
        byte enderecos[][6] = {"1node"};
        
        float dadosenviados[2];
        
        // Bateria
        int sensorTensaoDC = A0;
        float valorTensaoDC;
        int amostragem = 1000;
        float mediaTotalTensaoDC = 0;
        float R1 = 28000.0;  
        float R2 = 7600.0;
        int sensorValue_aux = 0;
        float voltsporUnidade = 0.004887586;// 5%1023
        
        //Velocidade
        unsigned long lastRefresh = millis();   
        float circMetric = 0.17;
        volatile long loopCount = 0;   
        
        
        void setup () 
        {  
          analogReference(DEFAULT);
          pinMode(A0, INPUT);
          
          attachInterrupt(0, speedCalc, RISING); 
        
          
          radio.begin();
          radio.openWritingPipe(enderecos[0]);  
          radio.stopListening(); 
        }
          
        void bateria ()
        {
          mediaTotalTensaoDC = 0;
          
          for(int i=0; i < amostragem ; i++)
          {
            valorTensaoDC = analogRead(sensorTensaoDC);
            valorTensaoDC =(valorTensaoDC*voltsporUnidade);
            mediaTotalTensaoDC = mediaTotalTensaoDC+ (valorTensaoDC / (R2/(R1+R2)));
            delay(1);
          }
          dadosenviados[0] = mediaTotalTensaoDC / amostragem;  
        }
        
        void velocidade ()
        {
          if (millis() - lastRefresh >= REFRESH_TIME)
          { 
            
            detachInterrupt(0);    
            
            dadosenviados[1] = (3600*circMetric*loopCount)/(millis() - lastRefresh);
                
            loopCount = 0;
            lastRefresh = millis();
            
            attachInterrupt(0, speedCalc, RISING);
          }  
        }
        
        void speedCalc()
        {
          loopCount++;
        }
        
        void envio ()
        {
          radio.write(&dadosenviados, sizeof(dadosenviados));
          delay(10);
        }
          
        void loop()
        { 
          dadosenviados[0] = 0;
          dadosenviados[1] = 0;
          bateria();
          velocidade();
          envio();
        }
        

        RX:

        #include <SD.h>
        #include <SPI.h>
        #include <RF24.h>
        #include <LiquidCrystal.h>
        
        #define CE_PIN   9 // RF
        #define CSN_PIN 10 //RF
        
        #define SS_P 8// SD
        
        RF24 radio (9, 10);
        
        
        byte enderecos[][6] = {"1node"};
        
        File dataFile;
        
        LiquidCrystal lcd(3, 2, 7, 6, 5, 4);
        
        String dadosrecebidos[2];
        
        void setup () 
        {
        
        pinMode(CSN_PIN, OUTPUT); // RF
        pinMode(CE_PIN, OUTPUT); // RF
        pinMode(SS_P, OUTPUT); // SD 
          
          digitalWrite(SS_P, HIGH); 
          digitalWrite(CSN_PIN, HIGH); 
          digitalWrite(CE_PIN, HIGH);
        
          SPI.begin();
          delay(50);		
         
          digitalWrite(CSN_PIN, LOW);                 
          digitalWrite(CE_PIN, LOW);
            
            radio.begin();
            radio.openReadingPipe(1, enderecos[0]);
            radio.startListening();
            
          digitalWrite(CSN_PIN, HIGH);
            
          lcd.begin(20, 4);
          lcd.clear();
          lcd.setCursor(5, 0);
          lcd.print("Teste 1.6");
          delay(5000);
          lcd.setCursor(3, 2);
          lcd.print("Carregando...");
          delay(5000);
          lcd.clear();
          
          digitalWrite(SS_P, LOW);
            
            if (SD.begin(SS_P))
          {
            lcd.setCursor(0, 0);
            lcd.print("Cartao presente!");
            lcd.setCursor(0, 1);
            lcd.print("Pronto para gravar.");
            delay(5000);
            lcd.setCursor(3, 3);
            lcd.print("Iniciando...");
            delay(5000);
          }
          else
          {
            lcd.setCursor(0, 0);
            lcd.print("Insira o cartao!");
            lcd.setCursor(0, 1);
            lcd.print("Se ja inseriu,");
            lcd.setCursor(0, 2);
            lcd.print("verifique o");
            lcd.setCursor(0, 3);
            lcd.print("cartao");
            delay(5000);
          }
            dataFile = SD.open("datalog.txt", FILE_WRITE);
            if (dataFile)
            { 
            dataFile.println("Tensão e velocidade");
             
            dataFile.close();
            }
            else 
            {
            dataFile.println("Erro");
            }
          digitalWrite(SS_P, HIGH);
        } 
        
        void recebido ()
        {
          digitalWrite(CE_PIN, LOW);  
          digitalWrite(CSN_PIN, LOW); 
           
           if (radio.available())
           {
            while (radio.available())
            {
              radio.read(&dadosrecebidos, sizeof(dadosrecebidos));
            }
           
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print("TENSAO");
            lcd.setCursor(7, 0);
            lcd.print(dadosrecebidos[0]);
            lcd.print("VOLTS");
            lcd.setCursor(0, 1);
            lcd.print("VELOCIDADE");
            lcd.setCursor(11, 1);
            lcd.print(dadosrecebidos[1]);
            lcd.print("KM/H");
           }
           
           digitalWrite(CSN_PIN, HIGH);
        } 
        
        void gravar()
        {
            digitalWrite(SS_P, LOW); 
        
          // make a string for assembling the data to log:
          String dataString = ""; //this line simply erases the string
          dataString += "Tensao ";
          dataString += (dadosrecebidos[0]);
          dataString += " VOLTS";
          dataString += " / ";     //puts a comma between the two bits of data
          dataString += "Velocidade ";
          dataString += (dadosrecebidos[1]);
          dataString += " KM/H";
          delay (1000);
        
          dataFile = SD.open("datalog.txt", FILE_WRITE);
         
          // if the file is available, write to it:
          if (dataFile) 
          {
            dataFile.println(dataString);
            dataFile.close();
          }
          // if the file isn't open, pop up an error:
          else 
          {
            dataFile.println("Erro");
          }
            digitalWrite(SS_P, HIGH); 
        }
        
        void loop () 
        {
          recebido();
          gravar();
        }```
        AWIA 1 Reply Last reply
        0
        • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

          Hey!
          Thanks @mfalkvidd !

          I'm trying to make the module nRF24l01+ work with the micro SD card in parallell and I'm having some trouble.

          The micro SD card is working, but the nRF24l01+ not.
          The nRF24l01+ works fine when there's no micro SD card.

          Can anyone give me a help, please!?

          TX:

          #include <SPI.h>
          #include <RF24.h>
          
          #define REFRESH_TIME 1000
          
          RF24 radio (9, 10);
          byte enderecos[][6] = {"1node"};
          
          float dadosenviados[2];
          
          // Bateria
          int sensorTensaoDC = A0;
          float valorTensaoDC;
          int amostragem = 1000;
          float mediaTotalTensaoDC = 0;
          float R1 = 28000.0;  
          float R2 = 7600.0;
          int sensorValue_aux = 0;
          float voltsporUnidade = 0.004887586;// 5%1023
          
          //Velocidade
          unsigned long lastRefresh = millis();   
          float circMetric = 0.17;
          volatile long loopCount = 0;   
          
          
          void setup () 
          {  
            analogReference(DEFAULT);
            pinMode(A0, INPUT);
            
            attachInterrupt(0, speedCalc, RISING); 
          
            
            radio.begin();
            radio.openWritingPipe(enderecos[0]);  
            radio.stopListening(); 
          }
            
          void bateria ()
          {
            mediaTotalTensaoDC = 0;
            
            for(int i=0; i < amostragem ; i++)
            {
              valorTensaoDC = analogRead(sensorTensaoDC);
              valorTensaoDC =(valorTensaoDC*voltsporUnidade);
              mediaTotalTensaoDC = mediaTotalTensaoDC+ (valorTensaoDC / (R2/(R1+R2)));
              delay(1);
            }
            dadosenviados[0] = mediaTotalTensaoDC / amostragem;  
          }
          
          void velocidade ()
          {
            if (millis() - lastRefresh >= REFRESH_TIME)
            { 
              
              detachInterrupt(0);    
              
              dadosenviados[1] = (3600*circMetric*loopCount)/(millis() - lastRefresh);
                  
              loopCount = 0;
              lastRefresh = millis();
              
              attachInterrupt(0, speedCalc, RISING);
            }  
          }
          
          void speedCalc()
          {
            loopCount++;
          }
          
          void envio ()
          {
            radio.write(&dadosenviados, sizeof(dadosenviados));
            delay(10);
          }
            
          void loop()
          { 
            dadosenviados[0] = 0;
            dadosenviados[1] = 0;
            bateria();
            velocidade();
            envio();
          }
          

          RX:

          #include <SD.h>
          #include <SPI.h>
          #include <RF24.h>
          #include <LiquidCrystal.h>
          
          #define CE_PIN   9 // RF
          #define CSN_PIN 10 //RF
          
          #define SS_P 8// SD
          
          RF24 radio (9, 10);
          
          
          byte enderecos[][6] = {"1node"};
          
          File dataFile;
          
          LiquidCrystal lcd(3, 2, 7, 6, 5, 4);
          
          String dadosrecebidos[2];
          
          void setup () 
          {
          
          pinMode(CSN_PIN, OUTPUT); // RF
          pinMode(CE_PIN, OUTPUT); // RF
          pinMode(SS_P, OUTPUT); // SD 
            
            digitalWrite(SS_P, HIGH); 
            digitalWrite(CSN_PIN, HIGH); 
            digitalWrite(CE_PIN, HIGH);
          
            SPI.begin();
            delay(50);		
           
            digitalWrite(CSN_PIN, LOW);                 
            digitalWrite(CE_PIN, LOW);
              
              radio.begin();
              radio.openReadingPipe(1, enderecos[0]);
              radio.startListening();
              
            digitalWrite(CSN_PIN, HIGH);
              
            lcd.begin(20, 4);
            lcd.clear();
            lcd.setCursor(5, 0);
            lcd.print("Teste 1.6");
            delay(5000);
            lcd.setCursor(3, 2);
            lcd.print("Carregando...");
            delay(5000);
            lcd.clear();
            
            digitalWrite(SS_P, LOW);
              
              if (SD.begin(SS_P))
            {
              lcd.setCursor(0, 0);
              lcd.print("Cartao presente!");
              lcd.setCursor(0, 1);
              lcd.print("Pronto para gravar.");
              delay(5000);
              lcd.setCursor(3, 3);
              lcd.print("Iniciando...");
              delay(5000);
            }
            else
            {
              lcd.setCursor(0, 0);
              lcd.print("Insira o cartao!");
              lcd.setCursor(0, 1);
              lcd.print("Se ja inseriu,");
              lcd.setCursor(0, 2);
              lcd.print("verifique o");
              lcd.setCursor(0, 3);
              lcd.print("cartao");
              delay(5000);
            }
              dataFile = SD.open("datalog.txt", FILE_WRITE);
              if (dataFile)
              { 
              dataFile.println("Tensão e velocidade");
               
              dataFile.close();
              }
              else 
              {
              dataFile.println("Erro");
              }
            digitalWrite(SS_P, HIGH);
          } 
          
          void recebido ()
          {
            digitalWrite(CE_PIN, LOW);  
            digitalWrite(CSN_PIN, LOW); 
             
             if (radio.available())
             {
              while (radio.available())
              {
                radio.read(&dadosrecebidos, sizeof(dadosrecebidos));
              }
             
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print("TENSAO");
              lcd.setCursor(7, 0);
              lcd.print(dadosrecebidos[0]);
              lcd.print("VOLTS");
              lcd.setCursor(0, 1);
              lcd.print("VELOCIDADE");
              lcd.setCursor(11, 1);
              lcd.print(dadosrecebidos[1]);
              lcd.print("KM/H");
             }
             
             digitalWrite(CSN_PIN, HIGH);
          } 
          
          void gravar()
          {
              digitalWrite(SS_P, LOW); 
          
            // make a string for assembling the data to log:
            String dataString = ""; //this line simply erases the string
            dataString += "Tensao ";
            dataString += (dadosrecebidos[0]);
            dataString += " VOLTS";
            dataString += " / ";     //puts a comma between the two bits of data
            dataString += "Velocidade ";
            dataString += (dadosrecebidos[1]);
            dataString += " KM/H";
            delay (1000);
          
            dataFile = SD.open("datalog.txt", FILE_WRITE);
           
            // if the file is available, write to it:
            if (dataFile) 
            {
              dataFile.println(dataString);
              dataFile.close();
            }
            // if the file isn't open, pop up an error:
            else 
            {
              dataFile.println("Erro");
            }
              digitalWrite(SS_P, HIGH); 
          }
          
          void loop () 
          {
            recebido();
            gravar();
          }```
          AWIA Offline
          AWIA Offline
          AWI
          Hero Member
          wrote on last edited by
          #6

          @Walyson-Albuquerque-Machado from your sketch I conclude that you are not using MySensors as framework for creating you sensor and logger.
          @mfalkvidd gave you some good suggestions for using a SPI bus interface.
          The purpose of this forum is to work with/ discuss the MySensors framework.

          Give MySensors a try and discover that it solves a lot of your low level interface issues.

          Walyson Albuquerque MachadoW 1 Reply Last reply
          2
          • AWIA AWI

            @Walyson-Albuquerque-Machado from your sketch I conclude that you are not using MySensors as framework for creating you sensor and logger.
            @mfalkvidd gave you some good suggestions for using a SPI bus interface.
            The purpose of this forum is to work with/ discuss the MySensors framework.

            Give MySensors a try and discover that it solves a lot of your low level interface issues.

            Walyson Albuquerque MachadoW Offline
            Walyson Albuquerque MachadoW Offline
            Walyson Albuquerque Machado
            wrote on last edited by
            #7

            @AWI Hi.
            Sure, I'm going to try and then I come back here.

            Thanks.

            1 Reply Last reply
            0
            • Walyson Albuquerque MachadoW Offline
              Walyson Albuquerque MachadoW Offline
              Walyson Albuquerque Machado
              wrote on last edited by
              #8

              Hey. I'm trying to use Mysensors, but I got these errors. Are there a specific command that I should use? I didn't find any example.

              error: 'RF24' does not name a type RF24 radio(MY_RF24_CE_PIN, MY_RF24_CS_PIN);

              error: 'radio' was not declared in this scope radio.begin();

              AWIA 1 Reply Last reply
              0
              • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

                Hey. I'm trying to use Mysensors, but I got these errors. Are there a specific command that I should use? I didn't find any example.

                error: 'RF24' does not name a type RF24 radio(MY_RF24_CE_PIN, MY_RF24_CS_PIN);

                error: 'radio' was not declared in this scope radio.begin();

                AWIA Offline
                AWIA Offline
                AWI
                Hero Member
                wrote on last edited by
                #9

                @Walyson-Albuquerque-Machado The MySensors site is full of examples. You probably have an incomplete instalation or conflicting (RF24) libararies. Try getting started

                1 Reply Last reply
                0
                • Walyson Albuquerque MachadoW Offline
                  Walyson Albuquerque MachadoW Offline
                  Walyson Albuquerque Machado
                  wrote on last edited by
                  #10

                  I'm getting started and I'm researching about Mysensors. I would like some tips, please.

                  I know that I must set this first:

                  #define RF24_CE_PIN       9
                  #define RF24_CS_PIN      10
                  #define RF24_PA_LEVEL      RF24_PA_MAX
                  #define RF24_PA_LEVEL_GW   RF24_PA_LOW
                  #define RF24_CHANNEL     76
                  #define RF24_DATARATE      RF24_250KBPS
                  #define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL)
                  #define SOFTSPI
                  #ifdef SOFTSPI
                    const uint8_t SOFT_SPI_MISO_PIN = 16;
                      const uint8_t SOFT_SPI_MOSI_PIN = 15;
                      const uint8_t SOFT_SPI_SCK_PIN = 14;
                  #endif
                  
                  #include <MyConfig.h>
                  #include <MySensors.h>
                  

                  And I know that in 2.0.x I don't need to set this:

                   .begin();
                  

                  But I don't know how to define in Mysensors when it's Writing / stopListening and Reading / startListening

                  radio.openWritingPipe(enderecos[0]);  
                  radio.stopListening(); 
                  
                  openReadingPipe(1, enderecos[0]);
                  startListening();
                  

                  Also how to Write the sensor information and Read:

                  radio.write(&dadosenviados, sizeof(dadosenviados));
                  
                   if (radio.available())
                     {
                      while (radio.available())
                      {
                        radio.read(&dadosrecebidos, sizeof(dadosrecebidos));
                      }
                  

                  Is this how I send the sensor information? If so, how do I read?

                  void presentation()  
                  { 
                    sendSketchInfo("Distance Sensor", "1.0");
                    present(CHILD_ID, S_DISTANCE);
                  }
                  
                  AWIA 1 Reply Last reply
                  0
                  • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

                    I'm getting started and I'm researching about Mysensors. I would like some tips, please.

                    I know that I must set this first:

                    #define RF24_CE_PIN       9
                    #define RF24_CS_PIN      10
                    #define RF24_PA_LEVEL      RF24_PA_MAX
                    #define RF24_PA_LEVEL_GW   RF24_PA_LOW
                    #define RF24_CHANNEL     76
                    #define RF24_DATARATE      RF24_250KBPS
                    #define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL)
                    #define SOFTSPI
                    #ifdef SOFTSPI
                      const uint8_t SOFT_SPI_MISO_PIN = 16;
                        const uint8_t SOFT_SPI_MOSI_PIN = 15;
                        const uint8_t SOFT_SPI_SCK_PIN = 14;
                    #endif
                    
                    #include <MyConfig.h>
                    #include <MySensors.h>
                    

                    And I know that in 2.0.x I don't need to set this:

                     .begin();
                    

                    But I don't know how to define in Mysensors when it's Writing / stopListening and Reading / startListening

                    radio.openWritingPipe(enderecos[0]);  
                    radio.stopListening(); 
                    
                    openReadingPipe(1, enderecos[0]);
                    startListening();
                    

                    Also how to Write the sensor information and Read:

                    radio.write(&dadosenviados, sizeof(dadosenviados));
                    
                     if (radio.available())
                       {
                        while (radio.available())
                        {
                          radio.read(&dadosrecebidos, sizeof(dadosrecebidos));
                        }
                    

                    Is this how I send the sensor information? If so, how do I read?

                    void presentation()  
                    { 
                      sendSketchInfo("Distance Sensor", "1.0");
                      present(CHILD_ID, S_DISTANCE);
                    }
                    
                    AWIA Offline
                    AWIA Offline
                    AWI
                    Hero Member
                    wrote on last edited by
                    #11

                    @Walyson-Albuquerque-Machado You are getting on track. You should not bother about the radio, it is hidden (abstracted) in MySensors. You send with the "send" function and receive with the "receive" function. Everything as described in the API.

                    I would suggest you build a simple sensor/sketch (i.e. relay actuator) before diving deeper.

                    I am still taking some tough lessons combining devices on the SPI bus. Like @mfalkvidd mentioned in his post

                    Let us know your progress.

                    1 Reply Last reply
                    2
                    • Walyson Albuquerque MachadoW Offline
                      Walyson Albuquerque MachadoW Offline
                      Walyson Albuquerque Machado
                      wrote on last edited by
                      #12

                      I'm trying to do the battery level example and I'm getting this:

                      Starting sensor (RNNNA-, 2.0.0)
                      TSM:INIT
                      TSM:RADIO:OK
                      TSP:ASSIGNID:OK (ID=10)
                      TSM:FPAR
                      TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                      TSP:MSG:READ 10-10-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                      TSP:MSG:BC
                      TSM:FPAR
                      TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                      TSP:MSG:READ 10-10-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                      TSP:MSG:BC
                      TSM:FPAR
                      TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                      TSM:FPAR
                      TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                      !TSM:FPAR:FAIL
                      !TSM:FAILURE
                      TSM:PDT
                      

                      What does it mean? Why can't I read the serial messages?

                      AWIA 1 Reply Last reply
                      0
                      • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

                        I'm trying to do the battery level example and I'm getting this:

                        Starting sensor (RNNNA-, 2.0.0)
                        TSM:INIT
                        TSM:RADIO:OK
                        TSP:ASSIGNID:OK (ID=10)
                        TSM:FPAR
                        TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                        TSP:MSG:READ 10-10-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                        TSP:MSG:BC
                        TSM:FPAR
                        TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                        TSP:MSG:READ 10-10-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                        TSP:MSG:BC
                        TSM:FPAR
                        TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                        TSM:FPAR
                        TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                        !TSM:FPAR:FAIL
                        !TSM:FAILURE
                        TSM:PDT
                        

                        What does it mean? Why can't I read the serial messages?

                        AWIA Offline
                        AWIA Offline
                        AWI
                        Hero Member
                        wrote on last edited by
                        #13

                        @Walyson-Albuquerque-Machado
                        Your node does not find a parent (gateway) so no response from another node. For documentation: a little indirect but this post by @mfalkvidd should help.

                        1 Reply Last reply
                        2
                        • Walyson Albuquerque MachadoW Offline
                          Walyson Albuquerque MachadoW Offline
                          Walyson Albuquerque Machado
                          wrote on last edited by
                          #14

                          Ok, I'm getting there. I appreciate your advices, thanks. :smile:
                          Now I can see the battery level in the serial. But I didn't understand how to receive the battery level in the gateway to show on my LCD display.

                          Gateway ok:

                          0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
                          0;255;3;0;9;TSM:INIT
                          0;255;3;0;9;TSM:RADIO:OK
                          0;255;3;0;9;TSM:GW MODE
                          0;255;3;0;9;TSM:READY
                          0;255;3;0;14;Gateway startup complete.
                          0;255;0;0;18;2.0.0
                          0;255;3;0;9;No registration required
                          0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
                          0;255;3;0;9;TSP:MSG:READ 10-10-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                          0;255;3;0;9;TSP:MSG:BC
                          0;255;3;0;9;TSP:MSG:FPAR REQ (sender=10)
                          0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
                          0;255;3;0;9;TSP:MSG:GWL OK
                          0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
                          0;255;3;0;9;TSP:MSG:PINGED (ID=10, hops=1)
                          0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
                          0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=0,t=17,pt=0,l=5,sg=0:2.0.0
                          10;255;0;0;17;2.0.0
                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
                          10;255;3;0;6;0
                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=11,pt=0,l=13,sg=0:Battery Meter
                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
                          0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
                          

                          Node ok:

                          Starting sensor (RNNNA-, 2.0.0)
                          TSM:INIT
                          RF24:write register, reg=0, value=14
                          RF24:read register, reg=6, value=35
                          RF24:flushRX
                          TSM:RADIO:OK
                          RF24:start listening
                          RF24:write register, reg=10, value=10
                          TSP:ASSIGNID:OK (ID=10)
                          TSM:FPAR
                          RF24:stop listening
                          RF24:write register, reg=0, value=14
                          RF24:open writing pipe, recipient=255
                          RF24:write register, reg=10, value=255
                          RF24:send message to 255, len=7
                          RF24:flushTX
                          RF24:MAX_RT
                          TSP:MSG:READ 0-0-10 s=255,c=3,t=8,pt=1,l=1,sg=0:0
                          TSP:MSG:FPAR RES (ID=0, dist=0)
                          TSP:MSG:FPAR (PPAR FOUND)
                          TSP:MSG:PAR OK (ID=0, dist=1)
                          TSM:FPAR:OK
                          TSM:ID
                          TSM:CHKID:OK (ID=10)
                          TSM:UPL
                          TSP:PING:SEND (dest=0)
                          TSP:MSG:PONG RECV (hops=1)
                          TSP:CHKUPL:OK
                          TSM:UPL:OK
                          TSM:READY
                          Init complete, id=10, parent=0, distance=1, registration=1
                          Battery Voltage: 0.00 V
                          Battery Voltage: 5.91 V
                          Battery Voltage: 5.91 V
                          
                          AWIA 1 Reply Last reply
                          0
                          • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

                            Ok, I'm getting there. I appreciate your advices, thanks. :smile:
                            Now I can see the battery level in the serial. But I didn't understand how to receive the battery level in the gateway to show on my LCD display.

                            Gateway ok:

                            0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
                            0;255;3;0;9;TSM:INIT
                            0;255;3;0;9;TSM:RADIO:OK
                            0;255;3;0;9;TSM:GW MODE
                            0;255;3;0;9;TSM:READY
                            0;255;3;0;14;Gateway startup complete.
                            0;255;0;0;18;2.0.0
                            0;255;3;0;9;No registration required
                            0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
                            0;255;3;0;9;TSP:MSG:READ 10-10-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                            0;255;3;0;9;TSP:MSG:BC
                            0;255;3;0;9;TSP:MSG:FPAR REQ (sender=10)
                            0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
                            0;255;3;0;9;TSP:MSG:GWL OK
                            0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
                            0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
                            0;255;3;0;9;TSP:MSG:PINGED (ID=10, hops=1)
                            0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
                            0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
                            0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
                            0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=0,t=17,pt=0,l=5,sg=0:2.0.0
                            10;255;0;0;17;2.0.0
                            0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
                            10;255;3;0;6;0
                            0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=11,pt=0,l=13,sg=0:Battery Meter
                            0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
                            0;255;3;0;9;TSP:MSG:READ 10-10-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
                            0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
                            

                            Node ok:

                            Starting sensor (RNNNA-, 2.0.0)
                            TSM:INIT
                            RF24:write register, reg=0, value=14
                            RF24:read register, reg=6, value=35
                            RF24:flushRX
                            TSM:RADIO:OK
                            RF24:start listening
                            RF24:write register, reg=10, value=10
                            TSP:ASSIGNID:OK (ID=10)
                            TSM:FPAR
                            RF24:stop listening
                            RF24:write register, reg=0, value=14
                            RF24:open writing pipe, recipient=255
                            RF24:write register, reg=10, value=255
                            RF24:send message to 255, len=7
                            RF24:flushTX
                            RF24:MAX_RT
                            TSP:MSG:READ 0-0-10 s=255,c=3,t=8,pt=1,l=1,sg=0:0
                            TSP:MSG:FPAR RES (ID=0, dist=0)
                            TSP:MSG:FPAR (PPAR FOUND)
                            TSP:MSG:PAR OK (ID=0, dist=1)
                            TSM:FPAR:OK
                            TSM:ID
                            TSM:CHKID:OK (ID=10)
                            TSM:UPL
                            TSP:PING:SEND (dest=0)
                            TSP:MSG:PONG RECV (hops=1)
                            TSP:CHKUPL:OK
                            TSM:UPL:OK
                            TSM:READY
                            Init complete, id=10, parent=0, distance=1, registration=1
                            Battery Voltage: 0.00 V
                            Battery Voltage: 5.91 V
                            Battery Voltage: 5.91 V
                            
                            AWIA Offline
                            AWIA Offline
                            AWI
                            Hero Member
                            wrote on last edited by
                            #15

                            @Walyson-Albuquerque-Machado Back to one of your previous posts. What kind of LCD display are you using. Do you have one with I2C interface?

                            1 Reply Last reply
                            1
                            • Walyson Albuquerque MachadoW Offline
                              Walyson Albuquerque MachadoW Offline
                              Walyson Albuquerque Machado
                              wrote on last edited by
                              #16

                              Hey. I don't have I2C interface. Do I need it?

                              I have one like this, 20x4:

                              AWIA 1 Reply Last reply
                              0
                              • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

                                Hey. I don't have I2C interface. Do I need it?

                                I have one like this, 20x4:

                                AWIA Offline
                                AWIA Offline
                                AWI
                                Hero Member
                                wrote on last edited by
                                #17

                                @Walyson-Albuquerque-Machado It is much easier to connect an I2C display (only 2 wires and power).But if you have pins left on your arduino and the patience to solder you're ok.

                                an adapter plate:

                                1 Reply Last reply
                                1
                                • Walyson Albuquerque MachadoW Offline
                                  Walyson Albuquerque MachadoW Offline
                                  Walyson Albuquerque Machado
                                  wrote on last edited by
                                  #18

                                  I have pins and I have already done this. :stuck_out_tongue_closed_eyes:

                                  1 Reply Last reply
                                  0
                                  • Walyson Albuquerque MachadoW Offline
                                    Walyson Albuquerque MachadoW Offline
                                    Walyson Albuquerque Machado
                                    wrote on last edited by
                                    #19

                                    Is that how I send ? Can I use BINARY to my hall effect sensor? I'm using the digital pin to count every time it passes through a magnet.

                                    MyMessage msg(NODE_ID, V_STATUS);
                                    
                                    float value = 0;
                                    
                                    void presentation()
                                    {
                                        present(NODE_ID, S_BINARY);
                                    }
                                    
                                    void loop()
                                    {
                                        send(msg.set(value));
                                    }
                                    

                                    Is that how I receive?

                                    void receive(const MyMessage &message) {
                                        // Handle incoming message
                                    }
                                    
                                    1 Reply Last reply
                                    0
                                    • Walyson Albuquerque MachadoW Offline
                                      Walyson Albuquerque MachadoW Offline
                                      Walyson Albuquerque Machado
                                      wrote on last edited by
                                      #20

                                      Please, someone tell me how to get the voltage that i'm receiving. I've tried many things, I don't know why this doesn't work.

                                      msgvolt.getFloat();
                                      

                                      I can see the battery in the gateway through serial, but I don't know how to get it to show on the LCD.

                                      Node:

                                      #define MY_DEBUG 
                                      #define MY_DEBUG_VERBOSE_RF24
                                      #define MY_RADIO_NRF24
                                      #define DESTINATION_NODE 0      
                                      #define MY_NODE_ID 10
                                      #define MY_PARENT_NODE_ID  0
                                      #define MY_PARENT_NODE_IS_STATIC
                                      #define MY_RF24_CE_PIN 9
                                      #define MY_RF24_CS_PIN 10
                                      #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                      #define MY_RF24_PA_LEVEL_GW RF24_PA_LOW
                                      #define MY_RF24_CHANNEL 76
                                      #define MY_RF24_DATARATE RF24_250KBPS
                                      
                                      
                                      #include <SPI.h>
                                      #include <MySensors.h>
                                      
                                      
                                      int sensorTensaoDC = A0;
                                      float valorTensaoDC;
                                      int amostragem = 1000;
                                      float mediaTotalTensaoDC = 0;
                                      float R1 = 28000.0;  
                                      float R2 = 7600.0;
                                      int sensorValue_aux = 0;
                                      float voltsporUnidade = 0.005278592; // 5%1023
                                      
                                      float dadosenviados;
                                      
                                      
                                      MyMessage msgvolt(4, V_VOLTAGE);
                                      
                                      void setup()  
                                      {
                                        analogReference(DEFAULT);
                                        pinMode(A0, INPUT);
                                      }
                                      
                                      void presentation() {
                                         sendSketchInfo("Battery Meter", "1.0");
                                         present(4, S_MULTIMETER, "Voltage", true);
                                      }
                                      
                                      void loop()
                                      {
                                         mediaTotalTensaoDC = 0;
                                        for(int i=0; i < amostragem ; i++)
                                        {
                                          valorTensaoDC = analogRead(sensorTensaoDC);
                                      
                                          valorTensaoDC =(valorTensaoDC*voltsporUnidade);
                                          mediaTotalTensaoDC = mediaTotalTensaoDC+ (valorTensaoDC / (R2/(R1+R2)));
                                        }
                                        dadosenviados = mediaTotalTensaoDC / amostragem;
                                        
                                        
                                         Serial.print("Battery Voltage: ");
                                         Serial.print(dadosenviados);
                                         Serial.println(" V");
                                      
                                       send(msgvolt.setDestination(DESTINATION_NODE).set(dadosenviados, 2), 1);
                                        wait(2000);
                                      
                                      }
                                      

                                      Gateway:

                                      #define MY_DEBUG
                                      #define MY_RADIO_NRF24
                                      #define MY_GATEWAY_SERIAL
                                      #define MY_NODE_ID 0
                                      #define DESTINATION_NODE 10 
                                      #define MY_RF24_CE_PIN 9
                                      #define MY_RF24_CS_PIN 10
                                      #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                      #define MY_RF24_PA_LEVEL_GW RF24_PA_LOW
                                      #define MY_RF24_CHANNEL 76
                                      #define MY_RF24_DATARATE RF24_250KBPS
                                      
                                      #include <MySensors.h>
                                      #include <LiquidCrystal.h>
                                      #include <SPI.h>
                                      
                                      float dadosenviados = 0;
                                      
                                      MyMessage msgvolt(4, V_VOLTAGE);
                                      
                                      LiquidCrystal lcd(3, 2, 7, 6, 5, 4);
                                      
                                      void setup()  
                                      {
                                        lcd.begin(20, 4);
                                        lcd.clear();
                                        lcd.setCursor(5, 0);
                                        lcd.print("Teste 1.6");
                                        delay(5000);
                                        lcd.setCursor(3, 2);
                                        lcd.print("Carregando...");
                                        delay(5000);
                                        lcd.clear();
                                      }
                                      
                                      void presentation() {
                                            sendSketchInfo("Battery Meter", "2.0");
                                            present(4, S_MULTIMETER);
                                      }
                                      
                                      void receive(const MyMessage &msgvolt) {
                                        saveState(msgvolt.sensor, msgvolt.getFloat());
                                       dadosenviados = msgvolt.getFloat();
                                      request(4, V_VOLTAGE, 10);
                                      
                                      }         
                                      
                                      void incomingMessage(const MyMessage &msgvolt) {
                                      
                                      request(4, V_VOLTAGE, 10);
                                      dadosenviados = msgvolt.getFloat();
                                      
                                          lcd.clear();
                                          lcd.setCursor(0, 0);
                                          lcd.print("TENSAO");
                                          lcd.setCursor(7, 0);
                                          lcd.print(dadosenviados);
                                          lcd.print("VOLTS");
                                          lcd.setCursor(0, 1);
                                          lcd.print(msgvolt.getFloat());
                                          wait(1000);
                                            Serial.print("Battery Voltage: ")`;
                                         Serial.print(dadosenviados);
                                         Serial.println(" V");
                                      }
                                      
                                      void loop() {
                                      }
                                      
                                      AWIA 1 Reply Last reply
                                      0
                                      • Walyson Albuquerque MachadoW Walyson Albuquerque Machado

                                        Please, someone tell me how to get the voltage that i'm receiving. I've tried many things, I don't know why this doesn't work.

                                        msgvolt.getFloat();
                                        

                                        I can see the battery in the gateway through serial, but I don't know how to get it to show on the LCD.

                                        Node:

                                        #define MY_DEBUG 
                                        #define MY_DEBUG_VERBOSE_RF24
                                        #define MY_RADIO_NRF24
                                        #define DESTINATION_NODE 0      
                                        #define MY_NODE_ID 10
                                        #define MY_PARENT_NODE_ID  0
                                        #define MY_PARENT_NODE_IS_STATIC
                                        #define MY_RF24_CE_PIN 9
                                        #define MY_RF24_CS_PIN 10
                                        #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                        #define MY_RF24_PA_LEVEL_GW RF24_PA_LOW
                                        #define MY_RF24_CHANNEL 76
                                        #define MY_RF24_DATARATE RF24_250KBPS
                                        
                                        
                                        #include <SPI.h>
                                        #include <MySensors.h>
                                        
                                        
                                        int sensorTensaoDC = A0;
                                        float valorTensaoDC;
                                        int amostragem = 1000;
                                        float mediaTotalTensaoDC = 0;
                                        float R1 = 28000.0;  
                                        float R2 = 7600.0;
                                        int sensorValue_aux = 0;
                                        float voltsporUnidade = 0.005278592; // 5%1023
                                        
                                        float dadosenviados;
                                        
                                        
                                        MyMessage msgvolt(4, V_VOLTAGE);
                                        
                                        void setup()  
                                        {
                                          analogReference(DEFAULT);
                                          pinMode(A0, INPUT);
                                        }
                                        
                                        void presentation() {
                                           sendSketchInfo("Battery Meter", "1.0");
                                           present(4, S_MULTIMETER, "Voltage", true);
                                        }
                                        
                                        void loop()
                                        {
                                           mediaTotalTensaoDC = 0;
                                          for(int i=0; i < amostragem ; i++)
                                          {
                                            valorTensaoDC = analogRead(sensorTensaoDC);
                                        
                                            valorTensaoDC =(valorTensaoDC*voltsporUnidade);
                                            mediaTotalTensaoDC = mediaTotalTensaoDC+ (valorTensaoDC / (R2/(R1+R2)));
                                          }
                                          dadosenviados = mediaTotalTensaoDC / amostragem;
                                          
                                          
                                           Serial.print("Battery Voltage: ");
                                           Serial.print(dadosenviados);
                                           Serial.println(" V");
                                        
                                         send(msgvolt.setDestination(DESTINATION_NODE).set(dadosenviados, 2), 1);
                                          wait(2000);
                                        
                                        }
                                        

                                        Gateway:

                                        #define MY_DEBUG
                                        #define MY_RADIO_NRF24
                                        #define MY_GATEWAY_SERIAL
                                        #define MY_NODE_ID 0
                                        #define DESTINATION_NODE 10 
                                        #define MY_RF24_CE_PIN 9
                                        #define MY_RF24_CS_PIN 10
                                        #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                        #define MY_RF24_PA_LEVEL_GW RF24_PA_LOW
                                        #define MY_RF24_CHANNEL 76
                                        #define MY_RF24_DATARATE RF24_250KBPS
                                        
                                        #include <MySensors.h>
                                        #include <LiquidCrystal.h>
                                        #include <SPI.h>
                                        
                                        float dadosenviados = 0;
                                        
                                        MyMessage msgvolt(4, V_VOLTAGE);
                                        
                                        LiquidCrystal lcd(3, 2, 7, 6, 5, 4);
                                        
                                        void setup()  
                                        {
                                          lcd.begin(20, 4);
                                          lcd.clear();
                                          lcd.setCursor(5, 0);
                                          lcd.print("Teste 1.6");
                                          delay(5000);
                                          lcd.setCursor(3, 2);
                                          lcd.print("Carregando...");
                                          delay(5000);
                                          lcd.clear();
                                        }
                                        
                                        void presentation() {
                                              sendSketchInfo("Battery Meter", "2.0");
                                              present(4, S_MULTIMETER);
                                        }
                                        
                                        void receive(const MyMessage &msgvolt) {
                                          saveState(msgvolt.sensor, msgvolt.getFloat());
                                         dadosenviados = msgvolt.getFloat();
                                        request(4, V_VOLTAGE, 10);
                                        
                                        }         
                                        
                                        void incomingMessage(const MyMessage &msgvolt) {
                                        
                                        request(4, V_VOLTAGE, 10);
                                        dadosenviados = msgvolt.getFloat();
                                        
                                            lcd.clear();
                                            lcd.setCursor(0, 0);
                                            lcd.print("TENSAO");
                                            lcd.setCursor(7, 0);
                                            lcd.print(dadosenviados);
                                            lcd.print("VOLTS");
                                            lcd.setCursor(0, 1);
                                            lcd.print(msgvolt.getFloat());
                                            wait(1000);
                                              Serial.print("Battery Voltage: ")`;
                                           Serial.print(dadosenviados);
                                           Serial.println(" V");
                                        }
                                        
                                        void loop() {
                                        }
                                        
                                        AWIA Offline
                                        AWIA Offline
                                        AWI
                                        Hero Member
                                        wrote on last edited by AWI
                                        #21

                                        @Walyson-Albuquerque-Machado a few things :

                                        • the receive routine should be the only place where you receive and read the incoming messages. So skip the incomingmessage routine and add its functionality to receive.

                                        • you don't need to 'request' anything as the node already sends messages all the time.

                                        • savestate writes only byte (8 bit) values, so you need to decompose a float to bytes in order to save it. (best to use an 'union' for that)

                                        Be aware that the gateway (node 0) receives the messages from all nodes connected. You need to make sure that that the incoming message is the one to display.

                                        In summary, to receive messages : the receive routine is called automatically when a message is received. You read the message content (store in a global variable) , and display it.

                                        1 Reply Last reply
                                        0
                                        • Walyson Albuquerque MachadoW Offline
                                          Walyson Albuquerque MachadoW Offline
                                          Walyson Albuquerque Machado
                                          wrote on last edited by Walyson Albuquerque Machado
                                          #22

                                          Ok, I'm going to erase the void incomingMessage(const MyMessage &msgvolt) and the request(4, V_VOLTAGE, 10).
                                          Also no savestate.

                                          I tried to store in a global variable and display, but I didn't understand It, how do I read!?

                                          void receive(const MyMessage &msgvolt) {
                                            if (msgvolt.type==V_VOLTAGE) {
                                              digitalWrite(msgvolt.sensor, msgvolt.getFloat());
                                            
                                           dadosenviados = msgvolt.getFloat();
                                          
                                          
                                          Serial.println(msgvolt.getFloat());
                                          Serial.println(dadosenviados);
                                          Serial.println(msgvolt.data);
                                          }
                                          

                                          This is what I'm getting in the serial:

                                          Node:

                                          Battery Voltage: 8.68 V
                                          RF24:stop listening
                                          RF24:write register, reg=0, value=14
                                          RF24:open writing pipe, recipient=0
                                          RF24:write register, reg=10, value=0
                                          RF24:write register, reg=16, value=0
                                          RF24:send message to 0, len=12
                                          RF24:flushTX
                                          RF24:write register, reg=7, value=48
                                          RF24:start listening
                                          RF24:write register, reg=0, value=15
                                          RF24:write register, reg=10, value=10
                                          TSP:MSG:SEND 10-10-0-0 s=4,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=ok:8.68
                                          RF24:read message, len=12
                                          RF24:write register, reg=7, value=64
                                          TSP:MSG:READ 0-0-10 s=4,c=1,t=38,pt=7,l=5,sg=0:8.68
                                          Battery Voltage: 8.69 V
                                          

                                          Gateway:

                                          10;4;1;0;38;8.68
                                          0;255;3;0;9;TSP:MSG:READ 10-10-0 s=4,c=1,t=38,pt=7,l=5,sg=0:8.68
                                          0;255;3;0;9;TSP:MSG:ACK msg
                                          0;255;3;0;9;TSP:MSG:SEND 0-0-10-10 s=4,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=ok:8.68
                                          10;4;1;0;38;8.68
                                          
                                          AWIA 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          19

                                          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