element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Just Encase
  • Challenges & Projects
  • Design Challenges
  • Just Encase
  • More
  • Cancel
Just Encase
Blog Harsh Weather Monitoring Using Arduino MKR 1300 With Hammond Enclosure Case - (Blog 2)
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Just Encase to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: vinayyn
  • Date Created: 27 Feb 2022 2:53 PM Date Created
  • Views 1302 views
  • Likes 10 likes
  • Comments 0 comments
  • design_challenge
  • Hammond Manufacturing Enclosures
  • Arduino MKR WAN 13000
  • lora communication
  • just_encase
Related
Recommended

Harsh Weather Monitoring Using Arduino MKR 1300 With Hammond Enclosure Case - (Blog 2)

vinayyn
vinayyn
27 Feb 2022

In The previous Blog, I have tested the Hammond Enclosure Case using Water. The Results of the experiment concluded that the device will be not affected by the water due to its High-Quality Water and Dust Resistant Design. By taking the advantage of enclosure case I have used it to place my circuit inside the box And Tested Them for a couple of days In an open space, the devices are not affected by fog and dust, and high temperature.

image

Working Of The Final Project

I have made Two sections in this project, the Transmitter section, and Receiver section.

image

Transmitter Part

The Transmitter section contains The Temperature, Humidity sensor, Light sensor, Mems Microphone, Mems Accelerometer sensor. These sensors are interfaced with the Arduino MKR 1300 Board along with The external antenna. A lithium battery is used to power all the sensors and Microcontroller, this battery is able to standby for up to 7 days in this project. To protect the circuit from the harsh weather I have used Hammond Enclosure Case 1554UGY Water Tight ABS 200x120x90 Enclosure. The sensor details are collected and transmitted Over LoRa Using Arduino MKR 1300.

                                                     Transmitter Section Block Diagram

image

                                              Transmitter Part Device

image

Receiver Section

The receiver part contains the Arduino MKR 1300 And Wi-Fi Module To receive the LoRa Data and Transmit the data again to the cloud Using the Internet, I call It has Gateway. 

                                      Receiver Block Diagram

image

Receiver Device

image

The LoRa Data is received And The Sensor details are collected Using the Arduino MKR 1300, if there is any severe variation in the environment data and its crosses the threshold values, The details are displayed on the app parallel shown on the LCD display.

If the temperature of the surrounding environment is high, The Buzzer will be ON in the receiver section and The LCD Turns RED, To notify the user, and Pop-up Notification displayed on the mobile.

image

When the box is opened or it broke the light intensity data of the sensor is high, then it will be finalized as the Box Opened and the Pop-Up Notification is displayed on the mobile.

During The operation when the transmitter is moved or if any high wind is detected a "Movement Detected" notification is displayed on the Mobile and in the receiver part Buzzer is activated with a different tone. This tone is different from The High-Temperature Alert.

image

In this project, I have used Blynk App to display the sensor details.

                                       Schematic Diagrams

Transmitter 

image

Receiver 

image

                          CODES

Transmitter Part

#include <SPI.h>
#include <LoRa.h>
#include<String.h>
#include "DHT.h"
#define DUMP_REGS
#include <Wire.h>
#include "MPU6050.h"
#include <APDS9930.h>
#define DHTPIN 2 
#define DHTTYPE DHT22 
DHT dht(DHTPIN, DHTTYPE);
String str;
char cstr[500];
String message = "";
unsigned int mlength; // message length 
APDS9930 apds = APDS9930();
float ambient_light = 0; // can also be an unsigned long
uint16_t ch0 = 0;
uint16_t ch1 = 1;
float light_data;
float h;
float t;
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;

void setup() 
{
  Serial.begin(9600);
  LoRa.begin(915E6);
  dht.begin();
  Wire.begin();
   accelgyro.initialize();
   if ( apds.init() )
   {
    Serial.println(F("APDS-9930 initialization complete"));
  } 
  else 
  {
    Serial.println(F("Something went wrong during APDS-9930 init!"));
  }
  
  // Start running the APDS-9930 light sensor (no interrupts)
  if ( apds.enableLightSensor(false) ) {
    Serial.println(F("Light sensor is now running"));
  } else {
    Serial.println(F("Something went wrong during light sensor init!"));
  }
  #ifdef DUMP_REGS
  /* Register dump */
  uint8_t reg;
  uint8_t val;

  for(reg = 0x00; reg <= 0x19; reg++) {
    if( (reg != 0x10) && \
        (reg != 0x11) )
    {
      apds.wireReadDataByte(reg, val);
      Serial.print(reg, HEX);
      Serial.print(": 0x");
      Serial.println(val, HEX);
    }
  }
  apds.wireReadDataByte(0x1E, val);
  Serial.print(0x1E, HEX);
  Serial.print(": 0x");
  Serial.println(val, HEX);
#endif

  delay(500);
}

void loop() 
{
  while(1)
  {
     accelgyro.getRotation(&gx, &gy, &gz);
  light_details();
  temperature();
  message = String(h) +String(",") + String(t)+String(",")+ String(light_data)+String(",")+ String(gx)+String(",");
 // message = message+ h +"," + t+","+ light_data +","+ gx +",";

  delay(1000);
  mlength = (sizeof(message)*4);
  str = message;
  delay(100);
  LoRa.beginPacket();
  LoRa.print(str);
  delay(100);
  Serial.println(str);
  LoRa.endPacket(0);
  }
}

void light_details()
{
if (  !apds.readAmbientLightLux(ambient_light) ||
        !apds.readCh0Light(ch0) || 
        !apds.readCh1Light(ch1) ) {
    Serial.println(F("Error reading light values"));
  } 
  else {
    light_data = ambient_light;
  }  
}

void temperature()
{
  h = dht.readHumidity();
  t = dht.readTemperature(); 

}

Receiver Part

Arduino MKR 1300 Part

#include <SPI.h>
#include <LoRa.h>
#include <Wire.h>
#include "rgb_lcd.h"
#include<String.h>
rgb_lcd lcd;
int colorR = 0;
int colorG = 0;
int colorB = 255;
int data1;
int data2;
int data3;
int data4;
int data5;
int buzzer = 5;
String str;
char cstr[100];
String message = "";
unsigned int mlength; // message length 
char LoRaData;
void setup() {
lcd.begin(16, 2);
pinMode(buzzer,OUTPUT);
lcd.setRGB(colorR, colorG, colorB);
LoRa.begin(915E6);
Serial.begin(9600);
Serial1.begin(9600);
}

void loop() 
{
String str1="",str2="",str3="",str4="",str5="";
int packetSize = LoRa.parsePacket(),i=0,len;
if (packetSize) 
{
  while (LoRa.available()) 
  {
  colorR = 0;
  colorG = 255;
  colorB = 0;
  lcd.setRGB(colorR, colorG, colorB);
    str1=str1+((char)LoRa.read());
   
    }
    len=str1.length();
    if(len-10 > 0)
    {
      str1=str1.substring(0,len);      
      str2=str1.substring(0,6);
      str3 =str1.substring(6,12);
      str4 = str1.substring(12,17);
      str5 = str1.substring(18,24);
      
      data1 = str2.toInt();
      data2 = str3.toInt();
      data3 = str4.toInt();
      data4 = str5.toInt();
    }
     Serial.print("HUM:");
     Serial.print(data1);
     Serial.println();

     Serial.print("Temp:");
     Serial.print(data2);
     Serial.println();

     
     Serial.print("light:");
     Serial.print(data3);
     Serial.println();

     Serial.print("AXIS:");
     Serial.print(data4);
     Serial.println();


     lcd.setCursor(0, 0);
     lcd.print("Temp:");
     lcd.print(data2);

     lcd.setCursor(8, 0);
     lcd.print("Hum:");
     lcd.print(data1);

     Serial.print("RSSI:");
     Serial.print(LoRa.packetRssi());
     Serial.println();


//     lcd.setCursor(0, 1);
//     lcd.print("RSSI:");
//     lcd.print(LoRa.packetRssi());
//
//     lcd.setCursor(8, 1);
//     lcd.print("axis:");
//     lcd.print(data4);
     
message = String(data1) +String(",") + String(data2) +String(",")+ String(data3) +String(",") + String(data4) +String(",");
 // message = message+ h +"," + t+","+ light_data +","+ gx +",";
delay(1000);
mlength = (sizeof(message)*4);
str = message;  
//Serial.print("length:");
//Serial.print(mlength);
//Serial.println();
//str.toCharArray(cstr,mlength);
//Serial1.println(cstr);
Serial.println(str);
Serial1.print(str);
if(data2 >= 30)
{
  Serial.println("high temperature");
  digitalWrite(buzzer,HIGH);
 int colorR = 255;
int colorG = 0;
int colorB = 0;
  lcd.setRGB(colorR, colorG, colorB);
     lcd.setCursor(0, 1);
     lcd.print("High Temperature");
    
}
else
{
   digitalWrite(buzzer,LOW);
 int colorR = 0;
int colorG = 255;
int colorB = 0;
  lcd.setRGB(colorR, colorG, colorB); 
  lcd.setRGB(colorR, colorG, colorB);
     lcd.setCursor(0, 1);
     lcd.print("                ");
}

if(data4 >=800 || data4 <0)
{
  digitalWrite(buzzer,HIGH);
  delay(250);
  digitalWrite(buzzer,LOW);
   delay(250);
   digitalWrite(buzzer,HIGH);
  delay(250);
  digitalWrite(buzzer,LOW);
}
 
   }}

Wi-Fi Module Part

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include<String.h>
#include <SoftwareSerial.h>//libraries needed in communicating with gps and nodemcu
int RXPin = D2;//tx pin of mkr1300 connected to this pin
int TXPin = D1;//rx pin of mkr1300 connected to this pin
SoftwareSerial data_serial(RXPin, TXPin);//declaring the rx,tx pins
int incomingByte = 0;

int data1;
int data2;
int data3;
int data4;
int data5;
String LoRaData;
String jsonBuffer;
float ta;// Temperature details 
float ha; // Humidity details
float rs; //Rssi details

char auth[] = "xxxxxxxxxxxxx";// Your blynk app token id
char ssid[] = "xxxxxxxxxxxx"; // your Wifi name
char pass[] = "xxxxxxxxxxxxxxx"; // your wifi password

BlynkTimer timer;

void setup() {
  Serial.begin(9600);
  data_serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

void loop() {
String str1="",str2="",str3="",str4="",str5="";
 int i=0,len;
char commandbuffer[400];
  if (data_serial.available())
  {
    delay(500);
while( data_serial.available() && i< 99) 
{
commandbuffer[i++] = data_serial.read();
}
//commandbuffer[i++]='\0';
  }
  Serial.println((char*)commandbuffer);
  str1=str1+((char*)commandbuffer);
  len=str1.length();
  Serial.println(len);
    if(len-15 > 0)
    {
      str1=str1.substring(0,len);      
      str2=str1.substring(0,2);
      str3 =str1.substring(3,5);
      str4 = str1.substring(6,8);
      str5 = str1.substring(9,15);
      data1 = str2.toInt();
      data2 = str3.toInt();
      data3 = str4.toInt();
      data4 = str5.toInt();
    }
     Serial.print("hum:");
     Serial.print(data1);
     Serial.println();

     Serial.print("temp:");
     Serial.print(data2);
     Serial.println();

     Serial.print("Light:");
     Serial.print(data3);
     Serial.println();

     Serial.print("axis:");
     Serial.print(data4);
     Serial.println();
     
      Blynk.virtualWrite(V0,data1);
      Blynk.virtualWrite(V1,data2);
      Blynk.virtualWrite(V2,data3);
      Blynk.virtualWrite(V3,data4);
  
      Blynk.run();
      timer.run();
      
}

Project Working Video

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube