Вы находитесь на странице: 1из 18

IoT Power Measurement Module

PRESENTED BY
RAFID HAMID ABDULRAZZAQ, ABDULLAH WALAA, & AHMED KAMEL
2ND STAGE (EVENING STUDY)
DR. OMAR YOUSSEF
TABLE OF CONTENTS:

INTRODUCTION……………………………………………2-5

SUPPLIES ………………………………………………………5-6

PARTS AND FINALIZING ……………………………………………………6-12

Screw Terminals ………………………7

Resistor Voltage Divider ………………………7

Shunt Resistor ………………………7-8

OpAmp Amplifier ………………………8

Power Supply ………………………8-9

Switch ………………………10

Headers for WiFi ………………………10-11

OLED Display ………………………11

Final Look ………………………12

FTDI Board ………………………12

SCHEMATIC …………………………………………13

RESULTS …………………………14

CODE………………………………………15-17

1
IOT POWER MEASUREMENT MODULE

INTRODUCTION:

The race for sustainable energy implementation into

the actual power generation and distribution systems has

been proved to be the safest and best way to provide, on a

long term, with enough clean energy for the ever raising

demand and securing the future for the next generations.

The effect of this development is the smartification process

of the electrical power system from developed countries

which is mainly focused to the on-grid one, leaving the off-

grid standalone prosumers develop their own behavioral

practices towards power generation and consumption. For

the grid tied consumers, the first step was the

implementation of smart meters followed by energy

management devices such as smart chargers and smart

inverters and finally smart appliances with automated

capabilities for scheduled usage. In the on-grid scenario,

although being necessary, smart meters raised a lot of

2
concerns regarding privacy, cyber security, health safety, fire

hazards and even bill cost related problems. Worldwide,

most of the traditional IT&C and electronics companies

embraced and developed new mobile products and services

regarding home automation and monitoring, to increase

energy efficiency by using embedded electronics with

sensors and the Internet of Things concept as an

evolutionary development of machine-to-machine

communication, since the early „90s. To name a few,

consecrated companies like: Google, Amazon, Microsoft,

Samsung, IBM, Intel, Cisco, Siemens, Bosch, Texas

Instruments, Nokia, AT&T, Hitachi, Huawei, Silicon Labs are

already offering IoT solutions in industry, business and

society for collecting and transmitting data via the internet.

In conclusion, it is not a question of “if” anymore, but more

of “when” all the electronic devices will communicate with

each other on a massive global scale by forming a gigantic

WAN. It is forecasted by the industries, business and trade

3
experts that by the year 2020, about 50 billion devices will

be connected in the Internet of Things communication

network. Cisco also predicted the exponential trend. The

Internet of Things (IoT) is becoming more widely used

technology nowadays. It is often used to refer to the growing

network for connected devices, or “things”, that are capable

of exchange data over on a low bandwidth network. IoT is

being used in various areas, such as automotive industry,

logistics, healthcare, smart grid and smart cities. Recently,

electric energy consumption growth has risen significantly

and thus, needed greatly increased energy supply in the

coming decades due to increasing population and economic

development. This is leading to a demand-supply deficiency.

In many developed countries, automatic meter reading

(AMR), advanced metering infrastructure (AMI) or smart

energy meter with real-time energy information report have

been implemented at the household level. Thus, consumers

will be able to see their usage in real-time, eventually

4
encouraging them to use less energy to save money. In

addition, studies have suggested that more energy can be

saved or decreased in household level with real-time energy

consumption feedback as compared to conventional indirect

feedback like monthly bills. However, those smart meters are

usually high cost and require large amounts of investments

on communication medium infrastructure; hence in many

developing countries, these might not be an efficient and

affordable solutions.

SUPPLIES:

1. Arduino Pro Mini / Nano or equivalent

2. LM2596 buck converter module

3. 7805 voltage regulator

4. AMS1117 3.3V regulator

5. ESP8266-01 WiFi module

6. OLED Display

7. LM358 dual OP-Amp

8. 100K,10K,2.2k and 1K resistors (1/4 watt)

9. 0.1uF ceramic disc capacitors

5
10. 22uF electrolytic capacitor

11. Screw Terminals

12. Male and female berg strip

13. ON-OFF switch

14. Perf board or Vero board

15. Soldering equipment’s

GATHERING ALL THE PARTS AND FINALIZING THE LAYOUT:

Once we have gathered all the necessary components,

it is important that we carefully decide the layout of our

board and placement of different components so that the

wiring becomes simple and all the components placed close

to each other. For attachment of the Arduino, buck converter,

WiFi module and Oled Display using female headers instead

of directly soldering the modules.

6
Adding the Screw Terminals: First of all, we solder the screw

terminals that will be used to connect the solar panels as

input and the charge controller as output to the power

module. Screw terminals provide an easy way to plug in or

remove devices when needed.

Adding the Resistor Voltage Divider Network: For sensing the

input voltage, a voltage divider network is used. For my

application, make a resistor network using 10K and 1K

resistor and I am measuring the voltage drop across the 1K

resistor that will be given as input to the Arduino

microcontroller. Additionally, added a 0.1uF capacitor across

the 1K resistor to smooth out any sudden voltage

fluctuations.

Adding the Shunt Resistor for Current Sensing: The shunt

resistor is a resistor of very small value (typically in the order

of milliohms) in series with the load which creates a very

small voltage drop that can be amplified using an

Operational Amplifier and the output can then be given to

7
Arduino for measurement. For measuring the current, using

the shunt resistor (which has a value of approximately 10

milliohms. made this using a steel wire and bending it to

make a sort of a coil pattern) in the low side of the circuit,i.e,

between the load and the ground. This way the small voltage

drop can directly be measured with respect to ground.

Adding the OpAmp Amplifier Circuit: The operational

amplifier used here is LM358 which is a dual Op-Amp chip.

We will be using only one OpAmp as a non-inverting

amplifier. The gain of the non-inverting amplifier can be set

by using the resistor networks R1 and R2. For application we

chose R1 as 100K and R2 as 2.2K which gives me an

approximate gain of 46. The resistor and the OpAmp are not

perfect so some adjustments have to be made in the Arduino

program to get good readings.

The Power Supply: To supply power to the Arduino, OpAmp,

OLED and WiFi module, using a LM2596 buck converter

module to step down the input voltage down to about 7 volts.

8
Then using a 7805 voltage regulator I am converting the 7

volts to 5 volts for the Arduino and the OLED and using an

AMS1117 regulator, generating the 3.3V necessary for the

WiFi Module. Why so much for the power supply you ask? The

reason being you cannot directly plug in the solar panel to a

5-volt regulator and expect to work efficiently (as it is a

linear regulator). Also nominal voltage of a solar panel is

about 18-20 volts which can be too high for the linear

regulator and can fry up your electronics in a jiffy! So it’s

better to have an efficient buck converter in place.

9
Adding a Switch: added a switch in between the buck

converter and the solar panel inputs, in case I want to toggle

ON or OFF the power module. If switched off, the power will

still be delivered to the load (charge controller in my case),

only the measurement and IoT functions will not work. The

image above also shows the soldering process so far.

Adding the Headers for WiFi Module: soldered the female

headers for the WiFi module just next to where the Arduino

pro mini would fit. The ESP8266 module operates on 3.3

volts and not 5 volts. The Arduino and the WiFi module

communicate via serial communication which utilizes the Tx

and Rx pins of the module. We can configure any 2 digital

pins of Arduino to act as serial pins using the software serial

library of the Arduino IDE. The Rx pin of module goes to the

Tx of Arduino and vice versa. The Rx pin of ESP works on

3.3V logic so we use a voltage divider network of 2.2K and

1K to bring down the 5V logic level of Arduino to

approximately 3.6V (which is still acceptable). We can directly

10
connect the Tx of ESP to Rx of Arduino as Arduino is 3.3v

compatible.

Adding the OLED Display: To connect the OLED display we

need 4 connections, two for power supply and 2 for the I2C

communication protocol with the Arduino which is the A4

and A5 pins of the Arduino. using a small jumper wire along

with male header to connect the I2C pins and directly solder

the power connections

11
Final Look: After finally completing all the soldering process

this is what the board looks like! The interesting part is the

board is completely modular and all major components can

easily be removed or replaced if need be.

Programming Using FTDI Board: For programming this

module, using the FTDI breakout board which is ideal to

program Arduino Pro Mini. Its pin mapping is aligned

perfectly so you won't have to use and jumpers or so.

12
SCHEMATIC DIAGRAM:

This is the complete circuit diagram of the IoT power meter

module.

13
RESULTS:

completed the setup by connecting the power module

between the solar panel and the charge controller and as

soon as we power it up it connects to WiFi router and the data

is being constantly published on the Blynk app on the smart

phone. This gives the real time data of the charging

parameters no matter where you are, as far as you have

internet connectivity. For experimental purpose, we tested

the setup using my 50 Watt solar panel and a 12V 18AH lead

acid battery.

14
ARDUINO CODE:

#define BLYNK_NO_BUILTIN // Disable built-in analog & digital pin operations


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
// You should get Auth Token in the Blynk App.
char auth[] = "*********************************"; // put you blunk auth token here
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "********"; // put your Wifi name here
char pass[] = "********"; // put your Password here
//Software Serial on Uno, Nano, Pro mini...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(9, 10); // RX, TX //Connect TX of ESP8266 to RX and RX of ESP8266
to TX of Software serial.
// Your ESP8266 baud rate:
ESP8266 wifi(&EspSerial);
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
float current=0;
float voltage=0;
void setup()
{
pinMode(A0,INPUT);
pinMode(A1,INPUT);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for
the 128x32)

15
display.display();
EspSerial.begin(9600);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
// Clear the buffer.
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.setTextColor(WHITE);
}
void loop()
{
// taking average for stable readings
for(int i=0; i<20;i++)
{
current=current+analogRead(A1);
voltage=voltage+analogRead(A0);
delay(2);
}
current=current/20;
current=(current*0.068); // calibration value will change depending upon the gain of Op Amp
circuit and resistance of the shunt
if(current<0)
current=0;
voltage=voltage/20;
voltage=voltage*2.485; // calibration constant depends upon the voltage divider network
display.setCursor(0, 0);
display.print("Voltage: ");
display.print(voltage);
display.println(" V");

16
display.setCursor(0, 10);
display.print("Current: ");
display.print(current);
display.println(" A");
display.setCursor(0, 20);
display.print("Power: ");
display.print(voltage*current);
display.println(" W");
display.display(); //you have to tell the display to...display
delay(500);
display.clearDisplay();
Blynk.virtualWrite(V5,voltage);
Blynk.virtualWrite(V6,current);
Blynk.virtualWrite(V7,voltage*current);
}

17

Вам также может понравиться