Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e333ee9
Showing
12 changed files
with
729 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
.pio | ||
.venv* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"type": "library", | ||
"name": "EnviroDIY_HX711", | ||
"version": "0.1.0", | ||
"spec": { | ||
"owner": "hiveeyes", | ||
"id": -999, | ||
"name": "EnviroDIY_HX711", | ||
"requirements": null, | ||
"url": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Hiveeyes Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Build all Pipa examples | ||
|
||
# Get the full path and directory of Makefile | ||
# https://www.systutorials.com/how-to-get-the-full-path-and-directory-of-a-makefile-itself/ | ||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
mkfile_dir := $(dir $(mkfile_path)) | ||
|
||
# Configure tool shortcuts | ||
$(eval venvpath := $(mkfile_dir)/.venv) | ||
$(eval python := $(venvpath)/bin/python) | ||
$(eval pip := $(venvpath)/bin/pip) | ||
$(eval pio := $(venvpath)/bin/pio) | ||
|
||
|
||
build: setup-virtualenv | ||
cd examples/basic; $(pio) run # --verbose | ||
|
||
upload: setup-virtualenv | ||
$(pio) run --target upload --upload-port=${MCU_PORT} | ||
|
||
setup-virtualenv: | ||
@test -e $(python) || `command -v virtualenv` --python=python3 $(venvpath) | ||
$(pip) install platformio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# EnviroDIY_HX711 | ||
|
||
### About | ||
|
||
This is an EnviroDIY sensor adapter for the canonical HX711 Arduino library | ||
[HX711] by Bogdan Necula, a software interface to the Avia Semiconductor HX711 | ||
24-Bit Analog-to-Digital Converter (ADC) for weight scales. | ||
|
||
It is being conceived for the [PíPá Datalogger] of the [Hiveeyes project], | ||
which is developing a flexible beehive monitoring infrastructure toolkit. | ||
|
||
### Features | ||
|
||
This library is still in its infancy and contributions are very welcome. | ||
Within the implementation `AviaSamiHX711.cpp`, there are some gaps which need | ||
to be fixed. | ||
|
||
|
||
### License | ||
|
||
Released under the MIT License, http://opensource.org/licenses/mit-license.php. | ||
|
||
|
||
[HX711]: https://github.com/bogde/HX711 | ||
[Hiveeyes project]: https://hiveeyes.org/ | ||
[PíPá Datalogger]: https://github.com/hiveeyes/arduino/tree/master/node-pipa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This example sends the current weight scale reading in kilogram to the serial | ||
port every second. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
; PlatformIO Project Configuration File | ||
; | ||
; Build options: build flags, source filter | ||
; Upload options: custom upload port, speed and extra flags | ||
; Library options: dependencies, extra library storages | ||
; Advanced options: extra scripting | ||
; | ||
; Please visit documentation for the other options and examples | ||
; https://docs.platformio.org/page/projectconf.html | ||
|
||
[platformio] | ||
src_dir = . | ||
|
||
[common] | ||
lib_deps = | ||
# FIXME: It is not exactly clear why including `Tally` is needed here. | ||
https://github.com/EnviroDIY/Tally_Library.git#Dev_I2C | ||
https://github.com/daq-tools/EnviroDIY-ModularSensors#espressif | ||
bogde/HX711@^0.7.4 | ||
lib_extra_dirs = | ||
../.. | ||
build_flags = | ||
-D SDI12_EXTERNAL_PCINT | ||
-D ANALOG_EC_ADC_REFERENCE_MODE=0 | ||
|
||
[env:avr328] | ||
platform = atmelavr | ||
board = pro8MHzatmega328 | ||
framework = arduino | ||
lib_ldf_mode = deep | ||
lib_deps = | ||
${common.lib_deps} | ||
lib_extra_dirs = | ||
${common.lib_extra_dirs} | ||
lib_ignore = | ||
RTCZero | ||
build_flags = | ||
${common.build_flags} | ||
|
||
[env:esp8266] | ||
platform = espressif8266 | ||
board = nodemcuv2 | ||
framework = arduino | ||
lib_ldf_mode = deep | ||
lib_deps = | ||
${common.lib_deps} | ||
lib_extra_dirs = | ||
${common.lib_extra_dirs} | ||
lib_ignore = | ||
# Not adequate for Espressif platforms. | ||
RTCZero | ||
build_flags = | ||
${common.build_flags} | ||
|
||
[env:esp32] | ||
platform = espressif32@3.2.0 | ||
board = ttgo-t1 | ||
framework = arduino | ||
lib_ldf_mode = deep | ||
lib_deps = | ||
# FIXME: It is not exactly clear why including `ESP32Time` is needed here. | ||
# Currently, adding it as a dependency to `EnviroDIY_ModularSensors` does not work and will croak like: | ||
# Library Manager: Warning! Could not install dependency {'name': 'ESP32Time', 'owner': 'fbiego', 'library id': '11703', 'url': 'https://github.com/fbiego/ESP32Time.git', 'version': '~1.0.3', 'note': 'An Arduino library for setting and retrieving internal RTC time on ESP32 boards', 'authors': ['Felix Biego'], 'frameworks': ['arduino'], 'platforms': ['espressif8266', 'espressif32']} for package 'EnviroDIY_ModularSensors' | ||
fbiego/ESP32Time@^1.0.3 | ||
${common.lib_deps} | ||
lib_extra_dirs = | ||
${common.lib_extra_dirs} | ||
lib_ignore = | ||
# Not adequate for Espressif platforms. | ||
RTCZero | ||
# This will pull in Sodaq_DS3231. `Sodaq_DS3231.cpp`, in turn, will need `avr/pgmspace.h`. | ||
# So, let's exclude it for ESP32. | ||
EnviroDIY_DS3231 | ||
build_flags = | ||
${common.build_flags} | ||
|
||
[env:samd-m0] | ||
platform = atmelsam | ||
board = adafruit_feather_m0 | ||
board_build.mcu = samd21g18a | ||
framework = arduino | ||
lib_ldf_mode = deep | ||
lib_deps = | ||
${common.lib_deps} | ||
lib_extra_dirs = | ||
${common.lib_extra_dirs} | ||
build_flags = | ||
${common.build_flags} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* | ||
* Basic demonstration program for reading a HX711 ADC using the | ||
* `EnviroDIY_ModularSensors` datalogger framework. | ||
* | ||
*/ | ||
|
||
#include <AviaSemiHX711.h> | ||
|
||
const int32_t serialBaud = 115200; // Baud rate for debugging | ||
|
||
// Configure HX711 pins | ||
#define HX711_PIN_DOUT 14 // DT | ||
#define HX711_PIN_PDSCK 12 // SCK | ||
|
||
// This is the raw sensor value for "0 kg". | ||
// Write down the sensor value of the scale sensor with no load and adjust it here. | ||
#define LOADCELL_ZERO_OFFSET 38623.0f | ||
|
||
// This is the raw sensor value for a load weighing exactly 1 kg. | ||
// Add a load with known weight in kg to the scale sensor, note the | ||
// sensor value, calculate the value for a 1 kg load and adjust it here. | ||
#define LOADCELL_KG_DIVIDER 22053 | ||
|
||
|
||
// Create a HX711 sensor object. | ||
AviaSemiHX711 hx711(HX711_PIN_PDSCK, HX711_PIN_DOUT, LOADCELL_ZERO_OFFSET, LOADCELL_KG_DIVIDER); | ||
|
||
// Create a variable pointer for the HX711. | ||
Variable* hx711Weight = | ||
new AviaSemiHX711_Weight(&hx711, "66666666-abcd-1234-ef00-1234567890ab"); | ||
|
||
|
||
void setup () | ||
{ | ||
Serial.begin(serialBaud); | ||
Serial.print(F("Using ModularSensors Library version ")); | ||
Serial.println(MODULAR_SENSORS_VERSION); | ||
|
||
// TODO: Register sensor with framework and run a single measurement cycle. | ||
} | ||
|
||
void loop () | ||
{ | ||
// Read sensor. | ||
Serial.println("Reading HX711 sensor"); | ||
hx711.update(); | ||
|
||
// FIXME: Get actual reading value. | ||
|
||
// Display reading. | ||
Serial.print("Weight: "); | ||
//Serial.print(hx711.read()); | ||
Serial.println(" kg"); | ||
|
||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "EnviroDIY_HX711", | ||
"version": "0.0.0", | ||
"description": "An EnviroDIY sensor adapter for the canonical HX711 Arduino library by Bogdan Necula", | ||
"keywords": "hx711, load cell, weight scale, sensor, envirodiy", | ||
"authors": [ | ||
{ | ||
"name": "Andreas Motl", | ||
"email": "andreas@hiveeyes.org", | ||
"maintainer": true | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hiveeyes/EnviroDIY_HX711.git" | ||
}, | ||
"license": "MIT", | ||
"homepage": "https://github.com/hiveeyes/EnviroDIY_HX711", | ||
"frameworks": "*", | ||
"platforms": "*", | ||
"examples": "examples/*/*.ino", | ||
"export": { | ||
"include": [ | ||
"library.json", | ||
"library.properties", | ||
"README.md", | ||
"src/*", | ||
"examples/*/*.ino", | ||
"examples/*/*.h", | ||
"examples/*/*.[cht]pp", | ||
"examples/*/*.ini", | ||
"examples/*/*.md", | ||
"examples/*/*.ini", | ||
"examples/*/*.py", | ||
"examples/*/*.txt" | ||
], | ||
"exclude": ["*.exe"] | ||
}, | ||
"dependencies": [ | ||
{ | ||
"name": "HX711", | ||
"owner": "bogde", | ||
"library id": "1100", | ||
"url": "https://github.com/bogde/HX711.git", | ||
"version": "~0.7.4", | ||
"note": "An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weight Scales.", | ||
"authors": ["Bogdan Necula", "Andreas Motl"], | ||
"frameworks": "arduino", | ||
"platforms": "atmelavr, atmelsam, ststm32, espressif8266, espressif32" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name=EnviroDIY_HX711 | ||
version=0.0.0 | ||
author=Andreas Motl <andreas@hiveeyes.org> | ||
maintainer=Andreas Motl <andreas@hiveeyes.org> | ||
sentence=An EnviroDIY sensor adapter for the canonical HX711 Arduino library by Bogdan Necula. | ||
paragraph= | ||
category=Sensors | ||
url=https://github.com/hiveeyes/EnviroDIY_HX711 | ||
architectures=avr,samd,stm32,esp8266,esp32 | ||
includes=AviaSemiHX711.h | ||
depends=HX711 |
Oops, something went wrong.