Skip to content

Commit

Permalink
add Neo m8
Browse files Browse the repository at this point in the history
  • Loading branch information
leduynhat committed Jun 1, 2021
1 parent acd33d5 commit 46c08c0
Show file tree
Hide file tree
Showing 288 changed files with 100,489 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
Binary file added data/airsense.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/badaqimeter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/badface.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/extremelybadaqimeter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/extremlybadface.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/goodaqimeter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/goodface.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/greenwifi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/humidity.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/normalaqimeter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/normalface.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/nosd.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/notgoodaqimeter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/notgoodface.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/nowifi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/orangewifi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pm2p5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/press.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/redwifi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/sd.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/sparc.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/temp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/tempcold.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/verybadaqimeter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/verybadface.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/wifinointernet.jpg
211 changes: 211 additions & 0 deletions include/Config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/**
* @file Config.h
* @author Le Duy Nhat
* @date 2020-08-26
* @brief This file contains configuration parameters including hardware pin definition,
* calibaraions of sensors and server things. Those can be adjusted by either user interface
* or server mqtt.
*/

#ifndef _CONFIG_H_
#define _CONFIG_H_

#include <Arduino.h>

// #define _DEMO_VERSION_
#define _VERSION_1_0_0_
#ifdef _DEMO_VERSION_
/**
* @brief SPI configuration
*
*/
#define SPI_MISO_PIN (21)
#define SPI_MOSI_PIN (19)
#define SPI_CLK_PIN (18)

#define SPI2_MISO_PIN (17)
#define SPI2_MOSI_PIN (16)
#define SPI2_CLK_PIN (4)

// #define SPI2_MISO_PIN (23)
// #define SPI2_MOSI_PIN (22)
// #define SPI2_CLK_PIN (25)

#define SPI2_CLOCK_SPEED (500000)

#define SPI_CS_SD_CARD (5)
#define SPI2_CS_OPCN3 (2)

#define PIN_TFT_RST (15)
#define PIN_TFT_LED (14)
#define PIN_TFT_DC (12)
#define PIN_TFT_CS (13)

/**
* @brief I2C configuration
*
*/
#define I2C_SDA_PIN (26)
#define I2C_SCL_PIN (27)
#define I2C_CLOCK_SPEED (100000)

/**
* @brief LED pin configuration
*
*/
#define PIN_LED_RED (25)
#define PIN_LED_GREEN (33)
#define PIN_LED_BLUE (32)

#define PIN_NEO_PIXEL (23)

/**
* @brief Button pin configuration
*
*/
#define PIN_BUTTON_1 (35)
#define PIN_BUTTON_2 (34)

#define PIN_OUTA (4)
#define PIN_OUTB (2)
#define PIN_SWITCH (15)

#endif

#ifdef _VERSION_1_0_0_
/**
* @brief SPI configuration
*
*/
#define SPI2_MISO_PIN (33)
#define SPI2_MOSI_PIN (25)
#define SPI2_CLK_PIN (32)
#define SPI2_CLOCK_SPEED (500000)

#define SPI2_CS_OPCN3 (26)

#define SPI_MISO_PIN (18)
#define SPI_MOSI_PIN (19)
#define SPI_CLK_PIN (5)
#define SPI_CLOCK_SPEED (4000000)

#define SPI_CS_SD_CARD (23)


#define SPI_CS_TFT (2)
#define PIN_TFT_RST (22)
#define PIN_TFT_LED (4)
#define PIN_TFT_DC (21)

#define SPI_CS_EPD (2)
#define PIN_EPD_RST (22)
#define PIN_EPD_BUSY (4)
#define PIN_EPD_DC (21)

/**
* @brief I2C configuration
*
*/
#define I2C_SDA_PIN (15)
#define I2C_SCL_PIN (13)
#define I2C_CLOCK_SPEED (100000)

/**
* @brief LED pin configuration
*
*/
#define PIN_LED_BLUE (12)


/**
* @brief Button pin configuration
*
*/
#define PIN_BUTTON_1 (35)
#define PIN_BUTTON_2 (34)
/**
* @brief SIM808
*
*/
#define SIM_TX_PIN (27)
#define SIM_RX_PIN (34)
#define SIM_PWR_PIN (14)
#define SERIAL_SIM_BAUDRATE (9600)
#endif
/**
* @brief New I2C
*
*/
#define I2C_2_SDA_PIN 14
#define I2C_2_SCL_PIN 27
/**
* @brief Devive parametter
*
*/
#define RESET_PERIOD (2592000000) //30 days
#define SAMPLING_TIME (10000) // 10 seconds
#define DEVICE_NAME "AVA sensor V1"
#define FIRMWARE_VERSION "1.3.3"

/**
* @brief Serial debug enable
*
*/
#define SERIAL_DEBUG_BAUDRATE (115200)
#define _SERIAL_DEBUG_ALL_
#define _SERIAL_DEBUG_DEVICE_MANAGER_
#define _SERIAL_DEBUG_ILI9341_DISPLAY_
#define _SERIAL_DEBUG_MQTT_
// #define _SERIAL_DEBUG_QUEUE_
#define _SERIAL_DEBUG_STORE_
#define _SERIAL_DEBUG_UI_MANAGER_
#define _SERIAL_DEBUG_WIFI_MANAGER_
#define _SERIAL_DEBUG_MAIN_
/**
* @brief Main raw data struct
*
*/
struct DataCore{
// uint8_t MACAddress[6];
unsigned long UNIXTime;
float pm2_5;
float pm10_0;
float pm1_0;
float temperature;
float humidity;
float pressure;
float SO2_WmV;
float SO2_AmV;
float NO2_WmV;
float NO2_AmV;
// float CO2;
float CO_WmV;
float CO_AmV;
float O3_WmV;
float O3_AmV;
double longitude;
double latitude;
};

/**
* @brief Main time struct
*
*/
struct TimeNow{
u_char second;
u_char minute;
u_char hour;
u_char date;
u_char month;
u_int year;
uint32_t unix_time;
};
enum SCREEN_ID {PROGRESS_SCREEN,
MAIN_SCREEN,
MENU_SCREEN,
SETUP_SCREEN,
WIFI_SCREEN,
CONFIG_SCREEN};


#endif
33 changes: 33 additions & 0 deletions include/DS3231_RTC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file DS3231_RTC.h
* @author Le Duy Nhat
* @date 2020-08-26
* @brief
*/
#pragma once
#include "RTClib.h"
#include "Config.h"

#define DS3231_I2C_ADDRESS 0x68

class DS3231_RTC
{
private:
/* data */
RTC_DS3231 ds3231;
// DateTime dt;
TimeNow date_time;
// DateTime date_time;
public:
bool init();
void updateTime();
void setTime(uint32_t _unix_time);
void setAlarm();
void clearAlarm1();
void clearAlarm2();
bool isAlarm1Fired();
bool isAlarm2Fired();
TimeNow getTime();
DS3231_RTC(/* args */);
~DS3231_RTC();
};
Loading

0 comments on commit 46c08c0

Please sign in to comment.