{"id":26742766,"url":"https://github.com/fescron/efm32-rn2483-masterbuoy","last_synced_at":"2025-03-28T06:20:02.863Z","repository":{"id":209518928,"uuid":"158574333","full_name":"Fescron/EFM32-RN2483-Masterbuoy","owner":"Fescron","description":"Happy Gecko (SLSTK3400A) interfacing with LoRaWAN using dbprint","archived":false,"fork":false,"pushed_at":"2019-09-28T15:51:22.000Z","size":440,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-11-27T19:54:46.531Z","etag":null,"topics":["cayenne","dbprint","dramco","emf32","emlib","geckoboard","happygecko","iot","kuleuven","lora","lorawan","microcontroller","putty","rn2483","simplicity-studio","slstk3400a","thethingsnetwork","uart","wireless-communication"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fescron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-21T16:08:41.000Z","updated_at":"2023-11-27T19:54:53.318Z","dependencies_parsed_at":"2023-11-27T19:54:50.586Z","dependency_job_id":"ba7c13a9-a638-4ad8-8cf0-64aa4b142c5b","html_url":"https://github.com/Fescron/EFM32-RN2483-Masterbuoy","commit_stats":null,"previous_names":["fescron/efm32-rn2483-masterbuoy"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fescron%2FEFM32-RN2483-Masterbuoy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fescron%2FEFM32-RN2483-Masterbuoy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fescron%2FEFM32-RN2483-Masterbuoy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fescron%2FEFM32-RN2483-Masterbuoy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fescron","download_url":"https://codeload.github.com/Fescron/EFM32-RN2483-Masterbuoy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245978684,"owners_count":20703778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cayenne","dbprint","dramco","emf32","emlib","geckoboard","happygecko","iot","kuleuven","lora","lorawan","microcontroller","putty","rn2483","simplicity-studio","slstk3400a","thethingsnetwork","uart","wireless-communication"],"created_at":"2025-03-28T06:20:02.294Z","updated_at":"2025-03-28T06:20:02.847Z","avatar_url":"https://github.com/Fescron.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EFM32-RN2483-Masterbuoy\n\nThe code is based on the [DRAMCO EFM32-RN2483-LoRa-Node example](https://github.com/DRAMCO/EFM32-RN2483-LoRa-Node) with functions from [dbprint](https://github.com/Fescron/dbprint) aswell and is designed for use on the [EMF32 Happy Ghecko board](https://www.silabs.com/products/development-tools/mcu/32-bit/efm32-happy-gecko-starter-kit).\n\n\nAdded code is marked with ```/* BEGIN ADDED CODE ********/``` and ```/* END ADDED CODE ********/```. Code was added in the following files when starting from the DRAMCO example:\n- ```src/my_lora_device.h``` (```LORAWAN_DEVICE_EUI```, ```LORAWAN_APPLICATION_EUI``` and ```LORAWAN_APPLICATION_KEY``` hidden)\n- ```lora/lpp.c```\n- ```lora/lpp.h```\n- ```system/leuart.c```\n\n Added the following file (declaration of \"public\" variables):\n - ```src/main.h```  \n\n**Other useful links:**\n- [The Things Network - Applications (Register LoRaWAN device)](https://console.thethingsnetwork.org/applications/)\n- [Cayenne Dashboard](https://cayenne.mydevices.com/cayenne/dashboard/start)\n\n------\n\n## 1 - Documentation\n\nThis code receives messages over UART (**115200 baudrate**) using interrupts, parses the characters back to numbers, repacks it into a LPP (Cayenne Low Power Payload) packet and sends the data to the cloud using a LoRaWAN network.\n\n### 1.1 - Code flow\n\nThe following flowchart mostly describes the added functionality. For the sake of completeness all of the logic states (INIT, ...) are added but not really further discussed. Most of the code was added in the state **SEND** and **SLEEP**.\n\n![Flowchart](/latex-flowchart/flowchart.png?raw=true \"Flowchart\")\n\n#### 1.1.1 - Extra notes on the flowchart\n- **(\\*1):** If there was a line received using interrupts on UART *AND* there is at least one of the three buffers free, copy the received data to one of those buffers.\n- **(\\*2):** Check if **one (of three)** or more buffers are filled *AND* at least one of the two data fields (```data0``` and ```data1```) are free.\n- **(\\*3):** Parse the data out of a used buffer into a free data field.\n\n#### 1.1.2 - Processes (= states of the logic) on the flowchart\n- **INIT:**\n  - Initialize system \u0026 chip (clocks, ...).\n  - Initialize delay function.\n  - Initialize interrupts (IRQ).\n  - Initialize LED functions to give feedback when there is an error.\n  - Initialize buttons and their interrupt functionality.\n  - Initialize power management.\n  - Initialize ADC for reading the battery voltage.\n  - Initialize I²C for sensor readout.\n  - Initialize UART using dbprint functionality for:\n    - Printing debug messages.\n    - Getting input using interrupts.\n    - Parsing characters to values.\n- **JOIN:**\n  - Initialize LoRaWAN communications with *Over The Air Activation* (OTAA).\n- **MEASURE:**\n  - Read battery voltage.\n  - Read relative humidity.\n  - Read temperature.\n    - **NOTE:** The sensor readouts are not really used since we have a limited amount of bytes we can send to the cloud.\n- **SEND:**\n  - See flowchart.\n- **SLEEP:**\n  - See flowchart.\n  \n------\n\n### 1.2 - Structure of messages\n\n#### 1.2.1 - UART\n\nThe Received UART lines need to have the following structure (the data is in **decimal notation**):\n\n|     Data    | Bouy ID |  RSSI   |  VBAT   |\n|:-----------:|:-------:|:-------:|:-------:|\n| **Length**  | 3 chars | 2 chars | 3 chars |\n| **Example** |   008   |   66    |   325   |\n\nThe example data corresponds with:\n- **Bouy ID** = 8\n- **RSSI** = (-)66\n- **VBAT** = 3,25 V\n  - **NOTE:** The VBAT data gets send to \"the cloud\" with a **bouy-ID-offset of \"1\"**!!\n\n#### 1.2.2 - LPP\n\nAfter parsing the UART characters back to numbers, the retransmitted [Cayenne Low Power Payload](https://github.com/myDevicesIoT/cayenne-docs/blob/master/docs/LORA.md) packet has the following structure (the data is in **hexadecimal notation**, *each column represents one byte*):\n\n| LPP terminology | Data channel |   Data type   | Byte 0 | Data channel |  Data type   | Byte 0 | Byte 1 | \n|:---------------:|:------------:|:-------------:|:------:|:------------:|:------------:|:------:|:------:|\n|    **Data**     |   Bouy ID    | Digital Input |        | Bouy ID + 1  | Analog Input |        |        |\n|   **Example**   |      08      |      00       |   42   |      09      |      02      |   01   |   45   |\n\nAs noted above, the **RSSI value** is *disguised as* an **analog input** while the **VBAT data** is *disguised as* a **digital input**.\n\nThe example data corresponds with:\n- **Bouy ID** = 0x08 = 8d\n- **RSSI** = 0x42 = 66d\n- **VBAT** = 0x0145 = 325d\n  - **NOTE:** The VBAT data gets send to \"the cloud\" with a **bouy-ID-offset of \"1\"**!!\n\n\u003c!--\n-----\n\n## 2 - Installation instructions (Simplicity Studo v4)\n\n[This DRAMCO tutorial](https://dramco.be/tutorials/low-power-iot/technology-campus-ghent-2018/iot-development-environment/node) also has interesting info about setting everything up.\n\n### 2.1 - Import the files on this REPO as an existing project\n\n`File \u003e Import \u003e General \u003e Existing Projects`\n\n![Instructions](https://dramco.be/tutorials/low-power-iot/technology-campus-ghent-2018/user/pages/03.iot-development-environment/02.Node/ezgif-3-c109845b4d-2.gif \"Instructions\")\n\n### 2.2 - Add \"dbprint\" to the project\n\nSee [dbprint GIT repo](https://github.com/Fescron/dbprint).\n\n### 2.3 - Change settings for the specific LoRaWAN application\n\nThese settings are in the file `src/my_lora_device.h`.\n\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffescron%2Fefm32-rn2483-masterbuoy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffescron%2Fefm32-rn2483-masterbuoy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffescron%2Fefm32-rn2483-masterbuoy/lists"}