Updated docs

This commit is contained in:
Magnus Persson 2022-01-11 17:20:38 +01:00
parent 01fe6bbf19
commit 534a739891
12 changed files with 94 additions and 44 deletions

View File

@ -55,31 +55,40 @@
</button>
</div>
<div class="alert alert-warning fade hide show d-none" role="alert" id="warning">
<div id="warning-msg">...</div>
<div class="alert alert-warning fade hide show d-none" role="alert" id="warning-sleep">
<div>A sleep-interval of less than 300s will reduce battery life, consider using 900s</div>
</div>
<div class="alert alert-warning fade hide show d-none" role="alert" id="warning-gyro">
<div>When using the gyro temperature use a sleep-interval that is greater than 300s for accurate readings</div>
</div>
<script type="text/javascript">
function showError( msg ) {
$('#alert').removeClass('alert-success').addClass('alert-danger').removeClass('d-none').addClass('show')
$('#alert').removeClass('alert-success').addClass('alert-danger').removeClass('d-none').addClass('show');
$('#alert-msg').text( msg );
}
function showSuccess( msg ) {
$('#alert').addClass('alert-success').removeClass('alert-danger').removeClass('d-none').addClass('show')
$('#alert').addClass('alert-success').removeClass('alert-danger').removeClass('d-none').addClass('show');
$('#alert-msg').text( msg );
}
$("#alert-btn").click(function(e){
$('#alert').addClass('d-none').removeClass('show')
$('#alert').addClass('d-none').removeClass('show');
});
function showWarning( msg ) {
$('#warning').removeClass('d-none').addClass('show')
$('#warning-msg').text( msg );
function showWarningSleep() {
$('#warning-sleep').removeClass('d-none').addClass('show');
}
function hideWarning() {
$('#warning').addClass('d-none').removeClass('show')
function hideWarningSleep() {
$('#warning-sleep').addClass('d-none').removeClass('show');
}
function showWarningGyro() {
$('#warning-gyro').removeClass('d-none').addClass('show');
}
function hideWarningGyro() {
$('#warning-gyro').addClass('d-none').removeClass('show');
}
</script>
@ -340,14 +349,19 @@
var i = $("#sleep-interval").val()
$("#sleep-interval-info").text( Math.floor(i/60) + " m " + (i%60) + " s" )
if(i>0 && i<300)
showWarning("A sleep-interval of <300s will reduce battery life, consider using 900s");
else
hideWarning();
hideWarningGyro();
if(i>0 && i<300) {
if( $("#gyro-temp").is(":checked") )
showWarningGyro();
showWarningSleep();
} else {
hideWarningSleep();
}
}
// Trigger the calibration
// Trigger the calibration and show warnings if needed
$("#sleep-interval").keyup(updateSleepInfo);
$("#gyro-temp").change(updateSleepInfo);
function setButtonDisabled( b ) {
$("#device-btn").prop("disabled", b);

File diff suppressed because one or more lines are too long

View File

@ -12,4 +12,3 @@ Code
- Support for MQTT
- Support for plato
- Use pre-commit for validating check-in
- Automatic builds via github actions

View File

@ -171,7 +171,9 @@ Hardware Settings
* **Gyro Temperature:**
Enable this feature will use the temp sensor i the gyro instead of the DS18B20, the benefit is shorter run time and
longer battery life (this is an experimental feature).
longer battery life (this is an experimental feature). The value used is the first temperature reading from when the
device is activated, since the gyro should be cool this is reflecting the surronding temperature. After it has
been running the value would be totally off.
* **OTA URL:**
@ -365,6 +367,10 @@ Used to update gravity settings via an HTTP POST command. Payload is in JSON for
* ``gravity-formula`` keywords ``temp`` and ``tilt`` are supported.
.. note::
``gravity-temp-adjustment`` is defined as "on" or "off" when posting since this is the output values
from a checkbox, when reading data it's sent as boolean (true,false).
.. code-block:: json
{
@ -379,6 +385,10 @@ POST: /api/config/hardware
Used to update hardware settings via an HTTP POST command. Payload is in JSON format.
.. note::
``gyro-temp`` is defined as "on" or "off" when posting since this is the output values from a checkbox, when
reading data it's sent as boolean (true,false).
.. code-block:: json
{
@ -448,10 +458,10 @@ present or the API call will fail.
url = "http://" + host + "/api/config/push"
json = { "id": id,
"http-push": "http://192.168.1.1/ispindel", # HTTP endpoint
"http-push2": "", # HTTP endpoint2
"brewfather-push": "", # Brewfather URL
"influxdb2-push": "", # InfluxDB2 settings
"http-push": "http://192.168.1.1/ispindel",
"http-push2": "",
"brewfather-push": "",
"influxdb2-push": "",
"influxdb2-org": "",
"influxdb2-bucket": "",
"influxdb2-auth": ""
@ -460,17 +470,17 @@ present or the API call will fail.
url = "http://" + host + "/api/config/gravity"
json = { "id": id,
"gravity-formula": "", # If you want to set the gravity formula
"gravity-temp-adjustment": "off" # on or off
"gravity-formula": "",
"gravity-temp-adjustment": "off" # Adjust gravity (on/off)
}
set_config( url, json )
url = "http://" + host + "/api/config/hardware"
json = { "id": id,
"voltage-factor": 1.59, # Default value for voltage calculation
"temp-adjustment": 0, # If temp sensor needs to be corrected
"gyro-temp": true, # Use the temp sensor in the gyro instead
"ota-url": "" # if the device should seach for a new update when active
"voltage-factor": 1.59, # Default value for voltage calculation
"temp-adjustment": 0, # If temp sensor needs to be corrected
"gyro-temp": "on", # Use the temp sensor in the gyro instead (on/off)
"ota-url": "" # if the device should seach for a new update when active
}
set_config( url, json )

View File

@ -48,7 +48,29 @@ The main differences
* **Gyro Movement**
The software will detect if the gyro is moving and if this is the case it will go back to sleep for 60seconds. This way we should avoid faulty measurements.
The software will detect if the gyro is moving and if this is the case it will go back to sleep for 60seconds.
This way we should avoid faulty measurements.
* **WIFI connection issues**
The software will not wait indefiently for a wifi connection. If it takes longer than 20 seconds to connect then
the device will go into deep sleep for 60 seoncds and then retry.
* **Use gyro temperature sensor**
This works fine when the device has time to cool down between measurements and it saves up to 400 ms.
My testing shows that this is quite accurate with a deviation of less than 0.3C. This
reduces the run time by 20% (with optimal wifi connection).
The graph below compares from the temp from two different devices in the same bucket of water. One with
gyro temp enabled and one with the DS18B20 sensor. The blue line is the gyro temperature and this clear
that the temperature will be higher after it has been running but cools down when in sleep mode. The interval
has been set to 300s. A low delay of 30s will not allow the gyro to cool down and the temperature will
be 0.5-1.0C higher.
.. image:: images/temp1.png
:width: 800
:alt: Gyro temp vs DS18B20
Other features
--------------
@ -62,26 +84,21 @@ Other features
Experimental features
---------------------
.. tip::
These are not enabled by default. To enable them you need to recompile the code and enable the correct defines.
* Use the temperature sensor in the gyro instead of DS18B20
This works fine when the device has time to cool down between measurements and it saves a few milliseconds (reduced battery consumption). My testing shows that this is quite accurate.
There is lots of battery power to save, reading the temp sensor takes almost as long as the gyro. This could reduce the run time by 40-50% and probly extend battery life with the same.
However more testing is required. Might add this as an option in the UI.
* Performance measurements
* **Performance measurements**
I've also create a small library to measure execution code in some areas of the code that i know is time consuming. This way I can find a good balance between performace and quality.
See the :ref:`compiling-the-software` for more information.
* **Power measurements**
I've also create a project to measure the power consumption of the device, but more on this later.
Battery life
------------
I'm currently measuring battery life of v0.5 but previous versions have been able to measure gravity for a 2-3 weeks without issues. Using 900 seconds as interval.
I'm currently measuring battery life of v0.5 but previous versions have been able to measure gravity for a 2-3 weeks without issues (Using 900 seconds as interval).
*More on this topics once my tests are done*
@ -95,7 +112,7 @@ The typical runtime in a measurement cycle is approx 2 seconds and in some cases
essential for long batterylife. Out of the 2 seconds of run-time the major time is spent on gyro readings (1.3s) and temperature measurements of (0.6s) so using the gyro sensor for measureing
temperature would reduce the total runtime with 25%. Sending data over http takes less than 100ms (on my local network) so this is not drawing much power.
The image below shows how the run-time varies over time. The pink line is the wifi connection time and this is why the time varies.
The image below shows how the run-time varies over time. The pink line is the wifi connection time and this is why the time varies. The orange is the total runtime for the awake period.
.. image:: images/perf1.png
:width: 800

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -7,7 +7,7 @@ Welcome to GravityMon's documentation!
######################################
.. note::
This documentation reflects **v0.5**. Last updated 2022-01-09
This documentation reflects **v0.6**. Last updated 2022-01-11
GravityMon is a replacement firmare for the iSpindle firmware, it uses the same hardware configuration so
@ -112,6 +112,7 @@ the following libraries and without these this would have been much more difficu
configuration
compiling
contributing
q_and_a
backlog
Indices and tables

View File

@ -0,0 +1,8 @@
Q & A
#####
My device is no going in to sleep after fully charged
-----------------------------------------------------
- Calibrate the device in the web interface
- Check the angle/tilt. If the device is reporting 90 degress then its not going into sleep. Tilt the device and check if sleep works.
- Check in reported voltage of the battery in the web interface. If this is higher than 4.15V the device belives its beeing charged. In that case adjust the voltage factor under hardware so the voltage drops below 4.15V.

View File

@ -14,7 +14,8 @@ This is features for the next release.
* Tested runtime performance
* Improved documentation
* Added warning on config page when sleep is <300
* Enabled selection of gyro temperature sensor under Hardware settings.
* Enabled selection of gyro temperature sensor under Hardware settings
* Added warning when short sleep interval and gyro temp is enabled
v0.5.0
------

View File

@ -16,7 +16,7 @@
"gravity-format": "G",
"temp-adjustment-value": 0,
"gravity-temp-adjustment": false,
"gyro-temp": true,
"gyro-temp": false,
"gyro-calibration-data": {
"ax": -330,
"ay": -2249,