firasgroupe_eise
Published

Monitoring of a LoRa antenna

Transmit information about the status of an energy-autonomous LoRa antenna, monitoring through a web interface

AdvancedWork in progress421
Monitoring of a LoRa antenna

Things used in this project

Hardware components

Arduino MKR WAN 1310
Arduino MKR WAN 1310
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Phasesun Phgaesun sunPlus 100
×1
TP-Link Box 300Mbps Wireless N4G LTE Router
×1
The Things Gateway
The Things Industries The Things Gateway
×1
Batterie 12.7V 17AH RS PRO Sealed Lead-Acid Battery General Purpose Gel
×1
ddr-15g-5
×1
Régulateur solaire Steca, tension du panneau solaire 12 V, 24 V
×1
SEN0291
×1
Kit Carte Breakout Sigfox BRKWS01-RC1+Antenne 868Mhz
×1
Polymer Lithium Ion Battery - 2200mAh 3.7V
Seeed Studio Polymer Lithium Ion Battery - 2200mAh 3.7V
×1
Chargeur utilisé pour charger de simples batteries en lithium-ion/lithium-polymère de 3,7 ou 4,2 V
×1

Software apps and online services

Arduino IDE
Arduino IDE
KiCad
KiCad
Ubidots
Ubidots
The Things Stack
The Things Industries The Things Stack

Story

Read more

Custom parts and enclosures

Github

Schematics

Circuit of the Arduino part of the project

Code

gateway_lora.ino

C/C++
#include <MKRWAN.h>
#include "DHT.h"
#define DHTTYPE DHT22
#include <Wire.h>
#include "DFRobot_INA219.h"

DFRobot_INA219_IIC     ina219(&Wire, INA219_I2C_ADDRESS4);

float ina219Reading_mA = 1000;
float extMeterReading_mA = 1000;
LoRaModem modem;
String appEui = "0000000000000010";
String appKey = "EE6231CA556EFD1B077B4C5CCEDCA01D";
bool connected;
int err_count;
short con;

// DHT Sensor
uint8_t DHTPin = 4;        
// Initialize DHT sensor.
DHT dht(DHTPin, DHTTYPE);                
float temperature;
float humidity;
void initDHT(){
  pinMode(DHTPin, INPUT);
  dht.begin();
}

void setup() {
  pinMode(A1, INPUT) ;
  initDHT();
  modem.begin(EU868);
  delay(1000); 
  // First use of capteur de puissance
  while(ina219.begin() != true) {
     delay(2000);
  }
  //Linear calibration
  ina219.linearCalibrate(ina219Reading_mA, extMeterReading_mA);
   connected=false;
  err_count=0;
  con =0;
}

void loop() {
  float resultBinary = analogRead(A1); // Rsultat de la mesure en binaire de la broche A0 (sur 10 bits de 0 (0 Volts)  1023 (5 volts) )
  temperature = dht.readTemperature(); 
  humidity = dht.readHumidity();
  // use the capteur de puissance
  while(ina219.begin() != true) {
        delay(2000);
  }
  if ( !connected ) {
    int ret=modem.joinOTAA(appEui, appKey);
    if ( ret ) {
      connected=true;
      modem.minPollInterval(60);
      modem.dataRate(5); // switch to SF7
      delay(100); // because ... more stable
      err_count=0;
    }
  }
  if ( connected ) {
    int err=0;
    modem.beginPacket();
    temperature *= 100;
    humidity*=100;
    short batterie = (((((3.3*resultBinary/1024)/1.02)*352/82)-11.1)/1.6)*100;
    modem.write((short) temperature);
    modem.write((short) humidity); 
    modem.write((short) ina219.getPower_mW());
    modem.write(batterie);
    err = modem.endPacket();
    err_count = 0;
    // wait for 5min
    delay(300000);
   }
}

Credits

firas

firas

2 projects • 1 follower
groupe_eise

groupe_eise

0 projects • 0 followers

Comments