Arduino on Rak5010!

Hi Everyone.
Since Micropython on Rak5010 published last week, more and more developers show great interest on it.
So we will publish Arduino on Rak5010 this week, it will be as popular as Micropython on Rak5010.

OK! Here we go!

  1. What is Arduino?
    If you know little about Arduino, please have a look below:
    https://www.arduino.cc/

  2. You have known Arduino. Install the IDE first:
    https://www.arduino.cc/en/Main/Software

  3. What lib is used?
    Rak5010 is based on nRF52840, so as Adafruit Feather nRF52840 Express. Therefore Arduino Core for Adafruit Bluefruit nRF52 Boards is suitable for Rak5010, except for the GPIO maping table. This makes it easily to transplant. Rak5010 use the lib of Adafruit and gpio maping of PCA10056.

  4. How to install Adafruit Bluefruit nRF52 in Arduino?
    https://github.com/adafruit/Adafruit_nRF52_Arduino

  5. Check the other lib below install or not?

  6. Download the gpio map of Rak5010 from:
    https://github.com/RAKWireless/Arduino-on-Rak5010-
    It contains gpio maping, serial tool, demo project and important hex.

  • PCA10056: GPIO maping of Rak5010

  • Serial tool: A good tool for debug

  • Rak5010.ino: Demo project

  • feather_nrf52840_express_bootloader-0.2.13_s140_6.1.1.hex : Hex include softdevice6.1.1 and bootloader support USB download from Arduino. It is a great method.

  1. Replace your code with our code PCA10056, your code path maybe like:
    C:\Program Files (x86)\Arduino\hardware\Adafruit\Adafruit_nRF52_Arduino\variants\pca10056

  2. OK, development environment is finished. The next step is very important. Download the hex to Rak5010 with Jlink. It just need once.

  3. Open the Rak5010.ino, connect Rak5010 to your pc via usb. It will be recognized as Adafruit Feather nRF52840 Express :slight_smile:.

  4. Check the config, it should be like below:

  5. Compile and download. Ingnore the Waring:

  6. When download ok. Remember to remove the usb, open serial tool, insert usb, The demo project shows all sensors data on Rak5010 and a ble advertiser named “Rak5010”.

Notes:
The power up order is similar as power down order. So if download finish, change to serial tool directly, bg96 may power up fail. Secure order is:
Download—>remove usb(power down)—>insert usb—>open serial tool.

We have solve some bug, changelog is below:

  1. Add bg96 init about ATE0, GPS config just once

  2. Because the hardserial RX buffer size is limited for 64. Some AT response will show just part like GPS. It seems not a easy problem.

  3. If you write your code about communicating with bg96, remember each AT will need return info. It is better read it for clean the uart buffer. Do not just send without read.

1 Like

Hi Nero,

I’m testing out the RAK5010 with Arduino and it seems the GPIOs and the green user LED3 are missing in the variant.h file.

Or did I miss something? I would like to connect a tiny buzzer.

Could you also post an example of how to use the flash memory to store some variables please?

Thank you for your support.

Hi,
You are right. The LED3 is not in the header in this example.
If you want to connect peripheral, there are four gpio on the board.
As you know, it is based on adafruit bsp library, and the made a litttle file system in it. So I think you can refer these examples:

Thank you,

The Bluefruit FS is working with the examples.

Could you please tell me what are the digital GPIOs PIN numbers on the Arduino?

I would like to do a digitalWrite(BUZZER_PIN, HIGH)

Thanks

Hi,
You can refer to this:

There are 4 gpio for users. IO1-IO4, You can define it in variant.h with nordic pin num and use it. But remember to power up GPIO VREF which controls the 4 gpios on/off.

Hi Nero,

In the schematic the pin NRF_IO1 is the P0.19, but it seems to be already mapped in the variant.h as:
#define PIN_QSPI_SCK 19

I’m not confident enough to do that by myself, I worry to burn the circuit by doing a bad manipulation.

Could you please update the official RAK5010 Arduino support to add the GPIOs and the green LED?

That would help everyone else who want to use Arduino.

Thanks

Hi,
In fact, the gpio define in variant.h is what you decide. I used the I2C and uart, so I just change the relevant gpio. As for others, change to what you want. It will not have any problems because of 5010 not used others, like QSPI.

Sorry I really don’t understand how to do that, can you show an example on to map the GPIO and power up the GPIO VREF on Arduino please?

In fact, there is no need to do it in variant.h, you can do it directly in .ino like below:

The pin number is 19, just do directly. As for the VREF, it just needs external power 3.3 V. It can’t be pulled in code.

Thanks,

Can you please confirm that the VREF is the J12 EXT_VREF PIN defined in https://doc.rakwireless.com/datasheet/rakproducts/pin-definition ?

Would you recommend to connect the J10 VBAT to J12 EXT_VREF PIN to power the GPIO?

The buzzer needs full power to get 90db sound volume.

Yes, J10 VBAT to J12 EXT_VREF PIN is OK. But remember to connect your GND buzzer to GND of 5010.

Hi, I have a problem starting up the BG96 module. I think that the blue led should be always on, but the LED is blinking and the terminal is printing RDY as soon as the LED turns on. I think the module is rebooting.