Giter VIP home page Giter VIP logo

lora-rain-gauge's Introduction

LoRa Rain Gauge

This repository contains an Arduino sketch for a rain gauge system that utilizes LoRa communication, RTC for timestamping, and an SD card for data logging.

CASA0016:MDB
Satria Mitra Utama

Rain Gauge

Dependancies

Hardware Requirements

  1. Arduino MKR board with LoRa connectivity
  2. DS3231 RTC module
  3. SD card module
  4. Reed switch for rainfall measurement
  5. 5mm Neodymum magnet
  6. Printed Rain Gauge
  7. 25mm screw with diameter 2mm
  8. Lot of wires

Optional Hardwares

  1. Lipo Battery
  2. Solar Panel
  3. Adafruit Solar Charger

Software

Arduino Libraries

  1. RTCLib
  2. MKRWAN
  3. Wire
  4. SD
  5. SPI

Node Red

  1. Node-Red Dashboard lib

Getting Started

  1. Connections: Wire up the components according to the provided pin configurations.
No Hardware Hardware Pin Arduino MKR Pin
1 RTC VCC VCC
GND GND
SCL SCL/12
SDA SDA/11
2 Sd card VCC VCC
GND GND
MOSI 8/MOSI
MISO 10/MISO
SCK 7
3 Reed switch SW1 6
VCC VCC
GND GND
4 Charger JST + JST +
JST- JST -
  1. Rain Gauge:

    • Print these files using PLA (not waterproof) or PETG(waterproof) filament
      • rain_gauge-can.stl
      • rain_gauge-bucket.stl
      • rain_gauge-base.stl
    • Insert your 5mm neodymum magnet into the side hole of bucket
    • Use long shaft/screw to insert the bucket into the base
    • Plug the reed switch module into base. Final piece of Rain Gauge should looks like this

    Alt text

  2. Libraries: Install the necessary libraries (Wire, RTClib, MKRWAN, SPI, SD) in the Arduino IDE.

  3. TTN Application:

    • Sign up for The Things Network

    • Select your region and create your application on TTN console

    • Plug your Arduino MKRWAN and run a script from Arduino IDE>Examples>MKRWAN>First Configuration, take a note on your DevUI

    • Register your End Device on TTN Console

    • Create a file named arduino_secrets.h on the same folder of Arduino LoRa Transmitter scripts and copy paste your appEui and appKey from TTN Console

      const char *appEui = "0000000000000000";
      const char *appKey = "<APP_KEY>";
      
  4. Upload the scripts of Transmitter and see live data on TTN Console

  5. If you can see your data, congratulations, if not please do see Troubleshooting sections

  6. Install Node-Red on your Raspberry PI or on your PC

  7. Install Node-Red Dashboard library

  8. Import Node-Red json files configuration from Scripts>Node-Red

  9. See the payload on the debug message on Node-red. You can modify or create your own dashboard. Done

Functionality

RTC Setup

  • Sets up and initializes the DS3231 RTC module for accurate timekeeping.
  • Handles RTC power loss scenarios by setting the time using the sketch compilation time if power is lost.

Rain Measurement

  • Monitors rainfall using a reed switch and software debouncing to count pulses accurately.
  • Resets accumulated rainfall at midnight to start afresh.

LoRa Communication and Data Logging

  • Sends rain gauge data via LoRaWAN to TTN at regular intervals.
  • Logs data (date, time, accumulated rainfall) onto an SD card in a CSV format for local storage.

Usage

  • Monitor the Serial Monitor to observe real-time data and system status.
  • Access the rain.txt file on the SD card for detailed logged rain gauge data.

Troubleshooting

  • If encountering issues during LoRa connection, ensure proper positioning for signal reception.
  • Check your appKey and appEui on TTN Console and your aduino_secrets.h
  • Verify wiring connections and component compatibility.
  • Dont forget to attach your antenna

Future Work

  • Use low power library
  • Design a watertight enclosure

Reflective learning

  • Prototype and iterate to make it better
  • Outdoor device needs a waterproof and watertight material

License

This project is licensed under the MIT License.

Credits

  • Dusan DJ for his awesome tipping buckets

Acknowledgements

  • Arduino community
  • Libraries used: RTClib, MKRWAN, SD
  • Node Red

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.