The wifi chip is only used to communicate with the Mqtt broker (the server is refereed to as a broker). There are other ways to visualize the data (for example, just using an LCD screen), but transmitting it to a central server for processing, and analysis is just more convenient from a users point of view. You can use any microcontroller, or even a raspberry pi / odroid. As long as it has analog pins, or a way to read analog signals (with an external ADC perhaps).
A current sensor can then be directly connected to the analog input as
shown. The data can then be transmitted to the broker as
show using this code. The flask server can consist of
this code to receive data, and store it in SQLite. If this is a new territory for you, as it was for me, my suggestion is to first setup your software so that devices can easily be added to it, and then purchase your hardware, and implement you code on that.
- Get MQTT Server Running
- Setup Broker
- Setup Client
- Setup functions that execute commands on payload received
- Setup Database Table
- Learn how to setup sqlite tables
- Learn how to insert, and select data from database.
- Integrate data insertion with mqtt payload received function.
- Configure Web server. I have absolutely no formal experience with web development, so this tutorial series helped me a lot
- Configure data visualization. For me, high charts worked well for large amounts of data
- Configure data visualization updates. (Seems the same as the first, but it is its own challenge)
- Now you should have a web server that displays data sent to it in real time. Now you can setup the client which is the device that will be recording and sending the data.
- Purchase micro controller and sensors from online stores or Carb
- Wait eagerly, as every engineer in South Africa is doing the same, because projects must continue
- Wire up your circuit
- Run your code
- Test
- Now its not safe to test using 240V AC, so to first ensure that your software and code is working correctly, connect the current sensor to a battery circuit, or if you have, a signal generator.
- Data recorded should be shown on the web interface.
- If all works well, cross your fingers, plug it in the wall, and hope nothing blows up
Tedious process to some, I must admit. But what you learn from this is more useful, from a tinkerers point of view, than what I've learnt in my entire engineering degree so far. And this system can also be easily configured to send commands from the web interface, allowing you to control items in your house, and record multiple devices on the same web interface.