Micropython on RAK5010!

Glad to announce we have run micropython on RAK5010. I will introduce the details below, here we go!

If you know little micropython, maybe you can see it first:

OK, you get the point of micropython, let’s begin. We provide the source code, firmware, python script and serial tool at:


Source code of 5010, its path on micropython is \micropython\ports\nrf. If you are developer, you can replace the orginal code on micropython.

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

Include application and softdevice

Initialization script of RAK5010

RAK5010 moudle with api like get_acceleration, get_light_strength, get_pressure, get_gps, cellular_tx

How to run?

  1. Download the hex and burn it to RAK5010 by jlink.
  2. Connect RAK5010 to pc with usb.
  3. Download the serial tool and open it. Choose COM of RAK5010 and open port.
  4. If you see the start up infomation, congraulations! It runs normal and in REPL mode. You can use it as a python terminal.
  5. Import the init.py and rui.py. Here we need use ampy. I use mingw32 in msys32, install method is:
  • Install Python2 or Python3

  • Add the python and pip path to system path: C:\Python27\Scripts C:\Python27

  • enter cmd.exe, run : pip install adafruit-ampy If successful, it will show:

  1. Close Serial port tool. Run in cmd.exe in follow order.
  • ampy --port COM33 put rui.py

  • ampy --port COM33 put init.py

  1. Close cmd and open serial tool, use CTRL+D to restart device, it shows like:

  2. Use rui.py like below:

How to develop?
We supply the source code for user. So user could do own application. I compile in linux, as below:

1.Download the micropython:

2.Replace \micropython\ports\nrf with our code.
3.Install arm-none-eabi-gcc for linux
sudo apt-get install gcc-arm-none-eabi
4.Install python3, refer to: https://www.tecmint.com/install-python-in-ubuntu/
cd micropython
git submodule update --init
make -C mpy-cross
cd micropython/ports/nrf
make BOARD=pca10056 SD=s140
6.firmware.hex will be in micropython/ports/nrf/build-pca10056-s140


  1. Our hex provides the basic api for sensors and bg96 on board. Micropython original thing is still work, like CTRL+D for restart
  2. It runs the ble_uart_nus demo as periphral, device name is rak5010
  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
1 Like

Hi everyone,

This is the first version firmware based on Micropython for RAK5010, so there may be some incompleted features. We open all the source code here so that everyone can use it to do more customized features based on RAK5010. Surely, it will be grateful that anyone can help to complete all features togather with us, and any suggestions from you will be great! :slight_smile:

We have got a contribution, the rui.py will be more abundant. Everyone can submit code to :

If test ok, it will be merged.

I have added a lot more today :slight_smile: You’ll get a proper diff on Monday!

We have an issue, we can not connect to the device after we install the micropython hex file.

We start the RAK5010. We flash rak5010_micropython.hex using JLink and the USB to device cable. We then start the serial tool, but it does not find the RAK device anymore, the COM port is not in the ports list.

If we flash the device using the standard firmware - https://downloads.rakwireless.com/en/Cellular/RAK5010/Firmware/RAK5010_V3.0.0.8.rar, than we can connect to the device using the COM port…

Any ideas?

I have test the rak5010_micropython.hex, it is ok. Do you copy all files of serial tool? The .ini is the config file of serial. After download, remove usb and insert again. It should be like below:

If you just supply power with usb, sholud keep usb voltage stable.

Hi and sorry for the late reply!

We downloaded the .hex file again and it worked well.


This is an amazing news! Micropython and RAK :slight_smile:
Looking forward to more.

Hi, were can I get the python library documentation?


What kind of library do you want? micrpopython documentation? Or about other?

Almost a year later, let’s get this thread active again.

I’m having the same problem as CristianBell was having.
I’m able to successfully burn the .hex to the RAK5010 using the RAK DAP, however, after plugging the USB to the RAK I’m unable to see any serial port available.

If I burn the standard firmware .hex (no MicroPython), then I’m able to see the serial port.
So, my serial application and the USB cable work.

Is there any trick after burning the MicroPython .hex to the RAK5010? I’m using pyocd with RAK DAP.

I see that the RAK5010 MicroPython GitHub repository hasn’t been updated in 17 months. Does the Dec 3 2019 MicroPython .hex still work with the new RAK5010s?

Maybe you can try as below:

  1. Erase all flash with DAP
  2. Download the hex.
  3. Better connect to a battery

Although the hex is not updated for long time, we test it and it is ok.


Thank you nero, erasing the flash did the trick.
Maybe there was something left in the memory from the older firmware.

I see that the version of MicroPython used in that .hex is the 1.11.
In order to develop my own compiled version, I cloned the MicroPython repository (now in v1.15) and copied the RAK nrf folder to the /ports.
It starts compiling but it stops in an error:

$ make BOARD=pca10056 SD=s140
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build-pca10056-s140/genhdr
Create build-pca10056-s140/genhdr/pins.h
GEN build-pca10056-s140/genhdr/mpversion.h
GEN build-pca10056-s140/genhdr/moduledefs.h
make: *** No rule to make target lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c', needed by build-pca10056-s140/genhdr/qstr.i.last’. Stop.

I cloned the MicroPython v1.12, compiled, and it works fine. It seems there is semi-recent change in newer MicroPython versions that broke the tinyusb.
If I copy the contents of the pca10056 folder (mpconfigboard.h, mpconfigboard.mk and pins.csv) to the newer version (v1.15), is that enough? Or there are any other files that RAK changed that I should copy as well?

Hi, because it is a long time not to update, I’m not clear the change of Micropython Version. But the code in boards is just about hardware config, like pin define of I2C, Uart, SPI… So theoretically, just copy it is enough.