Design and realization of an open‐source and modular smart meter

This paper presents the design of a modular and open‐source smart meter for educational and research purposes. The smart meter monitors the energy consumption, uploads the data to a cloud server, and can be used to control appliances remotely through a control relay. Using the Internet of Things (IoT) technology, the smart meter acts as a sensing node in a meshed network. This enables consumers to visualize their energy consumption profiles at the level of appliances and to take control actions to manage efficient energy consumption using the automation platforms or IoT with smart meters. In this paper, the energy consumed by different electrical appliances is computed and communicated to a server using the Arduino Uno board aided by the ESP8266 WiFi module. The energy consumption is also displayed on an LCD screen, and the consumption profiles are displayed through the home energy monitoring website “EmonCMS.” The design can accommodate different transducer ratings with single‐phase and three‐phase measurements by configuring itself automatically using the plug‐and‐play approach. The realization of the proposed smart meter is a multicourse educational project that aims to polish students’ skills in applying the knowledge gained in Electrical Engineering (ie, undergraduate courses) to produce a practical application.


| INTRODUCTION
The electrical engineering curriculum at Qatar University (QU) has a rich variety of fundamental engineering courses specially designed for enhancing the Accreditation Board for Engineering and Technology (ABET)a-k student outcomes. 1,2 Often, students fail to figure out the relationship between the topics presented in different courses. However, in the senior year, students take their Senior Design Project (SDP) courses that are split over two consecutive semesters. Most projects seek to integrate skills and knowledge attained throughout the previous years of studies. This paper presents an example of an SDP that succeeded in showing the students the link between the different subjects they have covered in different fundamental courses they took during their sophomore, junior, and senior levels. The project is about the design and realization of an open-source and modular smart meter. This project requires knowledge integration of mainly the following courses: electric and electronic circuits, sensors and instrumentation, embedded systems, digital signal processing, and basic knowledge in power systems. This gives the students an opportunity to correlate and link different concepts to work, which is aligned with most of the a-k student outcomes defined by ABET.
In order to cope with existing technologies and to be able to contribute to the future development of the technology of smart metering, several leading academic and research institutions have started including the smart meter design and technologies in their electrical engineering curricula and research programs. QU is one of these institutions that introduces topics such as Advanced Metering Infrastructure (AMI) and smart grid, [3][4][5][6][7][8][9] to graduate future engineers to be more knowledgeable and trained on the 21 st century grid technologies. Moreover, Qatar is moving toward developing a new electric grid infrastructure to enable smartness. 10 With a smart grid, building's energy management is becoming smart, as energy is being monitored and controlled simultaneously and continuously. [11][12][13] Smart building is a technology that enables the building's electronic devices to act "smart" or more automated. 14 New technologies give electric appliances the ability to be networked through the Internet, to communicate with the consumers and even with manufacturers. 15 Added to that, smart buildings have equipment capabilities beyond the buildings' four walls. They are connected to the smart electrical grid, and they interact with building operators and occupants to provide them with different information related to the level of comfort, security, and energy use. 15 This is achieved through systems with a massive number of automated sensors to sense electrical and nonelectrical parameters. Electrical parameters are classified into basic parameters and derived parameters. The basic parameters are voltage (V) and current (I), while derived parameters could be ative power (P), reactive power (Q), power factor (PF), energy (E), total harmonic distortion (THD), and frequency (Hz). 16 Moreover, nonelectrical parameters could be measured using special transducers to sense heating, ventilation, and air conditioning (HVAC) parameters like temperature, humidity, carbon dioxide, and airflow. 17 Moreover, recent works have proposed smart school building structure to reinforce the education sector on promoting efficient energy usage. [18][19][20] Smart meters are used to manage energy consumption by controlling the switching of different electric equipment over different times of the day based on energy analysis and loads' profiles. 21 Furthermore, Internet of Things (IoT) has a prime rule in making the monitoring systems in smart buildings into an efficient energy management systems. 14,[22][23][24] Often, smart meters establish WiFi communication to push data to a server and to share data with other meters. 11 Several works have tackled smart meter scope through investigating energy management system for residential appliances. In, 25 a smart meter called SHEMS is presented for smart grids educational purposes. SHEMS aims to enhance students' critical thinking and utilize their knowledge through undergraduate studies to apply it in a multidisciplinary manner. In, 26 a mechanism is proposed for real-time scheduling with user control of residential appliances. In, 27 an autonomous user-controlled energy management system is presented by using load forecasting. In, 28 a smart home controller design is proposed that suggests for the end-user the recommended operation time of the smart appliances under some constraints to optimize the energy usage. In, 29 an enhanced decision-support tool is presented to optimize the energy usage for domestic consumers. Additional works on the area of the smart meter are available in 30 and. 31 However, this paper aims to present a smart meter design for educational purposes that can be easily accessed and developed by students thanks to its modular and opensource configuration. Besides, the paper implements Fourier series expansion for calculating the fundamental components and THD factors of the measured voltage and current furthermore to energy monitoring. In addition, it is desirable to elaborate and tackle the importance of the undergraduate SDP hands-on experience with the proposed smart meter design.
Several residential smart meters available in the market nowadays are mainly configured to measure only the current, assuming that the root mean square (RMS) voltage is fixed at a certain standard (i.e., 240 V for single-phase loads or home appliances). This limits the accuracy of the measurements by not representing the actual consumption, as the voltage from the grid is actually fluctuating. 32 This paper proposes an open-source and modular smart meter based on the measurement of both the voltage and current while being flexible for future upgrades for educational purposes. In addition to achieving better accuracy by the estimation of power and energy through simultaneous measurement of current and voltage, additional parameters are also calculated. Therefore, the main contribution of this paper is to provide the design and implementation of a smart meter platform with open-source and modular structure as an educational tool to provide a flexible interface for future updates, that is while emphasizing on the importance of the knowledge gained and experienced at the undergraduate level.
The structure of the rest of the paper is as follows. Section 2 presents a general overview of the smart meter management system. Section 3 provides the proposed design structure of the open-source and modular smart meter. Section 4 elaborates on the implementation of the proposed design. Section 5 presents the testing results of the implemented smart meter and reflects on the significance of this SDP for the undergraduate level. Finally, section 6 gives an overall summary of the presented work.

| 1407
electricity consumption is growing drastically, energy monitoring and control is very fundamental. 15 This is achieved through the use of smart energy metering systems. The energy metering systems consist of smart meters coupled with smart switches connected to electric appliances. Smart meters are devices that collect and measure data at a particular time intervals, communicate electric energy consumptions, and take control actions remotely. 33 Nowadays, smart metering systems are referred to as AMI. 33 AMI is an infrastructure that includes smart meters, communication networks, and meter data management Systems (MDMS) for data analysis and storage. 34 Basically, smart meter topology is based on an advanced hybrid device that allows tele-metering of household power consumption data through the combination of measurements, processing, and recording supported with communication networks as shown in Figure 1. 35 Mainly, the signal acquisition for voltage and current is done through transducers. Signals are processed, conditioned, and digitized through the analog-to-digital converter (ADC) stage. 35 The internal design of the smart meter consists of the power system, the main microcontroller unit (MCU), and communication interfaces. 35 MCU is used for generating energy measurement computation from the acquired and processed voltage and current signals. 35 A communication interface is used to allow data exchange between the smart meter and other metering devices.
For smart meters, the term smart is associated with the ability of the device to make decisions and to take actions to manage energy consumption through loads' switching. The switching of the loads can be also controlled by the smart meter or through a mobile application for smart automation systems. 36 On the other hand, the term meter is associated with the energy measurement capabilities of the device and its ability to establish bi-directional communication between two endpoints. Energy measurements include voltage (Volts), current (Amperes), PF, active power (Watt), reactive power (VAR), energy (kWh), and total harmonic distortion (%).

| Internet of things (IoT)
IoT technology enables a set of physical objects, sensors, and actuators to be connected through a common network. 37 In the few past years, IoT has grown promptly in research and especially in domains related to smart environments that include smart buildings, smart cities, and smart grids. 14 In this context, IoT is used to integrate smart transducers and sensors through the Internet given that each device occupies an Internet Protocol (IP) address as a unique identifier. 11

| Smart buildings
Buildings from the Stone Age until today serve the hosting of comfortable environments for different purposes like residency, work, education, or any other. 14 However, the overall design and construction of buildings have dramatically changed from shelters made of stones and animal skins into buildings made of strong bricks. Then, the buildings developed into skyscrapers touching the clouds and recently into smart buildings controlled remotely with a click. 14 Figure 2 illustrates an example of a smart building that has a network of deployed smart switches and IoT sensors which both can be controlled through smart meter by the user.
The devices are linked to a server through a communication network. Smart buildings are equipped with distributed IoT sensing networks that are continuously monitoring energy consumption details and keep storing this data on a server. 14 Moreover, the energy consumption data can be visualized and analyzed to help the users to minimize the building's energy consumption. This could be achieved by following different schemes like scheduling the use of home appliances based on the peak times of energy consumption. 21 Consequently, residents will be able to have control and management over their electricity consumption that will reduce the cost of bills and minimize the carbon footprint of the building. 14 F I G U R E 1 Smart meter functional block diagram

| Real-time data measurement and analysis
In smart buildings, a large number of devices are interconnected; consequently, a massive amount of data called "Big Data" is being generated. 38 Such systems possess analysis of data through real-time or near real-time data analytics. 38 In fact, the term "realtime" means the immediate use and processing of data once it arrives. 39 For an accurate design of smart metering systems, the sensed data are used for energy computation and exchange based on real-time data analysis, communication, and display. 14

AND ARCHITECTURE
This section tackles the essential design issues required to be considered in the implementation of an educational purpose residential smart meter, that is, while considering the issues encountered for the development of the architecture presented in section 2 (ie, as shown in Figure 1).

| Design constraints
When designing a smart metering system, there are many challenges that are multifaceted in nature. The first and the most challenging constraint is to clearly identify the needed features in smart meter based on the application requirements. For instance, smart meters for residential applications have totally different design spectra when compared to smart meters needed for industrial or utility applications. 40 The following sections represent the key points that need to be considered when designing the smart meter for educational purposes at QU.

| Design modularity and open-source
Generally, designing modular and open-source metering system is for achieving meters' deployment for long life with flexible functionality. 41,42 This will ensure the modularity, reliability, and scalability of the smart meter to accommodate the addition of new features. Some requirements need to be set before defining the architecture of the hardware and software design of the smart meter. The smart meter designed in this paper is dedicated to research use in QU laboratories. Developing an application for educational and research purposes is a challenge since the product should be user-friendly and easy to be used and developed by students or researchers. For instance, the students can have accessibility to the microcontroller code and they can compute different desired parameters by using the obtained data from the smart meter. Moreover, users can add or remove modules, peripheral devices, or sensors as desired, while having flexibility with single-phase and multiphase loads.

| Communication protocols
Communication networks can have a home area network (HAN), neighborhood area network (NAN), and wide area network (WAN) as a communication link between the several interfaces within the smart meter system. 43 In this paper, the usage of the smart meter is limited to a laboratory room in QU; consequently, this limits the coverage area and data rates for the wireless communication between the main unit and the smart transducers. Thus, HAN coverage area and data rate protocols are suitable for this design. 44 The commonly used technologies for HANs are Zig-Bee, Power Line Communication (PLC), Z-wave, and WiFi. 43 Establishing a HAN communication link can provide interaction between the smart meter and smart appliances, microcontroller unit, and other meters, that is, through using a communication protocol that exists of various types as shown in Figure 3. Moreover, as the designed smart meter is aimed to communicate with IoT technology, WiFi and Ethernet make up suitable communication protocols. The selection of the smart meter communication protocol can be modified according to the user requirements due to the modularity and open-source design construction (e.g., select a communication protocol compatible with the used MCU).

| Instrument characteristics and specifications
When selecting electrical equipment, commercial comparison of available instruments in the market and instrument evaluation is done and quantitative criteria for the performance of instruments are required. The most important technical characteristics of instruments for performance evaluation can include accuracy, operating range, response time, sensitivity, resolution, and linearity. 45 In particular, this applies to the selection of the voltage and current transducers for the signal acquisition stage of the smart meter. Additional parameters to be considered during the selection of the transducers could be electrical constraints, mechanical constraints, thermal constraints, and environmental conditions. 45 Although there are many types of transducers that can be used to measure basic electrical parameters, the selection of the most suitable transducer for any measurement depends on the fulfillment of some criteria to the design requirements. The common voltage measurement methods are voltage divider, 46 voltage transformer, 47 optocoupler, 48 sigma-delta, 49 and Hall effect 50 voltage transducers, while the common current transducers are shunt resistor, 51 current transformer, 52 Hall effect, 50 Rogowski coil, 53 optocoupler, 48 and sigma-delta 49 current transducers. The selection of transducers types is elaborated in the prototype design in section 3.2.

| MCU limitations
The MCU should have flexible processing capabilities, sufficient storage, and an interface to connect to different types of transducers and sensors. In addition, for modularity, it should F I G U R E 5 Overall smart meter proposed model be able to accommodate various communication protocols, and capable of one-to three-phase measurements. However, only single-phase measurement is tackled in the proposed design. The same approach can be used for three-phase metering. Moreover, the design is targeted for educational purposes, in particular, the undergraduate level. Therefore, the MCU programming platform needs to be user-friendly with moderate programming language level.

| Power quality requirements
Power quality measurement is a very critical requirement in metering systems design. Harmonic distortion is an unavoidable phenomenon that can highly influence the quality of measurements as the power signals waveforms can have completely distorted patterns that make sine waves not distinguishable. Harmonic components are all components of order greater than one of the Fourier series of a periodic wave. 54 In a signal, the amount of contribution of nonfundamental harmonic elements to the distortion of the signal is calculated using the distortion factor (DF) or the THD. 54 The THD is measured from the ratio between the root mean square of all harmonics and that of the fundamental element. As the designed meter is for residential local use, the power quality is highly affected by singlephase higher order harmonic distortion. The single-phase harmonic distortion is resulting from the different distorting loads that can be connected to the power supply. 55 The main contributors to single-phase harmonic distortion in this design are household appliances with sophisticated electronic control like washing machines. 55 This analysis is very essential, especially for metering applications.
To monitor the quality of the measurements and to define tolerable limits for the THD for both current and voltage waveforms, IEEE 519 standard for harmonics distortion limitation is obeyed by the design. The IEEE 519 standard has a threshold voltage harmonics for power systems with voltages ≤69 kV, which is typically THD of 5% with each individual harmonic limited to 3%. 55 This standard can be implemented in the smart meter as an alert system when exceeding these limits.
Each constraint plays a vital role in achieving the required design. In the next section, the prototype design of the proposed smart meter design is elaborated while addressing the above design constraints. That includes the design modularity, open-source interface, communication protocol and IoT

| Hardware design
Hall effect current sensor is selected as a current measurement method to be used with the smart meter. This is due to its high linearity, fast response, and compatibility with the design of metering devices. Added to that, Hall effect transducers are very robust to external interferences due to galvanic isolation. 50,56 On the other hand, a voltage transformer is used as a voltage measurement method. The most significant feature of the voltage/potential transformer is that it provides a very good electric isolation that is needed to isolate the input circuit from the output circuit which ensures safety. 47,57 Additionally, it has lower losses compared to other voltage measurement methods. Also, it provides the required voltage range measurement suitable for QU laboratory. In the designed smart meter, the Hall effect current sensor ACS712 58 and the voltage transformer ZMPT101B 59 are used due to their compatible ready-made modules/ shields that can be easily deployed with the Arduino MCU.

Parameter Equation
No.

RMS
Where V RMS and I RMS are the root mean square voltage and current, respectively, over one period. N s is the number of samples over one period. V si and I si are the ith voltage and current sample, respectively, for i = 1,2, …, s.

Fourier Series
Where f(t) is a periodic signal corresponding to the voltage and current signals with n harmonics. w o is the fundamental angular frequency. T o is the fundamental period. Δt is the discrete time sample period. t is the time axis such that t i+1 = t i + Δt with the initial time t i .
Power Factor (PF) PF = cos(θ) Where θ is the angle between the fundamental voltage and fundamental current signals in degree computed by Fourier series.
Active Power (P) Energy (E) Where V(t) and I(t) are the instantaneous voltages and currents.

Total Harmonic Distortion (THD)
Where V n is the RMS voltage (i.e., the voltage signal with harmonics) and V 1 is the RMS fundamental harmonic computed by Fourier series. I n is the RMS current (i.e., the current signal with harmonics) and I 1 is the RMS fundamental harmonic obtained by Fourier series.
The switching relay controls energy consumption either manually by using Arduino sketches or remotely by the user through a mobile application. However, only the manual switching control is implemented and presented in this paper.
Arduino Uno is used as an MCU for the smart meter. This is due to its simple programming with Arduino compiler, easy start-up, user-friendly, and available peripheral libraries. In addition, it has additional ADC channels in case it is desirable to extend the design to three-phase measurements.
ESP8266 is used as a WiFi module, which is a low-cost IoT platform with integrated TCP/IP protocol stack and 32-bit low-power central processing unit (CPU). ESP8266 can be easily programmed to allow data exchange between Arduino and IoT cloud. 60

| Software design
EmonCMS is used as an open-source IoT platform designed by Open Energy Monitor for data logging and visualization. 61 The Open Energy Monitor system is capable of monitoring electrical energy consumption, humidity, and temperature. 61 Moreover, the system consists of five main units that can be listed as EmonTx, EmonPi, EmonTH, EmonBase, and EmonCMS. 61 These units can be configured to work on different applications. 61 Additionally, the Open Energy Monitor is a completely open-source system on both hardware and software basis. 61 This feature allows EmonCMS to be used with any hardware setup other than those of Open Energy Monitor. In the proposed design, EmonCMS is used as an IoT cloud or server. Basically, the metered data are being uploaded to the cloud by configuring the ESP8266 WiFi module to send data from the smart meter to a WiFi router. The WiFi router acts as an intermediate stage that sends the data in a form suitable for reception by EmonCMS. Moreover, since the theme of IoT is to enable high interconnection between smart tools and the user, hence, the smart meter is alike. Figure 4 shows a simplified representation of the proposed design for the smart meter network, while Figure 5 demonstrates the overall proposed design model for the smart meter.
The proposed design ideally should allow the user to control the switching of any load remotely over the Internet using a simple mobile application, that is, by two-way communication between the mobile application and the IoT platform. Once the user wants to switch ON or OFF the load connected to the meter, that is done simply by a click, the server will communicate this to the meter to switch ON or OFF the load.
As shown in Figure 5, the meter is equipped with voltage and current transducers, WiFi module, LCD display screen, and switching relay controlled through the Arduino board. The voltage transducer measures single-phase main voltage as standardized, which is 240 V ± 10% for 50 Hz. Also, the current transducer measures the current drawn by a single-phase load up to 30 A. Both voltage and current measured signals are processed and acquired by the Arduino as conditioned analog inputs. The ESP8266 is programmed to push the data to the router that sends the data to a server where it is logged and displayed. Moreover, the ESP8266 can send processed data back into the Arduino. Added to that, a mobile application can be used to interface between the IoT platform and the smart meter. This enables the user to send switching commands over the Internet to the relay to control the energy consumed by a certain appliance.

| Hardware implementation
The schematic diagram and the implemented hardware design for the smart meter are presented in Figures 6 and 7, respectively. As shown in Figure 6, the voltage transducer is connected across the load while the current transducer and relay shield are connected in series with the load. The Arduino shield is programmed using a simple code.
As shown in Figure 7, the transducers, ESP8266, and LCD are all supplied by the Arduino Uno board, while the Arduino board is supplied through a Universal Serial Bus (USB) port from the grid using a mobile battery charger that converts 240 V alternating current (AC) input into 5 V direct current (DC) output at 1 A output current. The voltage and current transducers are calibrated as shown in Figures 8 and 9.
The calibration curves are obtained by applying a range of voltage 240 V ± 10%, and current in a range of 0-6 A with a resistive power load. The voltage and current transducers introduce offset to their output according to their datasheets and practical experiment. To obtain a direct relationship between the inputs and the outputs of the voltage and the current transducers, the output voltage from the transducers is recorded with two extreme points. Linear interpolation is used between the output voltage from the transducers without offset and the input voltage from the AC mains, and the input current flowing through the load is measured through suitable probes and a Tektronix oscilloscope (MDO3024). Then, the obtained best-fit equations are determined in Excel software. For more accurate interpolation, the output of the transducers is processed through Arduino Uno and displayed on the LCD by programming Arduino to display the voltage and current values directly after the ADC conversion without the calibration equations. Then, the displayed values on the screen, which correspond to the output from the transducers without offset, are interpolated with the input voltage and current.

| Software implementation
The implemented software allows access to the source code that enables the users to visualize the process of signal acquisition and processing through Arduino Uno and to enable the user to interfere and modify the source code as desired.
In other words, this open-source feature enables the users to have hands-on experience with smart meter functionalities and allows further updates to the system.
The signals acquired from the voltage and current transducers undergo signal processing or digitization by Arduino's ADC. Real-time reading of the voltage and current signals is processed and converted back to analog values through the following equation.
where N is the resolution of the ADC in bits. The full-scale voltage is the maximum voltage operation allowed by the ADC of Arduino Uno.
The measured current and voltage signals along with the time are used to calculate the electric power, electric energy, power factor, and THD for the current and voltage. The measured parameters are displayed on the screen of the meter and communicated through WiFi communication to the EmonCMS IP, for remote monitoring and processing of the meter measurements. Arduino Uno carries out all of these tasks as elaborated in the flowchart shown in Figure 10.
The full-cycle complete condition shown in Figure 10 is determined by computing the number of samples required for 50 Hz, such that the condition reads specific numbers of samples for the voltage and current corresponding to 50 Hz. The ESP enables the communication between Arduino and EmonCMS through the WiFi router. This is achieved by programming the ESP to enable data exchange between the Arduino and the IP address of EmonCMS.
The mathematical equations 62 for the computation of the parameters that is performed by Arduino for both voltage and current signals are listed in Table 1. The equations of the Fourier series permit obtaining the fundamental element from a distorted periodic signal f(t). For the fundamental element, the signal's amplitude and angle are obtained as follows. where a 1 is the real part of the signal and b 1 is the imaginary part of the signal. Such that for the fundamental voltage signal, the amplitude is defined as , and for the fundamental current signal, it is defined as For the fundamental voltage signal, the phase is defined as , and for the fundamental current signal, it is defined as

| Implementation results
The proposed smart meter is tested with the following loads: variable power resistor, light bulb, fridge, and heater. The calculated parameters and the energy consumption profile for these loads are computed and shown through the EmonCMS interface. In addition, a comparison is presented for the proposed smart meter and the power quality analyzer HIOKI.
The designed smart meter is tested at a QU laboratory with variable resistive power load set at 50 Ω and input single-phase voltage from the AC main, as shown in Figure 11.
The input voltage and current waveforms from the AC mains and the output of the voltage and current transducers are shown in Figure 12. 'It is noticed that there is a significant phase shift of 25° between the input voltage from the AC mains and the output voltage from the voltage transducers as shown in Figure 13. This phase shift is due to the conditioning circuit of the used voltage transformer transducer, ZMPT101B. It is included and considered in the calculation of the phase angle, θ, between the voltage and current. The outputs from the transducers are processed through the ADC of Arduino, and the electrical parameters are computed and displayed on the LCD as shown in Figure 11. Then, these computed measurements are communicated via WiFi and the Internet to the EmonCMS cloud server by using a specific coding script that includes information about the server IP address and the application program interface (API) key of the cloud account. The data communicated to the cloud server are continuously logged and can be displayed on any web browser using a user-tailored dashboard that can be easily designed by the user. For instance, the load profile with the measured electrical parameters can be viewed and monitored continuously, as shown in Figure 14.
There is a slight delay between the LCD and EmonCMS server parameters' display, which is due to the time taken by the ESP to send the parameters to the cloud server, compared to the LCD that is displaying the measured values instantaneously.

| Benchmarking of the results
To validate the results obtained from the proposed smart meter design, a power quality analyzer HIOKI is used to measure the same electrical parameters as computed by the smart meter. An inductive load is used, the power factor is varied, and the measurements from the smart meter and the power quality analyzer are both recorded and compared. The percentage error between the two measurements is computed for the electrical parameters with a range of power factor variations shown in Table 2.
The electrical parameters obtained from both measurements are almost accurate and precise. In addition, to verify the measurements obtained with the 50 Ω resistive load, the power quality meter measurements are taken simultaneously with the proposed smart meter. The energy consumption profile and electrical parameter measurements obtained by the quality meter are shown in Figure 15 which were recorded in simultaneous to the designed smart meter results presented in Figure 14.
Due to connecting the current probe of the quality meter in the opposite direction, it can be noticed that the power factor, real power, and the energy consumed are shown in negative; however, the obtained values are close to the designed smart meter. Furthermore, calibration is required to improve the accuracy of the designed smart meter. For further testing, a commercial light bulb of 60W is used as a load. The electrical parameters are communicated to the EmonCMS server with the parameters profile shown over a certain time duration as presented in Figure 16. It can be observed that the variation in the energy consumption profile is not significant due to the small current drawn by the light bulb. Thus, it takes some time to have a change over the energy consumption profile.
Moreover, the implemented smart meter is used to measure the energy consumption of a Samsung Twin Cooling Plus smart fridge. This fridge uses smart cooling technologies through a digital inverter that automatically adjusts the compressor's performance using minimal energy. 63 The proposed smart meter is used to monitor the fridge, and the metered data are communicated to the EmonCMS server as shown in Figure 17. In addition, the energy consumption profile for 3 days is logged as shown in Figure 18, such that the data metering starts from the middle of January 11.
As observed from Figure 18, the energy profile looks reasonable and clearly showing the cumulative trend of energy consumed by any load. Moreover, it could be noticed that the energy consumed per day is almost 4 kWh which tends to be consumed mostly during peak hours that was observed to occur between 7:00 am and 10:00 pm on weekdays. It can also be observed that the fridge has consumed a relatively small amount of energy due to the fact that fridges tend to consume smaller amounts of energy for cooling in winter. 64 A heater is used for testing the proposed smart meter. The heater power is rated between 1800 and 2000 Watt. The energy consumption profile and the electrical parameters for the heater are shown in Figure 19.
After running the heater for 2 hours, the heater is adjusted to produce more heat and it can be seen that the power curve has increased significantly approaching the rated power.
The smart meter design was modified as a wall outlet adapter 3D printed case and a compact PCB designed over an Arduino Uno shield as shown in Figure 20 below.

| Educational outcome of the undergraduate SDP
This SDP is seeking to polish students skills in applying the knowledge gained from the electrical engineering curricula from the freshman to the junior years including the senior year to produce useful practical applications, study dilemma from an engineering perspective, and propose solutions for these problems. To produce this paper, the students went through an in-depth literature survey, different search engines and electronic databases, various design and research methodologies, use of advanced electronic instrumentation systems along with signal processing and communications engineering, and simulation using advanced programming and software applications. Moreover, the students went through the design of analog circuits and embedded circuit using appropriate efficient electronic equipment and clear coding, producing a highly technical and professional academic report, improving effective professional written and oral communication skills, and contributing to the improvement of advanced scientific and research methods. The SDP of the Electrical Engineering Department at Qatar University is expanded over two consecutive semesters. Commonly, the SDP is a group project (i.e., in case of this paper two students were involved). The focus of the first semester is on the literature review and determining the goals of the SDP topic. While the SDP topic is developed into a hands-on experience objective through the second semester, the ultimate objective of this paper is to deliver an opensource and modular smart meter design for future students' usage. Therefore, the students went from a complex design as presented in 65 to the design presented in this paper. In addition, it is desired from this paper to express the accomplishment of a successful SDP as a future reference for the undergraduates.

| CONCLUSION
To summarize, this paper presented a design and implementation of an open-source and modular smart meter for educational purposes at QU. The proposed smart meter design was approached with the knowledge attained during the undergraduate electrical courses, mainly with the integration of the courses related to sensors, embedded systems, programming, and electric power as the followings: sensors and instrumentation, embedded systems, digital signal processing, and power systems. A smart meter with its bi-directional communication capabilities has a significant impact on energy management and control systems intended to reduce energy consumption and benefit both the utility and the users.
The design was implemented, tested, and validated by benchmarking the results with those obtained with a calibrated and certified power quality analyzer. The testing and validation were conducted with resistive and inductive power loads. The errors measured for all parameters were very small which validate the accuracy of the designed smart meter. In addition to its conventional energy metering functionality, the proposed design integrates new features such as harmonics analysis by implementing Fourier series expansion method for calculating the fundamental components as well as the THDs of the measured voltage and current waveforms. The computed electrical parameters were successfully communicated via WiFi to the EmonCMS cloud server, where they are logged and displayed using customized dashboards.
For education purposes, the open-source and modularity implementation provide a friendly interface to students and researchers, with high flexibility by allowing future reconfiguration or updating of the design to meet future user requirements. Therefore, it is considered an important educational tool for students to develop their hands-on multidisciplinary experience and to test their knowledge and to understand the functionality of each element of the smart metering system.

ACKNOWLEDGMENTS
This project was made possible by UREP grant # UREP19-017-2-007 and by NPRP grant NPRP(10-1203-160008) from the Qatar National Research Fund (a member of Qatar Foundation). The statements made herein are solely the responsibility of the authors.