Hello World example on SodaqOne?

Next to my own single channel gateway, there should be a TTN Gateway close. Though… I have been playing for about a week now and didn’t get a sign of any message sent by the UniversalTracker on my SodaqOne. I figure something in my TTN setup is not right yet.

Therefor I was now trying to get a simple ‘Hello World’ running on it sending a message. As the SodaqOne is based on Autonomo (is it really?) I figured I could use its Hello World example. Though … to what should I set the BEE_VCC definition? Is there any running Hello World example for the One?

Haha… the good thing about using forums… After waiting for an answer and ‘unfocussing’ always an idea pops up…

I changed BEE_VCC with ENABLE_PIN_IO and now it compiles for the SodaqOne and I am receiving packets;-)

The BEE_VCC pin on the Autonomo is used for switching on and off the VCC pin of the Bee socket. There is no equivalent on the SodaqONE.

The ENABLE_PIN_IO pin needs to be set to OUTPUT HIGH in order to run the SodaqONE off of a battery or any other non-USB power source. This should be done at the start of the sketch.

Thanks. That clarifies what it does!

Could you show the entire source / settings you are using. I am trying the same but i am getting no reply from device. I’ve change the item so it compiled for One but still no joy.

I am thinking you set the DevAddr differently?

I cannot exactly recall what I changed but think I used the code below. In the code below I just changed my devAddr, appSKey and nwkSKey (that I registered on/ got from staging.thethingsnetwork.org) values to XX. You have to set these to values that ‘belong’ to you.


`

#include <Sodaq_RN2483.h>
#include <StringLiterals.h>
#include <Switchable_Device.h>
#include <Utils.h>

// Copyright © 2016 Johan Stokking <johan@thethingsnetwork.org>
// MIT Licensed

#define DEBUG
#include <Sodaq_RN2483.h>

#define debugSerial SerialUSB
#define loraSerial Serial1

// Change the DevAddr
const uint8_t devAddr[4] =
{
  0xXX, 0xXX, 0xXX, 0xXX
};

// Public Semtech key
const uint8_t appSKey[16] =
{ 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX }
;

// Public Semtech key
const uint8_t nwkSKey[16] =
{ 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX };

void setup()
{
  pinMode(ENABLE_PIN_IO, OUTPUT);

  debugSerial.begin(57600);
  loraSerial.begin(LoRaBee.getDefaultBaudRate());
  
  // Wait for the serial te become available
  while (!debugSerial);
  debugSerial.println("Start");

  // Turn the LoRaBee on
  digitalWrite(ENABLE_PIN_IO, HIGH);

  // Connect the LoRabee
  LoRaBee.setDiag(debugSerial);
  if (LoRaBee.initABP(loraSerial, devAddr, appSKey, nwkSKey, true))
    debugSerial.println("Connection to the network was successful.");
  else
    debugSerial.println("Connection to the network failed!");
}

void loop()
{
  debugSerial.println("Sleeping for 5 seconds before starting sending out test packets.");
  delay(5000);

  // Send 100 packets, with at least 1 seconds delay after each transmission (more seconds if the device is busy)
  uint8_t i = 100;
  while (i >= 0)
  {
    String message = "Hello world! This is message #" + String(i, DEC);
    uint8_t payload[message.length() + 1];
    message.getBytes(payload, message.length() + 1);

    switch (LoRaBee.send(1, payload, message.length()))
    {
      case NoError:
        debugSerial.println("Successful transmission.");
        i--;
        break;
      case NoResponse:
        debugSerial.println("There was no response from the device.");
        break;
      case Timeout:
        debugSerial.println("Connection timed-out. Check your serial connection to the device! Sleeping for 20sec.");
        delay(20000);
        break;
      case PayloadSizeError:
        debugSerial.println("The size of the payload is greater than allowed. Transmission failed!");
        break;
      case InternalError:
        debugSerial.println("Oh No! This shouldn't happen. Something is really wrong! Try restarting the device!\r\nThe program will now halt.");
        while (1) {};
        break;
      case Busy:
        debugSerial.println("The device is busy. Sleeping for 5 extra seconds.");
        delay(5000);
        break;
      case NetworkFatalError:
        debugSerial.println("There is a non-recoverable error with the network connection. You should re-connect.\r\nThe program will now halt.");
        while (1) {};
        break;
      case NotConnected:
        debugSerial.println("The device is not connected to the network. Please connect to the network before attempting to send data.\r\nThe program will now halt.");
        while (1) {};
        break;
      case NoAcknowledgment:
        debugSerial.println("There was no acknowledgment sent back!");
        break;
      default:
        break;
    }
    delay(1000);
  }

  while (1) { } // block forever
}

`