diff --git a/README.md b/README.md index cc62ca6..801835b 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,97 @@ I started this project out of curiosity for how a motion sensor is working and since I like to brew beer this was the result. This software can be used with iSpindle hardware and utilizes the same hardware configuration. No part of this software has been copied from that project. -This is still in early testing and has not the same range of external integrations as the standard software, so far only standard HTTP and Brewfather endpoints have been implemented. +## Functionallity -Gravity formulas are compatible with the standard software so switching is easy. +I have made a few differnt design decision compared to the standard iSpindle software. -Main differences towards in the design is: +* All configuration options have been moved to a web gui and is accesible without using the double reset function. You only need to use this for changing the WIFI configuration. The web gui can be accessed when either the device is laying flat on a surface (90 degress) or it's beeing charged. The benefits is that it's easier to change settings and also read the angle/tilt when doing calibration. You can also change the forumla and directly see the new calculated result. -* Web GUI for configuration that can be accessed when connected to network and the device is connected to power. -* Sleep mode can be disabled so angles/tilt can be easily viewed. -* Temperature sensor adjustment values. -* Temperature correcton of calculated gravity value. -* OTA support from local webserver when connected to power. +* The software also has built in OTA support so new versions can be downloaded from a local webserver (when connected to power) -More documentation will come when I have more time... \ No newline at end of file +* Temperature calibration of DS18B20 sensor so you can adjust the temperature sensor readings. + +* Automatic temperature gravity calculation to adjust for a lower temperature in the fermentation vessels. Useful if you are fermenting at lower temperatures. It's possible to build this into the normal gravity formula but this is an easier option. Just make sure that the calibration is done at 20°C. + +* The software will read the motion sensor 50 times and use the average to calculate the angle. If the readings show that the device is moving it will wait a few seconds and retry the operation again to make sure that no invalid angles should be reported. The downside is that the device will remain running if it's moving and draw more power. For normal fermentation this should not be an issue. + +## Integrations / Sending data + +In this version the software supports sending data to standad HTTP endpoint and Brewfather. These are the ones I use so more can be added on request. + +## Configuration + +Configuration is accessed by entering the URL for the device, this will be the mDNS name __device.local__ or the IP adress. + +### Index page + +http://gravmon.local/ + +The main page shows the device readings; gravity, angle, temperature and battery charge. If the checkbox is active then the device will never go into sleep mode. This is useful if you are collecting angle/tilt for calibration. If this is unchecked the device will go into sleep mode and the web UI is no longer accesible. + +![Status](img/index.png) + +### Device page + +http://gravmon.local/device.htm + +The device page shows the device settings and software versions. + +![Device](img/device.png) + +### Config page + +http://gravmon.local/config.htm + +This page is divided into several categories of settings. The first one contains device settings, mDNS name, temperature format, and gyro calibration data. Calibration needs to be done or the device will not work correctly. Place the device flat on a surface with gyro up and press the calibrate button when it's stable. + +![Config - Device](img/config1.png) + +The second section contains the push settings, two URL's for http sending and one for Brewfather. The interval setting is the amount of time the device will be in sleep mode between readings (interval is in seconds). + +This is the format used for standard http posts. +``` +{ + "name" : "gravmon", // mDNS name + "ID": "gravmon", // mDNS name + "token" : "gravmon", + "interval": 900, + "temperature": 20.5, + "temp-units": "C", + "gravity": 1.0050, + "angle": 45.34, + "battery": 3.67, + "rssi": -12, + "run-time": 2.30, // Runtime for this reading +} +``` + +![Config - Push](img/config2.png) + +The third section contains the gravity options, formlua and option for temperature correcting gravity. + +* Gravity formula is compatible with standard iSpindle formulas so any existing calculation option can be used. I use the tool fermentrack for controlling my fermentation and I use this tool for calculating gravity. + +![Config - Gravity](img/config3.png) + +The fouth section contains the hardware options, voltage factor for calculating the battery charge, temperature sensor adjustment and OTA base URL. + +* For the OTA to work, place the following files (version.json + firmware.bin) at the location that you pointed out in OTA URL. If the version number in the json file is newer than in the code the update will be done during startup. + +Example; OTA URL (don't forget trailing dash), the name of the file should be firmware.bin +``` +http://192.168.1.1/firmware/gravmon/ +``` + +Contents version.json +``` +{ "project":"gravmon", "version":"0.3.0" } +``` + +![Config - Hardware](img/config4.png) + +# Compiling the software + +I recommend that VSCODE with PlatformIO and Minfy extensions are used. Minify is used to reduce the size of the HTML files which are embedded into the firmware or uploaded to the file system. When using minify on a file, for example index.htm the output will be called index.min.htm. This is the file that will be used when buildning the image. + +By default the html files are embedded but there are options to upload them to the file system to reduce the size of the image if the size becomes to large for OTA. diff --git a/bin/firmware-debug.bin b/bin/firmware-debug.bin index aa1f079..7708b4d 100644 Binary files a/bin/firmware-debug.bin and b/bin/firmware-debug.bin differ diff --git a/bin/firmware.bin b/bin/firmware.bin index 4e7bd2b..c8ca323 100644 Binary files a/bin/firmware.bin and b/bin/firmware.bin differ diff --git a/img/config1.png b/img/config1.png new file mode 100644 index 0000000..28988f4 Binary files /dev/null and b/img/config1.png differ diff --git a/img/config2.png b/img/config2.png new file mode 100644 index 0000000..9d13b2e Binary files /dev/null and b/img/config2.png differ diff --git a/img/config3.png b/img/config3.png new file mode 100644 index 0000000..4905580 Binary files /dev/null and b/img/config3.png differ diff --git a/img/config4.png b/img/config4.png new file mode 100644 index 0000000..12a15ea Binary files /dev/null and b/img/config4.png differ diff --git a/img/device.png b/img/device.png new file mode 100644 index 0000000..154cc56 Binary files /dev/null and b/img/device.png differ diff --git a/img/index.png b/img/index.png new file mode 100644 index 0000000..ddc079d Binary files /dev/null and b/img/index.png differ diff --git a/platformio.ini b/platformio.ini index f1f6d71..220e97f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -22,10 +22,9 @@ build_unflags = build_flags = #-O0 -Wl,-Map,output.map -D BAUD=${common_env_data.monitor_speed} -D ACTIVATE_OTA - -D ACTIVATE_PUSH #-D SKIP_SLEEPMODE -D USE_LITTLEFS=true - #-D EMBED_HTML + -D EMBED_HTML -D CFG_APPVER="\"0.3.1\"" lib_deps = # https://github.com/jrowberg/i2cdevlib.git # Using local copy of this library diff --git a/src/helper.cpp b/src/helper.cpp index 2f29ffd..caa7bf3 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -43,9 +43,6 @@ void deepSleep(int t) { // void printBuildOptions() { Log.notice( F("Build options: %s LOGLEVEL %d " -#ifdef ACTIVATE_PUSH - "PUSH " -#endif #ifdef SKIP_SLEEPMODE "SKIP_SLEEP " #endif diff --git a/src/pushtarget.cpp b/src/pushtarget.cpp index ec9c930..572742f 100644 --- a/src/pushtarget.cpp +++ b/src/pushtarget.cpp @@ -24,8 +24,6 @@ SOFTWARE. #include "pushtarget.h" #include "config.h" -#if defined( ACTIVATE_PUSH ) - PushTarget myPushTarget; // @@ -171,6 +169,4 @@ void PushTarget::sendHttp( String serverPath, float angle, float gravity, float http.end(); } -#endif // ACTIVATE_PUSH - // EOF \ No newline at end of file diff --git a/src/pushtarget.h b/src/pushtarget.h index a0cbb97..2a897d2 100644 --- a/src/pushtarget.h +++ b/src/pushtarget.h @@ -38,7 +38,7 @@ class PushTarget { unsigned long ms; // Used to check that we do not post to often void sendBrewfather(float angle, float gravity, float temp ); - void sendHttp(String serverPath, float angle, float gravity, float temp, float runTime ); + void sendHttp(String serverPath, float angle, float gravity, float temp, float runTime); public: PushTarget() { ms = millis(); }