====Laura long range radio ==== Laura utilises [[:interfaces:semtech|LoRa]] radios with at least one transmitter on an ATMega or STM32 acting as a sensor and another as a receiver on a Raspberry Pi running as a processor of the sensor readings. The software has been written to support the 868 MHz EU band only. This project was designed to monitor the humidity of a remote location and as such has been written to support (initially) one of three humidity sensors boards, namely the DHT11, [[:interfaces:aht10|AHT10]] and SHT3X. The tranmistter can be a standard Arduino or [[:boards:rkat28sb|compatible]] else a low power board run from 3 AA cells or equivalent such a [[:boards:moteino|Moteino]] or clone. A version targeting the STM32 based [[:boards:bl072z|B-L072Z-WRLAN1]] board also exists either powered using libopencm3 or STM32 LL. The Raspberry Pi has can be any model with a 40 pin header if the recommeneded LoRa board is used. ===ATMega=== {{:projects:laura-arduino.jpg?200}} \\ \\ {{:boards:cloneisp.jpg?200}} The ATMega was chosen for simplicity of development and easy availability. The client transmitter code is written in C and doesn't use the Arduino IDE or libraries. It should be easily ported to other processors. ==Arduino== For a fixed power installation an Arduino or any clone with a [[:interfaces:semtech|Dragino LoRa Shield]] or various alternatives for the 868MHz EU frequency band. ==Moteino== For the low power prototype a clone of the [[:boards:moteino|Moteino]] is used with a [[:interfaces:semtech|RFM95W]] radio module. The ATmega fuse bits have been altered as below to allow the transmitter to operate at a lower voltage than the standard BOR or approx. 2V9. Both the MCU and radio may operate down to about 2V5 or even lower. __Fuses__ CLOCK = 8 MHz INTERNAL RC, SPI ENABLED, EESAVE, BOR DISABLED, NO BOOT-LOADER avrdude: safemode: Fuses OK (E:FF, H:D7, L:E2) Three LIDL NiMH AA batteries in series were used to power a test board with the following outcome. All three batteries had seen a number of years of use previously and were fully charged. The first message received was on Thursday, 21 October 2021, 14:51:10. Oct 21 14:50:20 Rx Oct 21 14:51:10 0xFF 0xFF 0x04 0x00 0x37 0x35 0x2E 0x31 0x25 0x32 0x30 0x2E 0x35 0x43 Oct 21 14:51:10 75.1%20.5C Oct 21 14:51:10 RSSI = -47 Oct 21 14:51:10 RxDone The final message received was on Wednesday, 30 March 2022, 08:43:50. Mar 20 08:43:47 Rx Mar 20 08:43:50 0xFF 0xFF 0x00 0x00 0x36 0x35 0x2E 0x38 0x25 0x31 0x36 0x2E 0x34 0x43 Mar 20 08:43:50 65.8%16.4C Mar 20 08:43:50 RSSI = -60 Mar 20 08:43:50 RxDone The duration was 159 days, 17 hours, 52 minutes and 40 seconds, 13,801,960 seconds 230,032 minutes (rounded down) 3833 hours (rounded down) 159 days (rounded down) 22 weeks (rounded down) 43.77% of a common year (365 days) ===STM32=== This documentation is work-in-progress, but fully operational code can be found below. ==libopencm3 (obsolete)== http://hg.kewl.org/pub/LoRa_stm32/ ==STM32 LL== http://hg.kewl.org/pub/LoRa_stm/ ===Raspberry Pi=== {{:tools:gpsd.jpg?200}} For development both an RPi3 and RPi3 has been tested but any with a 40 pin header will work with a [[:interfaces:semtech|Dragino LoRa/GPS HAT]]. Whilst this project only utilises the radio, the GPS can be configured as an accurate time source using this [[:tools:time|guide]]. ===Software=== Software is comprised of two components written in C, the ATMega client transmitter and RPi Linux server which receives messages and may post or publish them elsewhere. ==Client== The client transmitter supports three platforms and one of three sensors or no sensor at all. The platforms are the Arduino UNO, MEGA2560 and Moteino all with the ATMega328 MCU. Along with any sensor reading transmitted (humidity and temperature) the client will also send the current Vcc voltage level of the processor. Fetch the code for AVR hg clone http://hg.kewl.org/pub/LoRa_avr Build for the target and sensor __Arduino UNO with DHT11__ The DHT11 is not an accurate device but is able to measure changes at least. make -f Makefile.uno SENSOR=DHT11 __Arduino UNO without a sensor__ Not using a sensor results in only the MCU Vcc being sent. This can be used for range tests when roaming. make -f Makefile.uno SENSOR=NONE __Arduino MEGA2560 with SHT30__ A more accurate device that has not been test extensively. make -f mega2560.mk SENSOR=SHT3X __Moteino or generic with AHT10__ This device may not share an I2C bus but that is not an issue here. Under test it has been very reliable. make -f moteino.mk SENSOR=AHT10 Program device make -f Makefile.uno SENSOR=AHT10 program ==Server== {{:projects:lora_test.jpg?200}} __Receive__ The RPi receiver server for Linux listens for messages which are logged and posted to a remote web server for inspection. Later messages will be published to Moquitto MQTT once this component has been written. The web service code is also included and the purpose here is to allow roaming with a transmitter to evaluate signal range. An Arduino UNO with a power bank may last a few hours but will also require a dummy load for most power banks to stay operational. Fetch the code hg clone http://hg.kewl.org/pub/LoRa_test Install it make install-all The service has been written to operate with [[http://smarden.org/runit/|runit]]. __Post__ The htdocs directory contains a PHP MVC application for posted messages. Example configuration if for NGINX (found in the routes subdirectory). ===Schematic=== Work in progress AVR schematic. {{:projects:schematic_laura_wip.png?400}} ===TODO=== ==Software== __Client__ TWI/I2C error recovery.