Skip to content

Latest commit

 

History

History

LampController

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

LampController

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. Implemented on ESP32 devkit board.

Totally accurate wiring diagram

image

Energy meter

Uses (PZEM-004t v3)(https://innovatorsguru.com/pzem-004t-v3/) for garhering data: voltage, current, power, energy, frequency and power factor. Commenicates via ModbusRTU interface. For handling this device PZEM-004T-v30 library is used.

Light sensor

Uses BH1750 digital sensor with $I^2C$ bus interface. For handling this device BH1750 library is used.

Motion detector

Uses PIR HC-SR501 sensor and digital input pin to read if motion was detected.

Protobuf

Uses nanopb C library. Files are generated manually using protoc and must be put in include and src directories, for convenience use generate_proto_files.sh script.

Generate protobuf files

chmod 777 generate_proto_files.sh
generate_proto_files.sh

Getting Started

Use PlatformioIO to build and install code to board. For convenience use VSCode plugin.