drogue-rak811

Crates.iodrogue-rak811
lib.rsdrogue-rak811
version0.4.0
sourcesrc
created_at2021-01-14 13:10:32.05354
updated_at2021-01-14 13:13:57.290502
descriptionNetworking stack for RAK811 LoRa breakout board
homepagehttps://blog.drogue.io
repositoryhttps://github.com/drogue-iot/drogue-rak811
max_upload_size
id341903
size46,046
Ulf Lilleengen (lulf)

documentation

README

Drogue IoT RAK811

crates.io docs.rs Matrix

A network driver for a RAK811 attached via a UART.

Currently requires the RAK811 to be flashed with a 2.x version of the AT firmware.

At first, the UART must be configured and handed to the driver. The uart must implement the embedded_hal::serial traits.

Usage

let (uarte_tx, uarte_rx) = uarte
    .split(ctx.resources.tx_buf, ctx.resources.rx_buf)
    .unwrap();


let driver = rak811::Rak811Driver::new(
    uarte_tx,
    uarte_rx,
    port1.p1_02.into_push_pull_output(Level::High).degrade(),
)
.unwrap();

In order to connect to the gateway, the LoRa node needs to be configured with the following:

  • Frequency band - This depends on where you live.
  • Mode of operation - This can either be LoRa P2P which allows the node to send and receive data directly from another LoRa node, or LoRaWAN which connects the node to a gateway.

The driver can be used to configure the properties in this way:

driver.set_band(rak811::LoraRegion::EU868).unwrap();
driver.set_mode(rak811::LoraMode::WAN).unwrap();

In addition, the following settings from the TTN console must be set:

  • Device EUI
  • Application EUI
  • Application Key
driver.set_device_eui(&[0x00, 0xBB, 0x7C, 0x95, 0xAD, 0xB5, 0x30, 0xB9]).unwrap();
driver.set_app_eui(&[0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x03, 0xB1, 0x84])

// Secret generated by network provider
driver .set_app_key(&[0x00]).unwrap();

To join the network and send packets:

driver.join(rak811::ConnectMode::OTAA).unwrap();

// Port number can be between 1 and 255
driver.send(rak811::QoS::Confirmed, 1, b"hello!").unwrap();
Commit count: 25

cargo fmt