The WORKBENCH part 1

you got the schematics and code to share ? :wink:

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) :
b2410-1811rs1

1 Like

I have heard comments that condensation can build up within the body of the BME280 sensor; not good for a humidity sensor - this came from an engineer who evaluated the Bosch sensors for a global asset tracking solution.

Have you tried the SHT31-DIS from sensirion? This comes with a strong recommendation from the same engineer.

https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital.pdf

no I didn’t :sunglasses:

I have that sht31 sensor here, have to try that (real I2c !), I tried the SH10 allready but that has no sleepmode, switching the power on/off generates a problem with the I2c bus waking up.
all in all not very happy with the (china) BME280 outdoors @ the moment

x536

so I haven’t found the right combination of sensor / outdoor construction that is accurate and reliable for a longer period, how do they do it then ?

2 Likes

Hi jezd,
Will be open source once released for public. :slight_smile:

3 Likes

Even better is SHT31-DIS with Membrane Option which protects the sensor from water and dust and allows it to be used under harsh environmental conditions.

https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/2_Humidity_Sensors/Sensirion_Humidity_Sensors_SHT3x_Datasheet_Filter_Membran_v1.pdf

(I have not yet seen modules with SHT31-DIS membrane option on AliExpress unfortunately.)

2 Likes

I think the positioning of your BME280 is the biggest issue at this moment (the one positioned at the bottom). That location is error prone.
SHT31-DIS + BMP280 should be a good combination. Using SHT31-DIS for temperature and humidity and use BMP280 for barometric pressure only (not temperature).

SHT31 - https://www.ebay.com/itm/SHT31-SHT31-D-Temperature-Humidity-Sensor-Breakout-Board-Weather-for-Arduino/142466510913
SHT35 - https://www.ebay.com/itm/ClosedCube-SHT35-D-Digital-I2C-Humidity-Temperature-Sensor-Breakout-/182501935370

caps !
https://www.sensirion.com/en/environmental-sensors/humidity-sensors/filter-cap-sf2/

I just ordered two Grove dust sensors for fine particle testing and am hoping to build something to measure pollution (fijnstof) here in Amsterdam. Anyone already working with these?

grove is the connector… what is the sensor type ?

Right…
It’s this one:


tnx for the link btw

x537

yeah baby yeah !! … 4 hardware uarts in a little box :sunglasses:
3V3 PRO MINI version of Mega 2560. Built on the Atmel ATmega2560 microcontroller.

Nice. And standard 16MHz with 3.3V instead of just 8MHz like Pro Mini.

So, do you have any special application in mind with 4 UARTS? :grinning:

:wink:

uart 1 - debug / program
uart 2 - GPS
uart 3 - Nextion touchscreen
uart 4 - LoRa module

2 Likes

we’ve just sent you a post on twitter about when we can get hold of one for testing

x538

proto TTN stick software compatible with The Things Uno :sunglasses:

32U4 / levelshifter / dc dc 3v3 stepdown / rn2483

x539
use case : developper stick / demo node on the go

3 Likes

Smart looking thing with that integrated connector.
If I may ask, why would you use a levelshifter and a stepdown? Isn’t either enough?

the TTN stick gets its power from the USB bus which is 5 V (this node has no battery connection)
32U4 the (leonardo) processor operates on 5 v but the LoRa module RN2483 on 3v3.

so the stepdown is to make 3v3 from the 5v and the level shifterr is to ‘level’ the UART signals
in the final node I don’t use the fancy buck/boost module but a simple stepdown converter.

there will be some more things on the protoboard like an rgb led and a reset button (need that for programming the thing)
my problem is that I get an idea and start immediate with it… that’s why all my tables are full :rofl:

1 Like

Your workbench must be a ton of fun for a tinkerer.
So a level switcher is just for data but not for actual power? I thought you could a level shifter to do 5v -> 3v3 to also drive/power things. Not at all or only limited?

  • edit. Read up on it, looks like it’s indeed only for data.
2 Likes

x540

the RN2483 ‘A’ version arrived

1 Like