I don’t know if the HW designer, Rocket Scream , will make this open source… at this moment it’s a betatest and the node performs very well (only the BME280 sensor s*cks)
Click to see test code
// -----------------------------------------------------------------------
// TTN OTAA temperature / humidity / battery voltage
// 328P / rn2483 / BME280
// RocketScream-02.2 testnode 1.5 v 5 min public
// BoRRoZ oct 2017
// -----------------------------------------------------------------------
#include <TheThingsNetwork.h>
#include <CayenneLPP.h>
#include <AltSoftSerial.h>
#include "SparkFunBME280.h"
#include "Wire.h"
#include <LowPower.h>
int count = 0;
float temp;
float hum;
float volt;
//float pres;
//float alt;
BME280 bme;
// -----------------------------------------------------------------------
const char *appEui = "0000000000000000";
const char *appKey = "00000000000000000000000000000000";
// -----------------------------------------------------------------------
#define loraSerial Serial
AltSoftSerial debugSerial; // Rx 8 Tx 9
// -----------------------------------------------------------------------
#define SLEEP_PERIOD 300000 // max = 4294967296 - 49.7days
// 1 min = 60000
// 5 min = 300000*
// -----------------------------------------------------------------------
#define freqPlan TTN_FP_EU868
TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
CayenneLPP lpp(51);
// -----------------------------------------------------------------------
void setup()
{
bmeSetup();
loraSerial.begin(57600);
debugSerial.begin(9600);
pinMode(2, INPUT); // sleep interrupt
pinMode(4, OUTPUT); // reset rn2483
pinMode(LED_BUILTIN, OUTPUT); // 13
digitalWrite(LED_BUILTIN, HIGH); // LED on = joining
digitalWrite(4, LOW); // reset rn2483
delay(500);
digitalWrite(4, HIGH);
while (!ttn.join(appEui, appKey)) {
delay(10000);
}
//debugSerial.println(F("-- [setup complete]"));
//ttn.showStatus();
digitalWrite(LED_BUILTIN, LOW); // LED off = we OTAA joined yeah
}
// -----------------------------------------------------------------------
void loop()
{
readSENSORS();
//debugInfo();
transmitDATA();
ttn.sleep(SLEEP_PERIOD);
debugSerial.flush();
attachInterrupt (digitalPinToInterrupt(2), awake, LOW);
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
Wire.begin();
delay(50);
}
// -----------------------------------------------------------------------
void bmeSetup()
{
bme.settings.commInterface = I2C_MODE;
bme.settings.I2CAddress =0x76;
bme.settings.runMode = 0;
// 0, Sleep mode
// 1 or 2, Forced mode
// 3, Normal mode
bme.settings.tStandby = 0;
// 0, 0.5ms
// 1, 62.5ms
// 2, 125ms
// 3, 250ms
// 4, 500ms
// 5, 1000ms
// 6, 10ms
// 7, 20ms
bme.settings.filter = 0;
// 0, filter off
// 1, coefficients = 2
// 2, coefficients = 4
// 3, coefficients = 8
// 4, coefficients = 16
bme.settings.tempOverSample = 1;
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16
bme.settings.pressOverSample = 1;
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16
bme.settings.humidOverSample = 1;
// 0, skipped
// 1 through 5, oversampling *1, *2, *4, *8, *16
bme.begin();
delay(10);
}
// -----------------------------------------------------------------------
void readSENSORS()
{
rTEMP();
rBATTERY();
}
// -----------------------------------------------------------------------
void rTEMP()
{
bmeForceRead();
temp = bme.readTempC();
hum = bme.readFloatHumidity();
//pres = bme.readFloatPressure() / 100.0F;
//alt = bme.readFloatAltitudeMeters();
}
// -----------------------------------------------------------------------
void bmeForceRead() {
// set the BME280 sensor in "forced mode" to force a reading.
// after the reading the sensor will go back to sleep mode as set before.
uint8_t value = bme.readRegister(BME280_CTRL_MEAS_REG);
value = (value & 0xFC) + 0x01;
bme.writeRegister(BME280_CTRL_MEAS_REG, value);
// Measurement Time (as per BME280 datasheet section 9.1)
// T_max(ms) = 1.25
// + (2.3 * T_oversampling)
// + (2.3 * P_oversampling + 0.575)
// + (2.4 * H_oversampling + 0.575)
// ~ 9.3ms for current settings
delay(10);
}
// -----------------------------------------------------------------------
void rBATTERY()
{
int counter;
int adcReading;
int voltage;
adcReading = analogRead(A6);
adcReading = 0;
for (counter = 10; counter > 0; counter--)
{
adcReading += analogRead(A6);
}
adcReading = adcReading/10;
// convert to volts
volt = adcReading * (3.3 / 1023.0);
}
// -----------------------------------------------------------------------
void debugInfo()
{
debugSerial.println("");
debugSerial.print("BATTERY : ");
debugSerial.print(volt);
debugSerial.println(" v");
debugSerial.print("TEMPERATURE : ");
debugSerial.print(temp);
debugSerial.println(" c");
debugSerial.print("HUMIDITY : ");
debugSerial.print(hum);
debugSerial.println(" %");
//debugSerial.print("PRESSURE : ");
//debugSerial.print(pres);
//debugSerial.println(" mb");
//debugSerial.print("ALTITUDE : ");
//debugSerial.print(alt);
//debugSerial.println(" mtr");
debugSerial.print("PAYLOADS : ");
debugSerial.print(count);
debugSerial.println(" ");
debugSerial.print("-------------------------------[ ");
}
// -----------------------------------------------------------------------
void transmitDATA()
{
lpp.reset();
lpp.addTemperature(1, temp);
lpp.addRelativeHumidity(2, hum);
lpp.addAnalogInput(3, volt);
lpp.addLuminosity(4, count);
//lpp.addBarometricPressure(5, pres);
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
count++; // update frames transmitted
}
// -----------------------------------------------------------------------
void awake()
{
}
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
the 1,5 VAA battery from the start (24-10) till now (18-11) :