Micropython & LoRaWAN on RAK4600

Glad to announce we have run micropython on RAK4600, which is a new try to combine micropython and LoRaWAN!

If you know little micropython, maybe you can see it first:
http://docs.micropython.org/en/latest/

OK, you get the point of micropython, let’s begin. We provide the LoRaWAN on python version, firmware, app python script and serial tool at:

Description:

LoRaWAN:
A tiny loRaWAN realized by python from below and I have modified bsp part in order to adapt to RAK4600. It just supports ABP with TTN now.

serial tool:
We provide a powerful serial tool to debug. You also can use others like putty(DTR is needed).

micropython_rak4600.hex:
Include application and softdevice

lora.py:
app script for RAK4600

What do you need to prepare for before playing?

  • RAK4600 on wisblock like below. It is very easy to connect many type of sensors with standard P2P(do not forget antenna):

  • A TTN account and creat a ABP Application of your region(like EU868). Remember disable the Frame counter checks, because our demo disable it in lora.py.

OK, Let’s begin.

  • First burn the micropython_rak4600.hex with jlink like below:

  • Then connect board(do not forget antenna) to your PC with USB, open the serial tool, press reset button, it will show:

Congradulations! It has run normally! Because our hex includes the LoRaWAN. What you need is just push the lora.py to board file system with ampy. How to install ampy? You can refer to this:

OK, before push, you should change some parameters with your application of TTN like below:

DEVADDR = bytearray([0x26, 0x01, 0x1F, 0xCF])

NWKEY = bytearray([0xC0, 0x24, 0x7D, 0x95, 0x3A, 0x68, 0x30, 0x8B, 0xA2, 0x80, 0xC3, 0x00, 0x16, 0x69, 0x82, 0x5C])

APP = bytearray([0x71, 0xB3, 0x42, 0x2B, 0x67, 0xA7, 0x55, 0x10,0x4E, 0x6F, 0xAF, 0x1A, 0xF9, 0xA9, 0x90, 0x51])

REGION = “EU”

Notes: “EU” for eu868, “AU” for au915, “US” for us915, “AS” for as920

  • Push it to board like below. Then you can check it with import os and os.listdir(). If it exists, OK!:

Everything is OK and ready to send your data to TTN! In serial tool, input below:
import lora
lora.send(“123”)

After Tx Finish, you will see it in TTN like below:

Done! Very easy.

For developers who want to do some personalized functions like OTAA, I advised you compile your own hex. You can get the code from below. Change the Uart TX and RX to suit for RAK4600 and put the LoRaWAN to \ports\nrf\freeze. Compile with make BOARD=pca10040 SD=s132 FROZEN_MPY_DIR=freeze. The Hex just includes application, without softdevice:

Notes:

  1. Micropython original thing is still work, like CTRL+D for restart
  2. It runs the ble_uart_nus demo as periphral
  3. User can do any change they want.
  4. We are keeping study how to run script automatically, other than just in REPL mode. If you make it true, it is nice to share with us and other developers

This doesn’t include the IN865 frequency. Does this support IN865 or I need to make any changes ??

Any RAK staff can help me ???

Hi,
It is from

For now, it not support IN865, but you canadd it yourself. Because all code are open