How ricaun/loranow works
Project Type and Purpose
• Type: An open‐source Arduino/ESP library for Node↔Gateway LoRa communication.
• Purpose: Expose a simple API (LoRaNow class) on microcontroller sketches, implement a state machine, checksum, ID management, and wrap the lower‐level Arduino‐LoRa driver.
File Structure
• Root files (README.md, API.md, library.properties): define metadata, documentation, API.
• src/: core library code
– LoRaNow.cpp/.h: public API, state machine, packet framing.
– utility/: wrapper around Sandeep Mistry’s Arduino‐LoRa (LoRa.cpp/.h) and helper routines (LoRaUtilities).
• examples/: sketches for Node and Gateway on Arduino, ESP8266, ESP32.
• keywords.txt: Arduino IDE integration.
• License, Gitignore: ancillary.
README for Insights
• API: LoRaNow.setPins(), setFrequency(), send(), receive()
• Layers: Sketch → LoRaNow → Arduino‐LoRa → RFM95W hardware
• Hardware: MCU (Arduino/ESP) + RFM95W LoRa module.
Main Components
a. MCU Application (Sketch)
b. LoRaNow Library (LoRaNow class + utilities)
c. Underlying Arduino‐LoRa Driver (external dependency)
d. LoRa Radio Module (RFM95W)
e. Radio Link (air interface)
f. Gateway Application (another MCU running LoRaNow)
Relationships & Interactions
• Sketch calls LoRaNow API
• LoRaNow manages state machine, frames payload (ID, checksum)
• LoRaNow invokes Arduino‐LoRa driver to send/receive raw bytes
• Driver toggles SPI lines to RFM95W module
• RFM95W transmits over radio link to other nodes/gateway
• Incoming packets reverse through driver → LoRaNow parsing → Sketch callback
Architectural Patterns & Principles
• Layered abstraction (API → library internals → hardware driver → physical radio)
• State machine pattern for TX/RX management
• Plug-and-play extensibility via utility wrappers
• Separation of concerns: framing & protocol in LoRaNow, RF details in Arduino-LoRa
Relevant Technologies
• C++ classes (LoRaNow, LoRa, LoRaUtilities)
• Arduino IDE integration (library.properties, keywords.txt)
• Platforms: AVR (Arduino), ESP8266, ESP32
• RFM95W LoRa transceiver via SPI
Detailed Component Breakdown
– Sketch Layer: examples/LoRaNow_Node.ino, _Gateway.ino
– LoRaNow Core: src/LoRaNow.{h,cpp}
– Utilities: src/utility/LoRa*.{h,cpp}
– External Driver: Arduino-LoRa (indicate as third-party)
– Hardware: RFM95W pins (SS, DIO0, SPI lines)
– Radio Medium: 868/915 MHz band