====== Compact Lora Messenger ====== == - Optimized RF Design for Maximum Coverage == [[http://uniteng.com/index.php/about-me/|Neil Hao]] Starts from 2021/Jul/09 to ~~LASTMOD~~ (Last Modification) ===== Overview ===== This project aims to design a credit card size Lora Messenger which does not depend on Internet or Cellular network. In other words, users can chat with others by using this credit card size Lora device and a smartphone with Bluetooth without Internet and Cellular network. For the hardware design, a high efficiency compact Lora PCB Antenna and an ultra-low noise figure amplifier had been designed for maximum the communication range. For the software design, a simple Lora half duplex communication protocol had been implemented by about 600 lines of C++ code. Current testing firmware implemented: - Lora half duplex communication protocol with timeout and re-transmitting features - Bluetooth Serial Port Profile (SPP) which provides communication capability between the phone and the Lora device. - Command Parser for executing user commands through Bluetooth. The coverage of this credit card size Lora device was tested in the urban area. In the experiment (TX:14dBm, Freq:915Mhz, Spreading Factor:12), 1500m communication distance had been tested, no timeout or re-transmitting occurred. According to the link budget, this system could reach far further than 1500m. [[https://www.youtube.com/watch?v=Rsd4tXtQQUE|Demo Video (YouTube)]] ---- ===== Hardware Design ===== {{ :loramessenger:loramessengerpcb.png?direct&400|}} |Schematics|{{ :loramessenger:lora_messenger_schematics.pdf |}}|Version: 25 May 2021| |Gerber Files|{{ :loramessenger:lora_messenger_gerber_files.zip |}}|Version: 25 May 2021| |Note| PCB substrate: FR4|Thickness: 1.6mm| ^ No. ^ Description ^ | 1 | USB Type C Socket | | 2 | Silicon Labs CP2102 USB to UART Bridge | | 3 | Semtech SX1276 Lora Transceiver | | 4 | Ultra-Low Noise Amplifier (LNA) | | 5 | RF Switch | | 6 | 915Mhz Lora PCB Antenna | | 7 | Active Buzzer | | 8 | Vibration Motor | | 9 | ESP32 WROOM | ==== Ultra-Low Noise Amplifier (LNA) Design ==== For the LNA which was designed based on SiGe NPN RF Transistor (Q2 in the {{ :loramessenger:lora_messenger_schematics.pdf |}}), it performs not only acting as a LNA but also as **Band pass filter**, **RF power limiter** and **impedance matching circuit**. According to the EM simulation of the SX1276 official demo board: * Optimized load impedance of RFI_HF: 21.181+j*52.294 * Optimized load impedance of PA_BOOST: 16.567+j5.122 Thus, the LNA needs to match the impedance from the RF Switch to RFI_HF for RX link optimization. {{ :loramessenger:lora_lna_performance.png?direct |}} Fig1. LNA Performance === Receiver Sensitivity improvement === The noise figure is reduced from 6dB for the SX1276 standalone to 1dB for the SX1276 and LNA combination, leading to a 5dB theoretical improvement in sensitivity (approximately -129dBm to -134dBm). According to the SX1276’s Transmission Power Consumption Specification, sensitivity improvement is meaningful for battery powered IOT devices, because sensitivity improvement has far more advantage for energy efficiency than rising the transmission power. {{ :loramessenger:lora_lna_sensitivity.png?direct&400 |}} {{ :loramessenger:lora_lna_power.png?direct |}} The LNA also acts as RF power limiter which limits the power feeding into RFI_HF will never exceed 3dBm. ==== 915Mhz Lora PCB Antenna Design ==== For the PCB antenna design, I designed it based on TI’s DN024, except I used the impedance matching method similar to the inverted F antenna. TI used LC matching network. The antenna gain is 2.0 dBi. S11 when the antenna in the Plastic Box: {{ :loramessenger:lora_pcb_antenna_s11.png?direct&400 |}} === Radiation Pattern == {{ :loramessenger:lora_pcb_antenna_3d.png?direct&400 |}} 3D {{ :loramessenger:lora_pcb_antenna_yz.png?direct&400 |}} YZ Plane {{ :loramessenger:lora_pcb_antenna_xz.png?direct&400 |}} XZ Plane {{ :loramessenger:lora_pcb_antenna_xy.png?direct&400 |}} XY Plane ---- ===== Software Design ===== |Evaluation Firmware|{{ :loramessenger:lora_esp32_evaluation_firmware.zip |}}|Version: 08 Jul 2021| |Android App | [[https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=en_US&gl=US|Serial Bluetooth Terminal]] |Retrieved Jul 11, 2021| ==== ESP32 PIN Assignments ==== ^ Description ^ PIN ^ | Buzzer | GPIO 16 | | Vibration | GPIO 17 | ^ LORA ^ ^ | RST | GPIO 26 | | DIO0 | GPIO 25 | | ant_switch | GPIO 33 | | HSPI_MISO | GPIO 12 | | HSPI_MOSI | GPIO 13 | | HSPI_SCLK | GPIO 14 | | HSPI_SS | GPIO 27 | ^ LED ^ ^ | R | GPIO 15 | | G | GPIO 2 | | B | GPIO 4 | ^ Switch ^ ^ | SW1 | GPIO36 Sensor_VP | ==== On Board LED Truth Table ==== ^ R ^ G ^ B ^ Description ^ | 1| 0|0|Transmitting mode| | 0| 1|0|Receiving mode| | 0| X|1|Bluetooth authentication mode| ==== Bluetooth Serial Port Profile (SPP) Commands ==== ^ Commands ^ Description ^ | ATS+ B | Notification Remote User by using Buzzer | | ATS+ V | Notification Remote User by using Vibrator | | ATS+ BV | Notification Remote User by using Buzzer+Vibrator | | ATS+ INF | Printout Lora Quality Information On/Off | | ATS+ NTFB | Local Notification by using Buzzer (1) | | ATS+ NTFV | Local Notification by using Vibrator (2) | | ATS+ NTBV | Local Notification by using Buzzer+Vibrator (3) | | ATS+ NTFM | Mute Local Notification (0) | | ATS+ NTFT | Test Local Notification | ==== Lora Half Duplex Communication Protocol Design ==== === Definition of Lora DATA PACKAGE === |Byte | Destination | e.g. 0xFF| |Byte | Local Address | e.g. 0xBB| |Byte| msgCount | Message ID, 0 to 254 | |Byte|msgType|enum msgType {msg=0, buzzer=1, vibration=2, buzzer_vibration=3, ack=5} ;| | |length|outgoing.length()| | |outgoing|Payload| ===Sending Process=== {{ :loramessenger:lora_sending_process.png?direct&600 |}} Note: Lora Sending Process will be invoked when receiving a Bluetooth message. For current configuration, the timeout message will be resent only 1 time due to the relative low data rate of Lora. === Receiving Process === {{ :loramessenger:lora_receiving_process.png?direct |}} Note: Lora Receiving Process will be called consecutively. ---- ===== Resource ===== |Schematics|{{ :loramessenger:lora_messenger_schematics.pdf |}}|Version: 25 May 2021| |Gerber Files|{{ :loramessenger:lora_messenger_gerber_files.zip |}}|Version: 25 May 2021| |Note| PCB substrate: FR4|Thickness: 1.6mm| |Evaluation Firmware|{{ :loramessenger:lora_esp32_evaluation_firmware.zip |}}|Version: 08 Jul 2021| |Android App | [[https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=en_US&gl=US|Serial Bluetooth Terminal]] |Retrieved Jul 11, 2021| ---- ===== Reference ===== [1] Richard Wallace. Design Note DN024: Monopole PCB Antenna with Single or Dual Band Option . Retrieved Jul 11, 2021, from https://www.ti.com/lit/an/swra227e/swra227e.pdf?ts=1625872783255