Arduino & ASP.NET Core Project: Weather Station
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ASP.NET
Arduino
Img
.gitignore
LICENSE
README.md

README.md

Weather Station

Introduction

This project includes an Arduino-based weather station, an ASP.NET Core MVC data presentation page, and an ASP.NET Core WebAPI. The collected data is sent using ESP8266 and written to the SQL Server database via WebAPI. The weather station consists of the following parts:

  • Arduino Nano
  • Nano Shield
  • AM2320 - Digital Temperature and Humidity Sensor
  • BMP280 - Barometric Pressure and Altitude Sensor
  • ML8511 - UV sensor
  • GP2Y1010F45 - Optical Dust Sensor
  • DS3231 - RTC
  • ESP8266 - WIFI
  • SD card module
  • 18650 Li-ion and Charger (Optional)

Most of the referenced libraries come from Adafruit and Aduino Playground, and some I don't know who written it. AM2320 comes from thakshak.

Components

Name Count
Arduino Nano x1
Nano Shield x1
AM2320 x1
BMP280 x1
ML8511 x1
GP2Y1010F45 x1
DS3231 x1
ESP8266 x1
SD card module x1
18650 Li-ion and Charger (Optional) x1
Male/Female Jumper Wires some

Apps

Name
Arduino IDE
Microsoft Visual Studio 2017
Microsoft SQL Server

Arduino Connection

  • I2C Sensors

    • VCC - 5V
    • GND - GND
    • SDA - A4
    • SCL - A5
  • ML8511

    • VIN - 3.3V
    • OUT - A0
    • GND - GND
    • EN - 3.3V
    • 3.3V - A1
  • GP2Y1010F45

    • Sharp pin 1 (V-LED) - 5V (Series 150Ω resistor, pin 1 and resistance connected to 220 μF capacitor and grounded)
    • Sharp pin 2 (LED-GND) - GND
    • Sharp pin 3 (LED) - pin 4
    • Sharp pin 4 (S-GND) - GND
    • Sharp pin 5 (Vo) - A2
    • Sharp pin 6 (Vcc) - 5V
  • ESP8266

    • TX - pin 3
    • RX - pin 2
    • CH_PD - pin 5
    • VCC - 3.3V
    • GND - GND
  • SD Card

    • MOSI - pin 11
    • MISO - pin 12
    • CLK - pin 13
    • CS - pin 10

How to Use

Connect sensors to Arduino.

In ASP.NET Core

  1. Open "WeatherStation.sln" and rebuild solution

  2. In project API, WebPage, open Startup.cs, change connection string

  3. In project API, open Controllers - WeatherController.cs, change token

  4. Open Tools - NuGet Package Manager - Package Manager Console, change Default project to Utility

    in PMC run this

    Add-Migration Initial
    Update-Database
    

    or use SSMS run this SQL

    CREATE DATABASE WeatherStation
    
    CREATE TABLE [dbo].[Weathers] (
        [ID]          INT           IDENTITY (1, 1) NOT NULL,
        [DateTime]    DATETIME2 (7) NOT NULL,
        [Temperature] FLOAT (53)    NOT NULL,
        [Humidity]    FLOAT (53)    NOT NULL,
        [Pressure]    FLOAT (53)    NOT NULL,
        [Dust]        FLOAT (53)    NOT NULL,
        [UV]          FLOAT (53)    NOT NULL,
        CONSTRAINT [PK_Weathers] PRIMARY KEY CLUSTERED ([ID] ASC)
    );
  5. Publish API, WebPage to your server

In Arduino

  1. Copy libraries to x:\Program Files (x86)\Arduino\libraries

  2. Open "WeatherStation.ino"

  3. In Line 134, replace your WIFI name and password

  4. In Line 139, replace your server address and port

  5. In Line 150, replace your Token

  6. In Line 155, replace your Host

  7. Upload program to your Arduino

Demo Page

http://weatherstation.zhangyue.xin/