Skip to content

simple electric monitoring with Wemos D1, MQTT, plotly dash and SQLAlchemy.

Notifications You must be signed in to change notification settings

hector6298/smart_electric_monitoring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IoT Smart Electric Monitoring

This project aims at developing devices to measure electric power consumption from other domestic devices simultaneously, then publishing their readings to an MQTT broker, to finally visualize readings on a web page.

Getting started

Clone the repo on your local machine:

git clone https://github.com/hector6298/smart_electric_monitoring.git
cd smart_electric_monitoring

Include your microcontroller model on Boards Manager on your Arduino IDE. Install the following library on Arduino IDE as well:

ArduinoJson

Then install python required dependencies:

sudo pip3 install -r requirements.txt

Now follow these steps:

1.- To recreate the device refer to construction section. Tinier, version coming!.

2.- Open publisherSensor on your arduino IDE, then flash publisherSensor.ino on your wifi-capable microcontroller.

3.- Note that we make use of MQTT communication protocol to publish the power and current measurements of devices being monitored. Therefore you should create an MQTT broker with topics named 'current', 'power', and 'reset'. Please visit ioticos, or emqx cloud, they offer creation of nodes free of charge.

4.- After MQTT broker is set:

cd subscriberWebServer
python3 app.py -broker YOUR_BROKER -port PORT -user YOUR_MQTT_USERNAME -psswd YOUR_MQTT_PASS

5.- Go to: http://127.0.0.1:8050/. There should be a screen similar to this, but at first, the graph should be empty:

Navigate to your user using the drop-down menu above the graph.

More to come!

Construction

Current implementation here is a bit rough. Mainly because it was build with what I had at the time. Materials are:

  • Wemos D1 R1 microcontroller
  • ACS712 30A current sensor
  • Power supply for the microcontroller. (In my case I striped a power supply from its case and cut the wires from the plug and jack)
  • LCD screen
  • Male-Female jumper wires
  • 24 AWG wire
  • A socket
  • A Phase, neutral and ground plug with some cord.
  • Some screw terminals to connect wires.
  • Rocker switch
  • 2 of those plastic boxes where you put electrical stuff.

After you gather all this, connect everything according to this diagram :

That AC-DC box in the drawing is actually the power supply where you connect your microcontroller and the ACS712 sensor to power them.

Some building pics:

Those were the basic internals of the circuit, without the lcd screen. now, connecting the lcd screen and fitting everything inside:

Final product:

Please do not judge me. I am sure you can do something more breautiful, and I as well. Just wait for the next version!