Serial Gateway cannot retrieve serial messages when gw.beginn() is invoked (RESOLVED)



  • THREAD RESOLVED: CHINESE SUPPLIER DID SEND WRONG RADIO MODULE: NRF24L01 instead of NRF24L01+
    Do not buy from ebay-member alice1101983. They send NRF24L01 instead of NRF24L01+.

    Hi, I'm using a Arduino Nano v3 as recommended for my Serial Gateway. I hooked up the radio module as described (http://www.mysensors.org/build/connect_radio) and I simply want to send a message from the Serial Monitor (either Arduino IDE 1.6 or CodeBender).

    Subsequently I copied the MySensors SerialGateway.ino from the example repository. See here: https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/examples/SerialGateway/SerialGateway.ino

    I disable all the gw variables since I only want to test the serial input with serialEvent(). That works! I go ahead and remove the comment characters in front of the gw variables. Recompile and upload. Now the messages are not retrieved and never outputed on the Serial Monior Screen. I also selected the NewLine Argument in the drop down box. No success.

    Why is gw.beginn() having that influence on that serial input/output?

    I tested if the radio LEDs (TX,RX,ERR) indicate something. They fully light up as if there would be constant communication.
    The only thing I get when I startup (and change to baud rate 115200 in the serial monitor) is: 0;0;3;0;9;check wires. Well that is an indicator! But I DONT want to wire them any other than recommended here: http://www.mysensors.org/build/connect_radio
    Or is the wireing for the Arduino Nano different from the Arduino Pro Mini?

    Any clue why that serial gateway cannot read from the serial COM port when gw.beginn() is invoked?

    This is my code:

    #include <SPI.h>  
    #include <MySensor.h>  
    #include <MyGateway.h>  
    #include <stdarg.h>
    
    #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
    #define INCLUSION_MODE_PIN 3 // Digital pin used for inclusion mode button
    
    
    MyGateway gw(DEFAULT_CE_PIN, DEFAULT_CS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN,  6, 5, 4);
    
    char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
    int inputPos = 0;
    boolean commandComplete = false;  // whether the string is complete
    
    void setup()  
    { 
       //Set Auto by MySensonsrs
       //Serial.begin(115200);
      gw.begin();
    }
    
    void loop()  
    { 
      gw.processRadioMessage();   
      if (commandComplete) {
        // A command wass issued from serial interface
        // We will now try to send it to the actuator
        Serial.println(inputString);
        gw.parseAndSend(inputString);
        commandComplete = false;  
        inputPos = 0;
      }
    }
    /*
      SerialEvent occurs whenever a new data comes in the
     hardware serial RX.  This routine is run between each
     time loop() runs, so using delay inside loop can delay
     response.  Multiple bytes of data may be available.
     */
    void serialEvent() {
      while (Serial.available()) {
        // get the new byte:
        char inChar = (char)Serial.read(); 
        // if the incoming character is a newline, set a flag
        // so the main loop can do something about it:
        Serial.println(inChar);
        if (inputPos<MAX_RECEIVE_LENGTH-1 && !commandComplete) { 
          if (inChar == '\n') {
            inputString[inputPos] = 0;
            commandComplete = true;
          } else {
            // add it to the inputString:
            inputString[inputPos] = inChar;
            inputPos++;
          }
        } else {
           // Incoming message too long. Throw away 
            inputPos = 0;
        }
      }
    }
    

  • Admin



  • Yes. That's the case. I meant one needs to set the BAUD in the Arduino IDE Serial Monitor.

    I do NOT need to wire the Nano any different with the NRF24L01+ than the Arduino Pro Mini, right? http://www.mysensors.org/build/connect_radio


  • Admin

    @SparkAndHale said:

    I do NOT need to wire the Nano any different with the NRF24L01+ than the Arduino Pro Mini, right?

    No.



  • This post is deleted!


  • I looking with a magnifying glass at the chip, i noted that this is NOT NRF24L01+ but just a NRF24L01 without the plus.

    I used this smaller versions and they worked immediately. I_GATEWAY_READY message appeared. http://www.ebay.com/itm/2-4G-NRF24L01-PA-LNA-Wireless-Module-with-Ceramic-Antenna-1-27mm-/400746941364?pt=LH_DefaultDomain_0&hash=item5d4e610bb4

    MySensors did post a warning on that: http://forum.mysensors.org/topic/728/radio-setup-give-check-wires/16

    THREAD RESOLVED.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.