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:
http://docs.micropython.org/en/latest/

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

Description:

nrf:
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).

rak5010_micropython.hex:
Include application and softdevice

init.py:
Initialization script of RAK5010

rui.py:
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/
5.execute:
cd micropython
git submodule update --init
make -C mpy-cross
cd micropython/ports/nrf
./drivers/bluetooth/download_ble_stack.sh
make BOARD=pca10056 SD=s140
6.firmware.hex will be in micropython/ports/nrf/build-pca10056-s140

Notes:

  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!