Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec7a10f5ff | ||
|
|
384d262905 | ||
|
|
cc14992ba0 | ||
|
|
2add3ddf9f | ||
|
|
82ffafa6c7 | ||
|
|
2850593631 |
@@ -1,3 +1,5 @@
|
|||||||
mini-beieli-provision-cubecell
|
mini-beieli-provision-cubecell
|
||||||
appkey
|
appkey
|
||||||
calibrate
|
calibrate
|
||||||
|
MiniBeieliNodeSketch/build
|
||||||
|
cyacd
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ BME280 bme280;
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Firmware Version */
|
/* Firmware Version */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
static const int32_t fwVersion = 20210511;
|
static const int32_t fwVersion = 20240622;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* LoraWAN Settings */
|
/* LoraWAN Settings */
|
||||||
@@ -225,6 +225,7 @@ bool stop_iterations = false;
|
|||||||
bool start_new_iteration = false;
|
bool start_new_iteration = false;
|
||||||
bool next_package_is_init_package = true;
|
bool next_package_is_init_package = true;
|
||||||
uint32_t gRebootMs;
|
uint32_t gRebootMs;
|
||||||
|
char last_channel = 'X';
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Functions for Global Data Structures */
|
/* Functions for Global Data Structures */
|
||||||
@@ -404,6 +405,9 @@ bool InitializeScales()
|
|||||||
result &= nau7802.setSampleRate(NAU7802_SPS_40); //Set samples per second to 40
|
result &= nau7802.setSampleRate(NAU7802_SPS_40); //Set samples per second to 40
|
||||||
result &= nau7802.setRegister(NAU7802_ADC, 0x30); //Turn off CLK_CHP. From 9.1 power on sequencing.
|
result &= nau7802.setRegister(NAU7802_ADC, 0x30); //Turn off CLK_CHP. From 9.1 power on sequencing.
|
||||||
|
|
||||||
|
// see https://github.com/sparkfun/SparkFun_Qwiic_Scale_NAU7802_Arduino_Library/issues/7
|
||||||
|
//result &= nau7802.clearBit(NAU7802_PGA_PWR_PGA_CAP_EN, NAU7802_PGA_PWR);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,6 +450,8 @@ long ReadScale(char channel)
|
|||||||
channelNumber = NAU7802_CHANNEL_2;
|
channelNumber = NAU7802_CHANNEL_2;
|
||||||
}
|
}
|
||||||
unsigned long startTime = millis();
|
unsigned long startTime = millis();
|
||||||
|
if (channel != last_channel) {
|
||||||
|
last_channel = channel;
|
||||||
nau7802.setChannel(channelNumber);
|
nau7802.setChannel(channelNumber);
|
||||||
bool calibrate_success = nau7802.calibrateAFE();
|
bool calibrate_success = nau7802.calibrateAFE();
|
||||||
if (! calibrate_success) {
|
if (! calibrate_success) {
|
||||||
@@ -453,7 +459,13 @@ long ReadScale(char channel)
|
|||||||
Serial.printf("Error: Calibration not successful!\n");
|
Serial.printf("Error: Calibration not successful!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (config_data.debug_level > 0) {
|
||||||
|
Serial.printf("getChannel1Gain: %d\n", nau7802.getChannel1Gain());
|
||||||
|
Serial.printf("getChannel1Offset: %d\n", nau7802.getChannel1Offset());
|
||||||
|
Serial.printf("NAU7802_GCAL2_B3: %d\n", nau7802.get32BitRegister(NAU7802_GCAL2_B3));
|
||||||
|
Serial.printf("NAU7802_OCAL2_B2: %d\n", nau7802.get32BitRegister(NAU7802_OCAL2_B2));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (nau7802.available()) {
|
if (nau7802.available()) {
|
||||||
long dummy = nau7802.getReading();
|
long dummy = nau7802.getReading();
|
||||||
}
|
}
|
||||||
@@ -967,6 +979,8 @@ void loop()
|
|||||||
case DEVICE_STATE_SEND:
|
case DEVICE_STATE_SEND:
|
||||||
{
|
{
|
||||||
if (ReadSensors(false)) {
|
if (ReadSensors(false)) {
|
||||||
|
// we send confirmed packages when weight change is too big or for every init package
|
||||||
|
isTxConfirmed = (TooBigWeightChange()) || (iteration <= INIT_PACKETS) || (iteration % INIT_PACKAGE_INTERVAL == 0);
|
||||||
prepareTxFrame(appPort);
|
prepareTxFrame(appPort);
|
||||||
LoRaWAN.send();
|
LoRaWAN.send();
|
||||||
package_counter++;
|
package_counter++;
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ Das sind die verwendeten Libraries [1]:
|
|||||||
|
|
||||||
| URL | Branch | Commit | Commit Date |
|
| URL | Branch | Commit | Commit Date |
|
||||||
| --- | ------ | ----- | ----------- |
|
| --- | ------ | ----- | ----------- |
|
||||||
| https://github.com/HelTecAutomation/CubeCell-Arduino.git | 0582aca | Sun, 9 May 2021 16:29:35 +0800 |
|
| https://github.com/HelTecAutomation/ASR650x-Arduino.git | 7d7e157 | Mon, 8 Apr 2024 10:51:43 +0800 |
|
||||||
| https://github.com/sparkfun/SparkFun_Qwiic_Scale_NAU7802_Arduino_Library.git | master | 688f255 | Fri, 3 Jan 2020 12:35:22 -0700 |
|
| https://github.com/sparkfun/SparkFun_Qwiic_Scale_NAU7802_Arduino_Library.git | e6b91f8 | Mon, 26 Feb 2024 09:55:18 +0000 |
|
||||||
| https://github.com/sparkfun/SparkFun_BME280_Arduino_Library.git | master | 0b5eabf | Wed, 30 Dec 2020 20:44:27 -0700 |
|
| https://github.com/sparkfun/SparkFun_BME280_Arduino_Library.git | c42e780 | Tue, 19 Sep 2023 14:53:45 -0600 |
|
||||||
|
|
||||||
`
|
`
|
||||||
[1]: echo "| $(git remote -v |grep fetch |awk '{print $2}' |tr '\n' ' ') | $(git log --pretty=format:'%h | %cD ' -n 1) |"
|
[1]: echo "| $(git remote -v |grep fetch |awk '{print $2}' |tr '\n' ' ') | $(git log --pretty=format:'%h | %cD ' -n 1) |"
|
||||||
@@ -34,32 +34,63 @@ Das sind die verwendeten Libraries [1]:
|
|||||||
|
|
||||||
Installation:
|
Installation:
|
||||||
`
|
`
|
||||||
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/bin sh
|
$ brew install arduino-cli
|
||||||
$ arduino-cli version
|
$ arduino-cli version
|
||||||
arduino-cli alpha Version: 0.18.1 Commit: b3cf8e19 Date: 2021-04-13T13:08:30Z
|
arduino-cli Version: 1.0.0 Commit: 05c9852a Date: 2024-06-12T12:11:23Z
|
||||||
|
|
||||||
$ arduino-cli sketch new MiniBeieliNodeSketch
|
$ arduino-cli sketch new MiniBeieliNodeSketch
|
||||||
|
|
||||||
$ arduino-cli core update-index
|
Install Board aus Git
|
||||||
|
|
||||||
$ arduino-cli board listall
|
mkdir -p ~/Documents/Arduino/hardware/CubeCell
|
||||||
|
cd ~/Documents/Arduino/hardware/CubeCell
|
||||||
|
git clone https://github.com/HelTecAutomation/ASR650x-Arduino.git CubeCell
|
||||||
|
cd CubeCell/tools
|
||||||
|
python get.py
|
||||||
|
|
||||||
$ arduino-cli core install CubeCell:CubeCell
|
Install Libraries (from Git...):
|
||||||
$ arduino-cli core list
|
|
||||||
|
$ cd ~/Documents/Arduino/libraries
|
||||||
|
$ git clone https://github.com/sparkfun/SparkFun_Qwiic_Scale_NAU7802_Arduino_Library.git
|
||||||
|
$ git clone https://github.com/sparkfun/SparkFun_BME280_Arduino_Library.git
|
||||||
|
|
||||||
Set FQBN:
|
Set FQBN:
|
||||||
$ FQBN="CubeCell:CubeCell:CubeCell-Board:LORAWAN_REGION=6,LORAWAN_CLASS=0,LORAWAN_DEVEUI=0,LORAWAN_NETMODE=0,LORAWAN_ADR=0,LORAWAN_UPLINKMODE=1,LORAWAN_Net_Reserve=0,LORAWAN_AT_SUPPORT=0,LORAWAN_RGB=0,LORAWAN_DebugLevel=0"
|
$ FQBN="CubeCell:CubeCell:CubeCell-Board:LORAWAN_REGION=6,LORAWAN_CLASS=0,LORAWAN_DEVEUI=0,LORAWAN_NETMODE=0,LORAWAN_ADR=0,LORAWAN_UPLINKMODE=1,LORAWAN_Net_Reserve=0,LORAWAN_AT_SUPPORT=0,LORAWAN_RGB=0,LORAWAN_DebugLevel=0"
|
||||||
|
|
||||||
Compile:
|
Compile:
|
||||||
$ arduino-cli compile --clean --fqbn ${FQBN} MiniBeieliNodeSketch
|
$ arduino-cli compile --export-binaries --clean --fqbn ${FQBN} MiniBeieliNodeSketch
|
||||||
|
|
||||||
|
=== Beispiel ===
|
||||||
|
joerg@mbp mini-beieli-node-cubecell % arduino-cli compile --export-binaries --clean --fqbn ${FQBN} MiniBeieliNodeSketch
|
||||||
|
Der Sketch verwendet 113756 Bytes (86%) des Programmspeicherplatzes. Das Maximum sind 131072 Bytes.
|
||||||
|
|
||||||
|
Benutzte Bibliothek Version Pfad
|
||||||
|
LoRa 1.0 /Users/joerg/Documents/Arduino/hardware/CubeCell/CubeCell/libraries/LoRa
|
||||||
|
LoraMac_102 1.0.2 /Users/joerg/Documents/Arduino/hardware/CubeCell/CubeCell/libraries/LoraWan102
|
||||||
|
SparkFun BME280 2.0.10 /Users/joerg/Documents/Arduino/libraries/SparkFun_BME280_Arduino_Library
|
||||||
|
SparkFun Qwiic Scale NAU7802 Arduino Library 1.0.5 /Users/joerg/Documents/Arduino/libraries/SparkFun_Qwiic_Scale_NAU7802_Arduino_Library
|
||||||
|
|
||||||
|
Used platform Version Pfad
|
||||||
|
CubeCell:CubeCell 1.0.0 /Users/joerg/Documents/Arduino/hardware/CubeCell/CubeCell
|
||||||
|
=============
|
||||||
|
|
||||||
Upload:
|
Upload:
|
||||||
$ arduino-cli upload --fqbn ${FQBN} -p /dev/ttyUSB0 MiniBeieliNodeSketch
|
$ arduino-cli upload --verbose --fqbn ${FQBN} -p /dev/tty.usbserial-0001 MiniBeieliNodeSketch
|
||||||
|
|
||||||
Output ist in /tmp/arduino-sketch-XXXXXXXXXXXXXXXXXXXXXXXXX und kann kopiert werden:
|
*.cyacd-File kann kopiert werden nach cyacd-Directory:
|
||||||
$ mkdir ~/arduino-builds-saved/20210511/
|
Beispiel:
|
||||||
$ cp /tmp/arduino-sketch-0870BAA82DFEB3C4E076C8FBBDEB25B4/CubeCell_Board_REGION_EU868_RGB_0.cyacd ~/arduino-builds-saved/20210511/
|
|
||||||
|
|
||||||
Upload Variante 2:
|
joerg@z240 mini-beieli-node-cubecell % arduino-cli upload --verbose --fqbn ${FQBN} -p /dev/tty.usbserial-0001 MiniBeieliNodeSketch
|
||||||
/home/joerg/Arduino/hardware/CubeCell/CubeCell/tools/CubeCellflash/CubeCellflash -serial /dev/ttyUSB0 /home/joerg/arduino-builds-saved/latest/CubeCell_Board_REGION_EU868_RGB_0.cyacd
|
"/Users/joerg/Documents/Arduino/hardware/CubeCell/CubeCell/tools/CubeCellflash/CubeCellflash" -serial "/dev/tty.usbserial-0001" "/private/var/folders/n6/jjw6yp4s2dz0sd76rz3k7mzm0000gn/T/arduino-sketch-97CDDDDD36F10A320334F076837B4C34/CubeCell_Board_REGION_EU868_RGB_0.cyacd"
|
||||||
|
|
||||||
|
$ mkdir -p cyacd/20211228
|
||||||
|
$ cp /private/var/folders/n6/jjw6yp4s2dz0sd76rz3k7mzm0000gn/T/arduino-sketch-97CDDDDD36F10A320334F076837B4C34/CubeCell_Board_REGION_EU868_RGB_0.cyacd cyacd/20211228
|
||||||
|
|
||||||
|
Alternative zum Upload der Firmware:
|
||||||
|
$ /Users/joerg/Documents/Arduino/hardware/CubeCell/CubeCell/tools/CubeCellflash/CubeCellflash -serial /dev/tty.usbserial-0001 cyacd/20220930/CubeCell_Board_REGION_EU868_RGB_0.cyacd
|
||||||
|
|
||||||
|
USB-Device kann am einfachsten wie folgt bestimmt werden:
|
||||||
|
|
||||||
|
joerg@mbp mini-beieli-node-cubecell % ls -l /dev/tty.usbserial*
|
||||||
|
crw-rw-rw- 1 root wheel 0x9000004 28 Dez 19:38 /dev/tty.usbserial-0001
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
module gitlab.com/mini-beieli-node-cubecell/v2
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
|
||||||
|
|
||||||
|
require golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
|
||||||
|
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||||
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
|
||||||
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
Reference in New Issue
Block a user