diff --git a/README.md b/README.md index bf11575..a2e0864 100644 --- a/README.md +++ b/README.md @@ -70,14 +70,16 @@ The module can be used: ## How to use -1. Manufacture PCB. Here you find the [Gerber](pcb) files -1. Assemble PCB. Here you find the [Bill of Materials](https://foorschtbar.github.io/LoRaProMini/pcb/bom/ibom.html) (BOM) - - **Attention:** The current version (v3.0) of the PCB has no ISP header! A pre-burned MEGA328P must be installed. I got one from an Arduino Pro Mini Board, because a completely assembled Arduino is cheaper than a single chip. +1. Manufacture the PCB. Here you find the [Gerber](pcb) files +1. Assemble the PCB. Here you find the [Bill of Materials](https://foorschtbar.github.io/LoRaProMini/pcb/bom/ibom.html) (BOM) + - **Attention:** The current version (v3.1) of the PCB has no ISP header! A pre-burned Atmega328P must be installed. I got one from an Arduino Pro Mini Board (3.3V 8 Mhz), because a completely assembled Arduino is cheaper than a single chip 1. Flash config firmware (See [How to flash](#how-to-flash)) 1. Start voltage calibration from menu -1. Set a voltage, measure the voltage with a multimeter and note the analog value. The range is optimized up to 6V -1. Use volts-per-bit calculator to get VBP factor for config -1. Create configuration with [Configuration Builder](https://foorschtbar.github.io/LoRaProMini/configbuilder) +1. Start configuration builder [Configuration Builder](https://foorschtbar.github.io/LoRaProMini/configbuilder) +1. Measure the voltage with a multimeter. +1. Insert multimeter voltage and the analog value in the Volts-per-bit (VPB) calculator to get VPB factor. +1. If u have a adjustable power supply, try different voltages to find best factor. Warning: The maximum voltage is 6 Volt +1. Fill out the other fields like activation methode, session keys and EUIs 1. Write configuration to EEPROM using configuration menu 1. Check written configuration via configuration menu 1. Flash debug or release firmware (See [How to flash](#how-to-flash)) @@ -97,10 +99,14 @@ avrdude -F -v -c arduino -p atmega328p -P COM4 -b 57600 -D -U flash:w:firmware_1 ## Firmware Changelog +### Version 2.3 + +- Fixed Typo + ### Version 2.2 - An additional send delay between 0 and 20s has been added to avoid overlaps between different nodes with exactly the same send interval -- Some Flash memory optimizations +- Some flash memory optimizations ### Version 2.1 @@ -210,6 +216,7 @@ function decodeUplink(input) { ## ToDo - [ ] Go to sleep immediately when voltage is too low +- [ ] Multi point calibration for battery voltage - [x] Add wake up trough interrupt pins - [x] Move Major- and Minorversion byte to single byte. 4 bits for major and 4 bits for minor. - [x] Add option for Confirmed Uplink to config diff --git a/configbuilder/index.html b/configbuilder/index.html index fbc6a47..6b3b66f 100644 --- a/configbuilder/index.html +++ b/configbuilder/index.html @@ -42,9 +42,9 @@
- - -
@@ -213,7 +213,7 @@ // NAME DATATYPE DATALEN FLIPP GROUP "CONFIG_IS_VALID": ["int", "1", true, 0], "SLEEPTIME": ["int", "2", true, 0], - "BAT_SENSE_VBP": ["float", "4", true, 0], + "BAT_SENSE_VPB": ["float", "4", true, 0], "BAT_MIN_VOLTAGE": ["float", "4", true, 0], "WAKEUP_BY_INTERRUPT_PINS": ["int", "1", true, 0], "CONFIRMED_DATA_UP": ["int", "1", true, 0], diff --git a/configbuilder/script.js b/configbuilder/script.js index 974e9db..3b79e5a 100644 --- a/configbuilder/script.js +++ b/configbuilder/script.js @@ -21,24 +21,24 @@ $("form").on('click', 'button:not(:disabled)', function (e) { } catch (err) {} } else if ($(this).hasClass("calc")) { $("#calc").toggle(); - calcVBP(); + calcVPB(); } else if ($(this).hasClass("add")) { let masterrow = $("#calc > div:first"); masterrow.clone().appendTo("#calc").find("input[type='text']").val(""); - calcVBP(); - checkVBPInputs(); + calcVPB(); + checkVPBInputs(); } else if ($(this).hasClass("remove")) { $(this).parent().remove(); - calcVBP(); - checkVBPInputs(); + calcVPB(); + checkVPBInputs(); } }); $("form").on('keyup change', '#calc input', function (e) { - calcVBP(e); + calcVPB(e); }); $(":not(#calc) input, select").on('keyup change', function (e) { @@ -51,20 +51,20 @@ $("#configStr").on('keyup blur change', function (e) { $(document).ready(function (e) { makeConfig(e); - checkVBPInputs(); + checkVPBInputs(); }); -function checkVBPInputs() { +function checkVPBInputs() { $("#calc>div>button.add").prop("disabled", false).removeClass("btn-outline-secondary").addClass("btn-outline-success"); $("#calc>div>button.remove").prop("disabled", false).removeClass("btn-outline-secondary").addClass("btn-outline-danger"); $("#calc>div:not(:last-child)>button.add").prop("disabled", true).removeClass("btn-outline-success").addClass("btn-outline-secondary"); $("#calc>div:only-child>button.remove").prop("disabled", true).removeClass("btn-outline-danger").addClass("btn-outline-secondary"); } -function calcVBP(event) { +function calcVPB(event) { let fields = $("#calc input"); - let vbp = 0; + let vpb = 0; let count = 0; for (i = 0; i < fields.length; i += 2) { let error = false; @@ -100,17 +100,17 @@ function calcVBP(event) { // } if (!error) { - vbp += (voltage / analog); + vpb += (voltage / analog); count++; } } if (count > 0) { - vbp /= count; + vpb /= count; } - $("#BAT_SENSE_VBP").val(vbp).change(); + $("#BAT_SENSE_VPB").val(VPB).change(); } diff --git a/platformio.ini b/platformio.ini index f103e7c..7009691 100644 --- a/platformio.ini +++ b/platformio.ini @@ -32,7 +32,7 @@ build_flags = -D USE_IDEETRON_AES -D MIC_ENABLE_arbitrary_clock_error -D VERSION_MAJOR=2 - -D VERSION_MINOR=2 + -D VERSION_MINOR=3 [env:config] build_flags = diff --git a/src/main.cpp b/src/main.cpp index 1a28967..5fe5c8e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -124,7 +124,7 @@ typedef struct { uint8_t CONFIG_IS_VALID; // 1 byte uint16_t SLEEPTIME; // 2 byte - (Deep) Sleep time between data acquisition and transmission - float BAT_SENSE_VBP; // 4 byte - Volts per Bit. See documentation + float BAT_SENSE_VPB; // 4 byte - Volts per Bit. See documentation float BAT_MIN_VOLTAGE; // 4 byte - Minimum voltage for operation, otherwise the node continues to sleep uint8_t WAKEUP_BY_INTERRUPT_PINS; // 1 byte - 0 = Disabled, 1 = Enabled uint8_t CONFIRMED_DATA_UP; // 1 byte - 0 = Unconfirmed Data Up, 1 = Confirmed Data Up @@ -204,7 +204,7 @@ float readBat() value = value / numReadings; - float batteryV = value * cfg.BAT_SENSE_VBP; + float batteryV = value * cfg.BAT_SENSE_VPB; if (CONFIG_MODE_ENABLED) { Serial.print(F("Analoge voltage: ")); @@ -217,8 +217,8 @@ float readBat() Serial.print(batteryV, 1); Serial.print(F(" V (")); Serial.print(batteryV, 2); - Serial.print(F(" V, VBP=")); - Serial.print(cfg.BAT_SENSE_VBP, 10); + Serial.print(F(" V, VPB=")); + Serial.print(cfg.BAT_SENSE_VPB, 10); Serial.println(F(")")); } @@ -333,8 +333,8 @@ void showConfig(bool raw = false) } Serial.print(F("> SLEEPTIME: ")); Serial.println(cfg.SLEEPTIME, DEC); - Serial.print(F("> BAT_SENSE_VBP: ")); - Serial.println(cfg.BAT_SENSE_VBP, DEC); + Serial.print(F("> BAT_SENSE_VPB: ")); + Serial.println(cfg.BAT_SENSE_VPB, DEC); Serial.print(F("> BAT_MIN_VOLTAGE: ")); Serial.println(cfg.BAT_MIN_VOLTAGE, DEC); Serial.print(F("> WAKEUP_BY_INTERRUPT_PINS: "));