Project Overview
The "Long-Range IoT Light Control" project is a professional-grade demonstration of LoRa (Long Range) wireless technology for home and industrial automation. Utilizing two Reyax RYLR896 transceiver modules, this project enables the wireless control of lighting systems over distances exceeding several kilometers, far surpassing the range of traditional Wi-Fi or Bluetooth. The core engineering achievement is the implementation of a reliable Acknowledgment (ACK) protocol, ensuring that every command sent is confirmed by the receiver, eliminating the "silent failure" risk common in simple remote control systems.
In this tutorial, you will learn how to use the Reyax RYLR896 LoRa modules to wirelessly and reliably control lights. We will take advantage of these modules' ability to send and receive data over long distances, as well as their acknowledgement functionality, to ensure that light on and off signals are received correctly.
Tutorial Contents:
Introduction to RYLR896 LoRa Modules :
Features and technical specifications.
Initial setup and connection.
Introduction to RYLR896 LoRa Modules :Features and technical specifications.Initial setup and connection.
Necessary materials :
LoRa Reyax RYLR896 modules (two units).
Luces LED.
Microcontrollers (Arduino uno and nano).
Additional components (resistors, cables, power supply).
Necessary materials :LoRa Reyax RYLR896 modules (two units).Luces LED.Microcontrollers (Arduino uno and nano).Additional components (resistors, cables, power supply).
Hardware Configuration :
Connecting LoRa modules to the microcontroller.
Mounting the light control circuit.
Hardware Configuration :Connecting LoRa modules to the microcontroller.Mounting the light control circuit.
Microcontroller Programming :
Configuring the LoRa module for transmission and reception.
Code to send the on/off signal.
Implementation of acknowledgement to ensure signal reception.
Microcontroller Programming :Configuring the LoRa module for transmission and reception.Code to send the on/off signal.Implementation of acknowledgement to ensure signal reception.
Testing and Troubleshooting :
Verifying communication between modules.
Troubleshooting common issues and configuration settings.
Testing and Troubleshooting :Verifying communication between modules.Troubleshooting common issues and configuration settings.
Practical applications :
Examples of home use and automation projects.
Project expansion to control multiple lights or devices.
Practical applications :Examples of home use and automation projects.Project expansion to control multiple lights or devices.
Tutorial Objectives:
Understand the basic operation of Reyax RYLR896 LoRa modules.
Learn how to configure and use modules for wireless communication.
Implement a lighting control system with confirmation of signal reception.
Develop skills to integrate LoRa into IoT and automation projects.
This tutorial is ideal for electronics and automation enthusiasts who want to explore the potential of LoRa communication for practical, long-range applications. Upon completion, you will have a functional system that will allow you to control lights wirelessly and reliably.
868/915MHz LoRa® Antenna Transceiver Module
◆ Certification: NCC, FCC
◆ Frequency range: 868/915 MHz
◆ Motor Semtech SX1276
◆ High efficiency power amplifier
◆ Excellent immunity to blocking.
◆ Low receiving current
◆ High sensitivity
◆ Easy control via AT commands
◆ Rango dinámico RSSI de 127 dB
◆ Designed with integrated antenna
◆ AES128 data encryption
◆ Working temperature: -40℃ to +85℃
◆ Dimensions: 42.5 x 18.36 x 5.5 mm
◆ Weight: 7 g
Description
The RYLR896 transceiver module features the LoRa® long-range modem that provides ultra-long-range spread spectrum communication and high immunity to interference while minimizing current consumption. The module is NCC and FCC certified.
Electronic components of the project
Arduino Nano

A socket for arduino

Un resistor de 1 KOhm

A 5mm LED diode

Female pins

Dupont cables female male

Display oled sh1106

This is a 128x64 dot monochrome OLED display module with I2C interface. It has several advantages over LCD displays, such as high brightness, very good contrast, a wider viewing angle, and low power consumption. It is compatible with Arduino Rasberry Pi and PIC microcontrollers among others. It works with logic levels from 3.3V to 5V and has a viewing angle greater than 160 degrees. The screen size is 1.3 inches. It is powered by a voltage of 3.3V to 5V. It can be used in applications such as smart watches, MP3, thermometers, instruments, and various projects, etc.
Characteristics
Interface: I2C(3.3V / 5V logic level)
Resolution: 128 x 64
Angle of view: >160 degree
Display color: Blue
Display size: 1.3 inch
Driver IC: SH1106
Power supply: DC 3.3V~5V
Operating temperature: -20~70’C
Application: smart watch, MP3, thermometer, instruments, DIY projects, etc.
A KY-004 push button module

PCB


https://rogerbit.com/wprb/wp-content/uploads/2023/05/PCB_ky-032_contador.zip
Electronic pcb diagram

Circuit with arduino nano

Circuit with Arduino Uno

Technical System Architecture
- LoRa Modulation (SX1276): The RYLR896 modules are built on the Semtech SX1276 chipset. Unlike standard FSK modulation, LoRa uses Chirp Spread Spectrum (CSS). This allows the signal to be decoded even when it is well below the noise floor, providing extreme range and high link robustness against obstacles like buildings or trees.
- UART AT-Command Interface: These modules are controlled via a simple serial interface using AT Commands. This abstracts the complex LoRa physical layer, allowing the Arduino to send a message by simply transmitting
AT+SEND=0,5,HELLOover its TX pin. - The Acknowledgment (ACK) Handshake:
- Transmitter: Sends an "ON" command and enters a "Wait for ACK" state.
- Receiver: Receives the packet, toggles the light, and immediately broadcasts an "ACK" packet back to the transmitter's address.
- Timeout & Retry: If the transmitter does not receive the "ACK" within a specific window (e.g., 500ms), it automatically re-transmits the command. This closed-loop logic ensures that the light actually turns on, even in poor signal conditions.
- OLED Feedback System: The SH1106 OLED Display on the transmitter provides a professional user interface. It displays the "Packet Sent" status, the "Link Signal Strength" (RSSI), and confirms when the remote ack has been received. This visual feedback is vital for long-range deployment where the user cannot physically see the light they are controlling.
Engineering & Reliability
- Security: The RYLR896 supports AES128 data encryption, preventing unauthorized users with similar LoRa modules from hijacking the lighting system.
- Frequency Coordination: Operating in the 868/915 MHz bands (ISM bands), the modules use frequency hopping and high immunity to blocking, ensuring that cell phone signals or Wi-Fi routers do not interfere with the mission-critical lighting control.
- Power Efficiency: The modules are highly efficient, drawing very little current in idle mode, making them suitable for solar-powered remote stations or battery-operated transmitters.