Coder Social home page Coder Social logo

ghassenelkamel / iot-weather-monitoring Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4 KB

IoT Weather Monitoring This IoT project enables real-time weather monitoring by collecting temperature and humidity data using a Raspberry Pi and DHT11 sensor. The collected data is then stored in a database and can be accessed through a web interface.

C++ 31.60% PHP 55.82% Python 12.58%

iot-weather-monitoring's Introduction

IoT Project README

This project is an IoT (Internet of Things) project that consists of code snippets written in multiple programming languages to enable different functionalities.

Python Code (Raspberry Pi)

The Python code snippet, located in python_code.py, is designed to run on a Raspberry Pi. It performs the following tasks:

  • Imports the required libraries: RPi.GPIO and time.
  • Sets up the Raspberry Pi GPIO.
  • Retrieves data from the Thingspeak API using an API key and channel ID.
  • Parses the response data and checks if a specific condition is met.
  • Controls a GPIO pin based on the condition.

To run the Python code, make sure you have the required libraries installed, update the API key and channel ID, and execute the python_code.py file on the Raspberry Pi.

PHP Code (Web Server)

The PHP code snippets are used in a web server environment. The project includes two PHP files: post_data.php and view_data.php.

post_data.php

The post_data.php file receives HTTP POST data from an ESP32 device, validates the API key, and stores the received data in a MySQL database. It performs the following tasks:

  • Connects to a MySQL database using the provided credentials.
  • Receives POST data, including an API key, from an HTTP POST request.
  • Validates the API key and stores the received data in the database.

To use the post_data.php file, replace the database credentials and host it on a web server.

view_data.php

The view_data.php file retrieves data from a MySQL database and displays it in an HTML table. It performs the following tasks:

  • Connects to a MySQL database using the provided credentials.
  • Retrieves data from the database.
  • Displays the retrieved data in an HTML table.

To use the view_data.php file, replace the database credentials and host it on a web server.

Arduino Code (ESP32)

The Arduino code snippet, located in arduino_code.ino, is designed to run on an ESP32 device. It performs the following tasks:

  • Sets up the DHT temperature and humidity sensor.
  • Connects to a Wi-Fi network.
  • Sends HTTP GET requests to a specified server with temperature and humidity data.
  • Prints the HTTP response code and payload.

To use the Arduino code, make sure you have the required libraries installed, update the Wi-Fi settings and server address, and upload the code to an ESP32 device.

Additional Files

The project also includes additional files such as dht.php, sensor1.php, and index.html. These files are related to storing and viewing sensor data in a MySQL database and displaying it on a web page.

Please refer to the respective code files for more detailed information and instructions on how to use each snippet.

iot-weather-monitoring's People

Contributors

ghassenelkamel avatar

Watchers

 avatar

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.