Ashim Das
- Published on
08/07/2024, 03:50 pm Loading...
Power Tracker - Fullstack Solar Power Tracking App + ESP8266
Tracks realtime power consumption. It measures voltage and current of energy source using sensors, ESP8266 receives the sensor data.
The ESP8266 sends the data to backend server via web-socket connection.
The server keeps track of data and updates the client App in realtime.
Server also tracks data in daily basis, user can retrieve power history at any time. Max and Min power consumption is shown per day.
Addtionally ESP is configured with relay which can be used to switch on-off any load remotely from the client App.
Technologies and hardwares:
Frontend
- React
- Web Socket API for realtime communication
- React Context API
- Apex Chart
Backend
- Express JS
- Web Socket
- JSON for storing data in file system
Hardwares
- ESP8266 development board
- Current Sensor
- Voltage Sensor
- Multiplexer 4051 ESP8266 has 1 analog pin, we have 2 sensors and hence need 2 anolog inputs. So we used a multiplexer IC
- 3.3v IC voltage regulator
- Relay to turn on-off appliences online
- Battery 3.7v Li-ion
- A Load for demonstrating draining power
- Micro USB Cable to program ESP8266
- Solar Panel
- BMS to charge battery by solar
Schematic
Cloning repository to local
git clone https://github.com/45h1m/PowerTracker.git
cd PowerTracker
Now inside PowerTracker folder there are mainly arduino/PT, server and client folder.
Hardware setup & flashing
Note: Arduino IDE should be installed
Download source code for ESP8266 and flash from arduino IDE
Software setup & installation
Prerequisite: Node JS & NPM Installed
Open two terminals
First terminal commands
Go to server
folder:
cd server
Install modules:
npm i
Start server:
npm start
Second terminal commands:
Go to client
folder:
cd client
Install modules:
npm i
run react server:
npm run dev
Note Client app should be available on localhost, check terminal for URL
After getting server and client app ready turn on the hardware
Note ESP8266 will automatically connected to wifi network. change hotspot name and password to
SSID
&password
View Source Code