brianhackel / the-floater Goto Github PK
View Code? Open in Web Editor NEWA tilt floating hydrometer built on Adafruit Feather Huzzah ESP8266 and MPU-6050
License: GNU General Public License v3.0
A tilt floating hydrometer built on Adafruit Feather Huzzah ESP8266 and MPU-6050
License: GNU General Public License v3.0
upon a soft reset, pre-fill-in the existing logging details on the configuration webpage. This way, you don't have to keep looking up the web hooks or API key just because you wanted to change the logging timeout.
add a button to the configuration screen which will allow an indefinite sleep. that way it will charge the battery, but not be "on" until you hit the reset button.
i think we have to do this because how else do you get it back to active portal mode FROM config mode??
consider making allowed consecutive failures as a configuration param rather than hardcoding it
curl -X POST -H "Content-Type: application/json" -d '{"temp":"51","tilt":"11.2"}' https://maker.ifttt.com/trigger/append_beer/json/with/key/cnyJ7UpiB9U1QAAfP7mQo5
to the configuration webpage
probably should come from a tag, or at least be duplicated by a tag
if we fail to log or connect or whatever when NOT in config mode, add one to the persistent counter (a LittleFS file) and only reset to factory if we're over the allowed consecutive errors mark.
consider making this a configurable on the webpage which can also add a way to message that we're going offline for good (IFTTT web hook trigger).
maybe try disabling the double reset and see if we can just use a single reset BUTTON detection.
not sure how easy/hard this would be, but we don't want to drain the battery by sitting in Config mode. we probably want to go to sleep (indefinitely) in the case where we've been in Config mode for, say, 5 minutes.
put everything in the setup() and do a deep sleep for perhaps 30 minutes
consider adding a configurable sleep time via the captive portal configuration described in issue #1
curl -X POST -H "Content-Type: application/json" -d '{"temp":"77","tilt":"44","battery":"88","sheetName":"Log","spreadsheetId":"1Vm_yyzYJGHxuL6VfqA0Vs1Op3U4c2ru-9uVMdvuiXVs"}' https://script.google.com/macros/s/AKfycbwaDRFxaTrB77QBs42C7wUi7NCoxxAsYd1n5g4Cpo6R-oWpYTpNfPOOwiyXs9RCNHgp/exec
then the fields you need in the configuration is the Deployment ID, spreadsheet ID, and sheet name
convert the angle, temperature and battery readings from simple JSON to GUI widgets.
add a tare button to the configuration mode screen that allows you to, when having placed the floater on its head, zero out the accelerometer values. This will allow for perfect zero readings taking into account how it is placed inside the canister.
https://api.highcharts.com/highcharts/yAxis.pane
https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/gauge-vu-meter/
should be able to put all three easily side-by-side as 3 different 'panes'
IFTTT.ccp and BrewersFriend.cpp to reduce duplicated code.
also consider adding wakeup timeout to the configuration feed group and reading both
probably should move them to a new dashboard that is just for configuration so they don't get bumped accidentally
probably with a button on wifimanager.html which will query the board, do the scan and return with the list which will then be populated in the form via jquery.
you have the blue and red, use them to try to indicate board state
make everything more Object Oriented to smooth maintenance and usage
Battery tracking
We will also keep track of the battery level by creating a high-resistor-divider on VBat to reduce the voltage of the battery from 220KΩ/1220KΩ = 1/5.5 times. This means a max voltage of the battery (4.2V) is 0.75V, well within the range of the ESP8266's 1.0V-max ADC
Note that even with low-power sleeping, this setup draws about 20mA on average!
void battery_level() {
// read the battery level from the ESP8266 analog in pin.
// analog read level is 10 bit 0-1023 (0V-1V).
// our 1M & 220K voltage divider takes the max
// lipo value of 4.2V and drops it to 0.758V max.
// this means our min analog read value should be 580 (3.14V)
// and the max analog read value should be 774 (4.2V).
int level = analogRead(A0);
// convert battery level to percent
level = map(level, 580, 774, 0, 100);
Serial.print("Battery level: "); Serial.print(level); Serial.println("%");
connect_AIO();
// grab the battery feed
AdafruitIO_Feed *battery = io.feed("battery");
// send battery level to AIO
battery->save(level);
io.run();
}
add a button to the captive portal (that will show no matter what for the first 5 minutes) that will put it into non-low-power mode and allow a web interface to poll for tilt and temperature measurements at some interval
curl -X POST -H "Content-Type: application/json" -d '{"name":"hydrometer","temp":22.2,"temp_unit":"C","gravity":xx,"gravity_unit":"P"}' https://log.brewersfriend.com/stream/ec45bdaab75795f0c1a8a0af2970aad70a46abc9
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.