# Rhf76-052am - getting it working with OTAA

**URL:** <https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164>\
**Category:** Hardware\
**Created:** [May 9, 2017, 9:40am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164 "2017-05-09T09:40:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 9, 2017, 9:40am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/1 "2017-05-09T09:40:02Z")

</div>

So I have received a few of these and I am trying to get them up and running with TTN.

> **[Seeeduino LoRaWAN](https://www.seeedstudio.com/Seeeduino-LoRaWAN-p-2780.html)**
>
> LoRaWAN Class A/C
> Ultra long range communication
> Ultra low power consumption
> Arduino programming (based on Arduino Zero bootloader)
> Embeded with lithim battery management chip
> 4 Grove connectors onboard

![](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/1/178944e4544a637b036d407d0cec8c39f8c5fb74.jpg)

For the moment I have it working with ABP but I have so far been unable to get OTAA working and dont know why yet. It seems the packet forwarder received the JOIN ACCEPT packet but from there I have no idea why its failing.

Serge

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [May 9, 2017, 10:17am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/2 "2017-05-09T10:17:06Z")

</div>

I don’t have one but there seems to be an OTAA example and a [firmware](http://wiki.seeed.cc/Seeeduino_LoRAWAN/) update

![](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/b/b30fd814fb45547c580e27478b616b1727f5d548.png)

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 9, 2017, 10:35am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/3 "2017-05-09T10:35:45Z")

</div>

I have based my tests on the rather poorly documented OTAA example which does not work. I have also contacted RisingHF to see if I can get some proper documentation.

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 9, 2017, 11:06am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/4 "2017-05-09T11:06:36Z")

</div>

A copy of the AT command set can be found here

> **[FCCID.io-Users-Manual-3211050.pdf](https://www.dropbox.com/s/8byn9mlha0uscfo/FCCID.io-Users-Manual-3211050.pdf?dl=0)**

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 9, 2017, 3:04pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/5 "2017-05-09T15:04:42Z")

</div>

OK so I have managed to get OTAA kind of working. I say kind of because its random when it works and fails. This leads me to believe there is a timing related issue somewhere … the trick is to figure out where!!

Is OTAA generally something reliable or does it typically require several retries to succeed ?

Thanks,  
Serge

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 10, 2017, 10:57pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/6 "2017-05-10T22:57:53Z")

</div>

For those interested this is what seems to be working for me

```
#include <LoRaWan.h>

char buffer[256];

void setup(void)
{
    SerialUSB.begin(115200);
    while(!SerialUSB);
    
    lora.init();
            
    lora.setKey(NULL, NULL, ".......8204A501331D6........");
    
    lora.setDeciveMode(LWOTAA);    
    
    lora.setDataRate(DR0, EU868);
    
    lora.setAdaptiveDataRate(true);    
    
    lora.setChannel(0, 868.1);
    lora.setChannel(1, 868.3);
    lora.setChannel(2, 868.5);
    lora.setChannel(3, 867.1);
    lora.setChannel(4, 867.3);
    lora.setChannel(5, 867.5);
    lora.setChannel(6, 867.7);
    
    lora.setReceiceWindowFirst(1);
    lora.setReceiceWindowSecond(869.5, DR3);
    
    lora.setPower(20);
    
    while(!lora.setOTAAJoin(JOIN));
}

void loop(void)
{   
    bool result = false;
    
    result = lora.transferPacket("Hello World!", 10);
    
    if(result)
    {
        short length;
        short rssi;
        
        memset(buffer, 0, 256);
        length = lora.receivePacket(buffer, 256, &rssi);
        
        if(length)
        {
            SerialUSB.print("Length is: ");
            SerialUSB.println(length);
            SerialUSB.print("RSSI is: ");
            SerialUSB.println(rssi);
            SerialUSB.print("Data is: ");
            for(unsigned char i = 0; i < length; i ++)
            {
                SerialUSB.print("0x");
                SerialUSB.print(buffer[i], HEX);
                SerialUSB.print(" ");
            }
            SerialUSB.println();
        }
    }
    delay(5000);
}
```

---

<div class="post-metadata">

**Author:** ![seralegi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/seralegi/32/5010_2.png) [@seralegi](https://www.thethingsnetwork.org/forum/u/seralegi)\
**Post date:** [May 14, 2017, 3:22am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/7 "2017-05-14T03:22:18Z")

</div>

Dear ssozonoff, I still having some troubles with the ABP connection of my SEEEDuino. In the sketch I replaced the KEYs with those providerd by TTN and set the Channels to the Australian Frequencies LoRaWan (I am in Australia right now). In the serial monitor it seems to work properly but nothing appears in TTN console. Since you said that in your case the ABP works fine, have you got some suggestions to improve my ABP sketch? Furthermore, did you find a guide (or something that describe the commands) for the LoRaWAN SEEEDstudio library?

Thank you very much

Gianluca

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 14, 2017, 7:49am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/8 "2017-05-14T07:49:57Z")

</div>

Hi,

It sounds like you have done everything correctly. I would double check the App Key and EUI’s.  
Are you using your own Lorawan GW/Packet Forwarder? If so what do the logs say.

Further up in the thread I posted a link to the manual with the AT Commands. This information combined with looking at the source files of the Lorawan library for the Seeeduino (LoRaWAN.cpp) should give you a better idea of the commands available and the ones being used. This is as much information as I have been able to find so far.

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [May 14, 2017, 8:26am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/9 "2017-05-14T08:26:00Z")

</div>

> I would double check the App Key and EUI’s.

Or, if one has access to the gateway’s log (like simply in the gateway’s “traffic” page in TTN Console) then even when the keys are wrong, one should see packets coming in. (One will even see non-TTN traffic there.) In the same “traffic” page one can also see outgoing Join Accept messages if the keys were accepted.

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 14, 2017, 8:31pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/10 "2017-05-14T20:31:10Z")

</div>

I have been doing some low power measuring and for the moment the best result I have so far is 1.25MmA draw. According to the Seeed guys it should be possible to do better than this. I have already removed to power LED and the only thing I am unsure of is if the GPS is also being put into stand-by mode. I have contacted them about this.

I looked at the schema and it does seem that there is a pin from the MCU connected to a Standby pin of the GPS module… Will have to experiment some more.

---

<div class="post-metadata">

**Author:** ![jvn](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@jvn](https://www.thethingsnetwork.org/forum/u/jvn)\
**Post date:** [May 17, 2017, 7:48am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/11 "2017-05-17T07:48:50Z")

</div>

A month ago I succeeded to get the GPS version of this LoRaWAN module running (ABP) on TTN.  
But not without a lot of dufficulties.  
One was that the API has got a new version and was not available on Internet, fortunately some one from RHF.  
In that way I discovered that one important library routine in the Seeeduino library was missing and I had to add this myself (I informed Seeeduino about that).  
This is about setting the public network key.

```auto
void LoRaWanClass::setPubNetwKey(int PubNetwKey)
{
    char cmd[64];
    
    if(PubNetwKey)
    {
		if (PubNetwKey == 1) {
			sendCommand("AT+LW=NET, ON\r\n");
		} else {
			sendCommand("AT+LW=NET, OFF\r\n");
		}
#if _DEBUG_SERIAL_
        loraDebugPrint(DEFAULT_DEBUGTIME);
#endif
        delay(DEFAULT_TIMEWAIT);
    }
}

```

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [May 17, 2017, 12:23pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/12 "2017-05-17T12:23:05Z")

</div>

OK so with several peripherals connected I2C etc… I am now at a sleep current of 200uA. Its not yet 90uA but I imagine that it coud be achievable. For my application 200uA sleep current is enough so will not be spending more time on this.

---

<div class="post-metadata">

**Author:** ![ZaneL](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zanel/32/35697_2.png) [@ZaneL](https://www.thethingsnetwork.org/forum/u/ZaneL)\
**Post date:** [June 6, 2017, 5:06pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/13 "2017-06-06T17:06:14Z")

</div>

So I haven’t managed to get this board working in either OTAA or ABP mode. Not sure whether the problem is with my gateway or the board. In OTAA it just says join failed, and then in ABP it says the message length is incorrect. I’ve entered all of the my application and device paramters using lora.setKey() and lora.setId()

I was thinking about going through and rewriting the library to see if I can get it to work that way. It’s fairly simple (just sending and receiving serial commands to the RHF76 module).

I’m a little confused about jvn’s post. I can see that the function he added sends this string `"AT+LW=NET, ON\r\n"`, yet I don’t see that command anywhere in the datasheet for the module. Is this a command that only works in some secret updated firmware version of the RHF76?

---

<div class="post-metadata">

**Author:** ![ssozonoff](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ssozonoff/32/40685_2.png) [@ssozonoff](https://www.thethingsnetwork.org/forum/u/ssozonoff)\
**Post date:** [June 6, 2017, 7:05pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/14 "2017-06-06T19:05:59Z")

</div>

I have not had any problems and have not needed to add any code or anything. Both OTAA and ABP mode work fine.

---

<div class="post-metadata">

**Author:** ![ZaneL](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zanel/32/35697_2.png) [@ZaneL](https://www.thethingsnetwork.org/forum/u/ZaneL)\
**Post date:** [June 6, 2017, 7:17pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/15 "2017-06-06T19:17:14Z")

</div>

Okay thanks, maybe it’s my gateway. I added the new multi protocol forwarder to it recently.

---

<div class="post-metadata">

**Author:** ![jvn](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@jvn](https://www.thethingsnetwork.org/forum/u/jvn)\
**Post date:** [June 7, 2017, 6:27am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/16 "2017-06-07T06:27:49Z")

</div>

To ZaneL, If someone knows how how to attach a file I could send you the latest version (3.1) of the PS01509 LoRaWAN AT Command Specification.

---

<div class="post-metadata">

**Author:** ![ZaneL](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zanel/32/35697_2.png) [@ZaneL](https://www.thethingsnetwork.org/forum/u/ZaneL)\
**Post date:** [June 7, 2017, 3:46pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/17 "2017-06-07T15:46:23Z")

</div>

@jvn That would be helpful! I think you can just click the “Upload” button after you click reply and upload the file?

---

<div class="post-metadata">

**Author:** ![ZaneL](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zanel/32/35697_2.png) [@ZaneL](https://www.thethingsnetwork.org/forum/u/ZaneL)\
**Post date:** [June 7, 2017, 5:58pm UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/18 "2017-06-07T17:58:09Z")

</div>

So my problem is that I’m not really sure what settings I need to use for the United States. For example the header file lists these possible settings…

```
******************************************************************
Type DataRate Configuration BitRate| TxPower Configuration
US915 0 SF10/125 kHz 980 | 0 30dBm
        1 SF9 /125 kHz 1760 | 1 28dBm
        2 SF8 /125 kHz 3125 | 2 26dBm
        3 SF7 /125 kHz 5470 | 3 24dBm
        4 SF8 /500 kHz 12500 | 4 22dBm
        5:7 RFU | 5 20dBm
        8 SF12/500 kHz 980 | 6 18dBm
        9 SF11/500 kHz 1760 | 7 16dBm
        10 SF10/500 kHz 3900 | 8 14dBm
        11 SF9 /500 kHz 7000 | 9 12dBm
        12 SF8 /500 kHz 12500 | 10 10dBm
        13 SF7 /500 kHz 21900 | 11:15 RFU
        14:15 RFU | 
*******************************************************************

```

So in my code I did the following, based on the settings from [here](https://github.com/TheThingsNetwork/gateway-conf/blob/master/US-global_conf.json):

```
lora.setChannel(0, 903.9);
lora.setChannel(1, 904.1);
lora.setChannel(2, 904.3);
lora.setChannel(3, 904.5);
lora.setChannel(4, 904.7);
lora.setChannel(5, 904.9);
lora.setChannel(6, 905.3);

```

There are also these settings and I’m not sure which to choose.

```
lora.setDataRate(DR0, US915);
lora.setAdaptiveDataRate(true);    
lora.setReceiceWindowFirst(1);
lora.setReceiceWindowSecond(905.6, DR0);
lora.setPower(20)

```

Specifically I don’t know what data rate to choose, and which frequency and data rate to choose for the second rx window. All of the info I can find only specifies these settings for the EU region.

---

<div class="post-metadata">

**Author:** ![jvn](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@jvn](https://www.thethingsnetwork.org/forum/u/jvn)\
**Post date:** [June 8, 2017, 5:31am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/19 "2017-06-08T05:31:40Z")

</div>

I found this upload button, thanks.  
Here is the document.[LoraWAN API.pdf](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/9/9b9067781ac614cff3d2e25b669c084e09e47751.pdf) (1.1 MB)

---

<div class="post-metadata">

**Author:** ![toddkrein](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/toddkrein/32/25844_2.png) [@toddkrein](https://www.thethingsnetwork.org/forum/u/toddkrein)\
**Post date:** [October 4, 2017, 5:20am UTC](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164/20 "2017-10-04T05:20:01Z")

</div>

Zane, I’ve got my RHF76-052 working OK. Not great, and not nearly as good as my ST Micro board, but I may be able to help you out a little. The first thing I did was a factory reset on the device, and then when I set the data rates to US915, all of the RXWIN1, DR, and CH entries were correct.

For each run, do the software (not factory) reset, and set the data rate to DRO, US915.  
Turn on ADR.  
Set the mode to LWOTAA  
Next, you turn on the RXWIN1  
RXWIN2 should be 923.3, DR8. (See section 2.2.7 of the LoRaWAN spec)  
Power should be set to 14.

After that, I was able to connect to TTN, but it generally takes 15 - 25 join attempts before it actually works.

If you want to PM me, I can send you my updated LoRa libraries and the Arduino sketch.

[Next page](https://www.thethingsnetwork.org/forum/t/rhf76-052am-getting-it-working-with-otaa/7164.md?page=2)
