Skip to content

IoT system for data acquisition, presentation and for controlling the lights energy consumption

License

Notifications You must be signed in to change notification settings

KacperSynator/LightEnergyManagementSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LightEnergyMenagmentSystem

The main goal is to gather data about power consumption by led lamps and then reduce that consumption by automated control of the lamp intensity. This project uses four different devices and IoT technologies to accomplish the above goal.

Devices diagram

image

Ref Device Short Description
0 RPI 4B Hosts database, mqtt broker
1 RPI 4B Communicates with ESPs and server
2 A7670E Cat-1 HAT Provides internet connection to RPI and sends data/receives data from server
3 NodeMCU-32 ESP32 Controlls sensors and light
4 PZEM-004T Measures energy consumption of lamp
5 BH1750 Measures intensity of light
6 GLP DIM driver Driver of LED module
7 PIR HC-SR501 Detects presence of people
10 Flutter mobile app App for remote control and data presentation for user

Responsible for controlling led module. Gathers data about power consumption and light intensity using energy meter and light sensor then uses 10V PWM to dim the ligth. Can turn off/on light using relay based on peaople presence that is detected using PIR motion sensor. Measured sensor data is send to LocalRpi via BLE (bluetooth low energy), it acts as a server and sends data when LocalRpi asks for it.

Written in C++ with proto files generated for C.
Used board: ESP32 programmed using PlatformIO.

Responsible for gathering data from LampControllers using BLE and sending it to ServerRpi via cellular network using LTE module. Data is send via MQTT protocol. After receiving the data from LampController LocalRpi adds current timestamp to data. Communication with LTE module is carried out with the help of the AT commands.

Written in Rust
Used board: RPI 4B

Responsible for receivng data data from LocalRpi using MQTT. Stores data in database implemented using sqlite3. Receives data requests from MobileApp using MQTT then fetches data from database and sends it to MobileApp. Hosts mosquitto broker for MQTT.

Written in Rust
Used board: RPI 4B

Responsible for presenting data for user. Used to customize names of devices. Data is presented as graphs for periods specified by user (last month, all time). Communicates with ServerRpi using MQTT.

Written in Flutter

For data serialization protocal buffers are used. It was chosen becauese it is fast and easy to use and it generates code (yaay less typing). Current project state uses 3 messages:

  • Device - name, mac address of device
  • LampData - sensor data and timestamp
  • DataPacket - above 2 in one message
syntax = "proto3";

package light_energy_management_system;

enum MqttCommand {
    UnknownCommand = 0;
    HandleDataPacket = 1;
    GetAllDevices = 2;
    GetDeviceMeasurements = 3;
    GetDeviceMeasurementsBefore = 4;
    GetDeviceMeasurementsAfter = 5;
    ChangeDeviceName = 6;
}

message MqttPayload {
    MqttCommand command = 1;
    repeated bytes msg = 2;
}

enum DeviceType {
    UnknownDevice = 0;
    LampController = 1;
}

message Device {
    string name = 1;
    string mac = 2;
    DeviceType type = 3;
}

message Devices {
    repeated Device devices = 1;
}

enum MeasurementType {
    UnknownMeasurment = 0;
    Illuminance = 1;
    Voltage = 2;
    Current = 3;
    Power = 4;
    Energy = 5;
    Frequency = 6;
    PowerFactor = 7;
}

enum MeasurementStatus {
    Invalid = 0;
    Valid = 1;
}

message Measurement {
    float value = 1;
    MeasurementType type = 2;
    MeasurementStatus status = 3;
}

message DeviceMeasurements {
    uint64 timestamp = 1;
    repeated Measurement measurements = 2;
}

message DataPacket {
    Device device = 1;
    repeated DeviceMeasurements device_measurements = 2;
}

About

IoT system for data acquisition, presentation and for controlling the lights energy consumption

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published