Next Article in Journal
Recent Studies on the Environmentally Benign Alkaline-Earth Silicide Mg2Si for Middle-Temperature Thermoelectric Applications
Previous Article in Journal
The Influence of Diethylaniline and Toluene on the Streamer Propagation in Cyclohexane between a Point-Plane Gap under Positive Impulse Voltage Stress
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Low-Cost, Open-Source Peer-to-Peer Energy Trading System for a Remote Community Using the Internet-of-Things, Blockchain, and Hypertext Transfer Protocol

1
Department of Electrical and Computer Engineering, Memorial University of Newfoundland, 230 Elizabeth Ave, St. John’s, NL A1C5S7, Canada
2
BC Hydro, Transmission Lines Engineering, 6911 Southpoint Drive, Burnaby, BC V3N4X8, Canada
*
Author to whom correspondence should be addressed.
Energies 2022, 15(13), 4862; https://doi.org/10.3390/en15134862
Submission received: 29 May 2022 / Revised: 26 June 2022 / Accepted: 28 June 2022 / Published: 2 July 2022

Abstract

:
A low-cost, open-source peer-to-peer (P2P) energy trading system for a remote community is presented in this paper. As a result of its geographic location, this community has never been able to access electricity and other modern amenities. This study aims to design and implement a P2P energy trading system for this remote community that allows residents to take advantage of distributed energy resources. A Raspberry Pi 4 Model B (Pi4B) hosts the main server of the trading system that includes the user interface and a local Ethereum blockchain server. The Ethereum blockchain is used to deploy smart contracts. The Internet-of-Things (IoT) servers run on ESP32 microcontrollers. Sensors and actuators connected to the ESP32 are field instrumentation devices that facilitate acquiring, monitoring, and transferring energy data in real-time. To perform trading activities, React.JS open-source library was used to develop the blockchain-enabled user interface. An immutable blockchain network keeps track of all transactions. The proposed system runs on a local Wi-Fi network with restricted authorization for system security. Other security measures such as login credentials, private key, firewall, and secret recovery phrases are also considered for information security and data integrity. A Hypertext Transfer Protocol is implemented for communication between the servers and the client. This explains the overall system design, implementation, testing, and results.

1. Introduction

Electricity serves as a necessity in a variety of aspects of life and is, therefore, one of the basic amenities of modern civilization. It is impossible to imagine improving the quality of life without electricity. With the rapid advances in technology, social well-being cannot be envisioned without electricity. Modern hi-tech life relies heavily on electricity. Undoubtedly, people today can enjoy all the necessities of life, such as watching TV, turning on their laptops, using the internet, having heating or air conditioning, etc. However, it is not elusive that there are people worldwide who lack access to electricity. The World Bank estimates that 13 percent of the world’s population did not have access to electricity in 2019 [1]. Growing percentages are witnessed in developing and underdeveloped countries.
Regarding Pakistan, 75.4 percent of the country’s population has access to electricity [2], and for rural areas, it stands at 60.8 percent. This percentage remained at 59 percent from the year 2000 to the end of the year 2019 [3]. The huge population of Pakistan living without electricity underscores the need for alternative energy solutions. Considering Pakistan’s immense photovoltaic (PV) generation capacity, electrification of remote areas can be best achieved with off-grid photovoltaic systems. In the context of remote communities, this is particularly true, where power is not available through the national grid. In this research, we have designed a low-cost, open-source Peer-to-Peer (P2P) energy trading system for a remote community in Pakistan. The people in the selected community do not have access to electricity, thereby isolating them from the modern world.
Raspberry Pi 4B is employed as the main server of the proposed system, making it a low-cost system. Several low-cost servers have already been developed on Raspberry Pi devices. Raspberry Pi has proven useful for the development of servers and technologies as a low-cost device [4,5,6]. The authors in [4] developed a low-cost SCADA system based on Rasberry Pi. The claim of Raspberry Pi as a low-cost single-board computer is supported by authors in [5], where the authors developed low-cost point-of-care technologies for cervical cancer prevention using Raspberry Pi.

2. Literature Review

A comprehensive literature review has been conducted during the course of this research, and some of the useful literature reviewed are set forth. In [7], considering the energy crisis in Pakistan, the authors designed an off-grid PV system for district Tharparkar, Pakistan, which is 95 percent un-electrified. An evaluation of the system size and the associated costs is conducted. Based on the load, the authors determined the ratings of each component in the PV system. In addition, the authors performed a cost analysis and concluded that PV systems are significantly less expensive than national grids for electrifying this area. According to the authors, the annual energy cost per unit is 63 percent less than if it was supplied by the grid. The authors of [8] aim to identify factors that influence the social acceptability of solar photovoltaic systems in northwest Pakistan. The research evaluated the determinants of social acceptability of PV systems with binary logistic models. Solar PV systems are being used by 46 percent of the households in the study area. The authors emphasize that Pakistan has plenty of solar energy available for converting into electricity using solar photovoltaic systems. Specifically, the study recommends that the government adopt policies aimed at promoting solar energy in Pakistan through incentives. The authors in [9] emphasize the importance of off-grid PV systems in the electrification of remote areas. Identifying the potential and viability of solar energy in remote regions of Sindh, Pakistan. A suitable tilt angle was determined for the selected rural regions, resulting in an increased generation capacity of solar energy. Solar PV off-grid systems are inexpensive and have a lower cost than conventional energy sources, according to this research. Researchers claimed that this study would aid the government of Pakistan in taking advantage of off-grid solar PV energy generation systems.
Energy consumers, rather than large energy producers, are integrating distributed energy resources into the current power market, gradually evolving from unidirectional, centralized to bidirectional decentralized markets, as well as consumers becoming prosumers. Energy trading and the management of distributed generation (DG) can be enhanced by P2P, an evolving architecture in the field of local energy markets. The authors discussed the various operating algorithms of P2P energy trading along with their characteristics, features, standards, and scope in depth through an overview of current state-of-the-art P2P trading. Additionally, this article uses Nepal’s energy system as a case study and explores Nepal’s micro/mini-grids and the challenges, limitations, and prospects they present. The authors concluded with a model that addresses the specific problems associated with the Nepalese energy market [10]. In another study, researchers propose two novel approaches for identifying households’ mutual trading choices in an entirely local P2P energy market. The first approach aims to match excess power supply with demand from peers, and the second one compares the distance between the participants. Both strategies are evaluated to determine how energy prices and trade volume are affected by bilateral trade preferences. The data are generated in a day-ahead setting using a decentralized network of entirely P2P energy trading markets. A permissioned blockchain smart contract is then used to implement the P2P trading market on the digital platform. For simulations, real domestic data from a community in the Netherlands is used, including distinct decentralized energy resources. The authors agreed that in the proposed system, energy purchasing cost and grid interaction are reduced in the P2P network. Likewise, when trading preferences are distance centered, the sum of P2P energy traded is higher at a low cost. The comparison with electric heating and without electric heating in the household is also presented [11]. The authors of [12] recommend UBETA (a permissioned blockchain-based energy trading and payment settlement architecture), which incorporates three diverse kinds of energy markets. As part of the UBETA system, an enterprise Ethereum blockchain known as Hyperledger Besu is used, along with the Istanbul Byzantine Fault Tolerance (IBFT) consensus algorithm. The performance of the system was compared with the existing systems based on the actual energy trading statistics from the Western Australian energy market. They concluded that the suggested integrated energy trading platform holds lower latency and involves fewer blockchain transactions.
Another study found that P2P market mechanisms normally imply a heavy computation burden, and real-time trading requires fast calculations; the authors emphasize that developing and operating such systems in real-time can be technically challenging. It is, therefore, the primary contribution of the authors to present and analyze an online optimization framework utilizing real-time market information for the P2P market using a novel online consensus alternating direction multiplier algorithm to maximize social welfare. In addition, the authors claim that the algorithm can reduce the computational complexity to meet real-time needs. Several case studies were performed to demonstrate that the authors’ algorithm has high computing efficiency, superior convergence, and tracking capability [13]. According to a recent article, an open-source P2P energy trading platform was developed and configured using the Internet-of-Things (IoT) and the blockchain. Technical details are provided on acquiring real-time data monitoring and controlling energy. A web interface is used to facilitate trading through smart contracts on a private Ethereum blockchain, while monitoring and controlling energy consumption is performed via an IoT platform. To achieve a complete system design, the authors used Message Queuing Telemetry Transport and Hypertext Transfer Protocol along with microcontrollers and field instrumentation devices [14]. In another study, the authors describe a user-centric cooperative mechanism that enables users to participate actively in P2P energy trading. To conduct economic transactions in a cost-effective manner, the proposal attempts to reflect the preferences of all actors in the ordering process, making transactions as simple and straightforward as possible. A case study has been conducted in Japan to demonstrate the proposed mechanism through the Higashi-Fuji demonstration experiment. Thus, the study confirmed that consumers were able to buy renewable energy economically, automatically, and efficiently and that prosumers were able to sell surplus electricity. They also recognize that the key to P2P energy trading is designing incentives to encourage participants to participate in the process [15]. Another pilot stage study provides a technical explanation of a peer-to-peer (P2P) energy trading platform that is created on IoT and blockchain technology. According to the results, P2P energy trading offers economic benefits to participants in addition to satisfying the needs of prosumers. The study proposes an energy trading platform that provides all the key features such as energy transfer, metering, and digital money transfer [16]. A P2P energy trading outline appears in [17], consisting of six steps: order generation, order picking, default query, trade verification, trade execution, and payment. By providing default users with either a waiting period or penalties during the default query stage, this study examines credit management’s influence on default behavior. The authors used the Hyperledger Fabric platform, Docker and Go to simulate the model. By proposing this model, the authors claim that blockchain users can reduce costs and realize credit management in P2P energy trading, thus enhancing the efficiency and stability of trades. In [18], the researchers give emphasis to P2P energy trading as a promising energy trading and management solution in an isolated microgrid. They propose a state-of-the-art IoT and Ethereum blockchain-centered trading platform using open resources and technology.
Two distinct streams of the literature were identified based on the literature reviewed as a part of this study. In the first stream, the researchers emphasize off-grid PV systems and on the social adaptability of PV systems [7,8,9,10]. While the other stream examines peer-to-peer energy trading using blockchain technology and claims that P2P trading is the most promising energy management and trading solution [11,12,13,14,15,16,17,18]. The authors believe that this article is the first to present the complete design and technical details of a low-cost, P2P energy trading platform for an un-electrified remote community in Pakistan. In [19], we cover details regarding the analysis and design of an isolated dc-microgrid for this community. The motivations for proposing raspberry-pi and blockchain-based P2P energy trading system for this remote community includes (a) low cost, (b) low energy consumption, (c) high possibility of implementation in unserved remote communities, and (d) potential use in remote areas with no access to the internet.
This paper explores the design of a P2P energy trading system for a remote community in Pakistan. A decentralized, open-source, P2P energy trading system architecture based on IoT and blockchain is presented. To realize the required functions of a P2P energy trading system, low-cost, low-power, reliable and readily available components are used. The proposed P2P energy trading system is tested extensively using batteries designed specifically for the storage of photovoltaic energy to demonstrate the system’s effectiveness. As of today, according to the literature reviewed, the proposed P2P energy trading system for this location has never been considered prior to this and hence can be considered novel with respect to the geographical region. This paper makes the following significant contributions:
  • As a pioneer in peer-to-peer energy trading with a low-cost server in a remote area of Pakistan, this study particularly stands out in terms of its site and application.
  • Development of an open-source and low-cost, local server hosted on a private network for peer-to-peer energy trading, using a ganache command-line interface (CLI) private Ethereum blockchain. Our best understanding of this work is that it entails a novel approach since the authors used either web-based servers or extremely expensive machines.
  • The optimal P2P energy trading system configuration for each house in the community to achieve energy trading and monitoring independence.
  • This study provides a path forward for developing low-cost, blockchain-centered peer-to-peer energy trading systems, particularly for remote locations without access to the internet.
The rest of the paper can be summarized in the following manner. Section 2 overviews the site description. It contains details about the area, including its remoteness. In Section 3, information regarding the hardware and network structure of the proposed P2P energy trading system is presented. It also covers micro-grid configuration with a P2P energy trading scheme for the proposed site. Detailed descriptions of technology and each of the components of the proposed IoT and blockchain-based P2P energy trading system are presented in Section 4. The prototype design and experimental setup for the proposed system are covered in Section 5 and Section 6, respectively. In Section 7, we discuss the implementation methodology. A description of the tests performed and their results are presented in Section 8. As part of Section 9, we discuss the key characteristics of the system, analyzing power consumption and cost. Section 10 concludes the article, and Section 11 presents future research directions.

3. Site Description

This section of the article aims to provide the reader with an overview of the site we have selected for this particular study. The site (34°49′06.6″ N 74°13′06.5″ E) is in the district Neelum valley of Azad Jammu and Kashmir (AJK), Pakistan. This region is the northernmost part of AJK, Pakistan, encompassing the lower part of the Himalayan Mountain range. Several factors contribute to the region’s remoteness, including its distance from urban areas, difficult terrain, and the shortage of facilities, together with modern healthcare services. Roads and other infrastructure in the area are inadequate. Figure 1 illustrates the aerial view from google earth of the location selected for this research, and the actual site is depicted in Figure 2. It is evident from Figure 1 and Figure 2 that there are no power lines or roads leading to this community. The residents are using a kind of local chairlift (called grari in vernacular language) to access their homes; Figure 2 depicts this situation. They are living without televisions, computers, electric appliances, modern health care, internet, and all forms of digital communication and technology. To live without electricity is to live without one of life’s fundamental necessities. Considering the topographical challenges, an in-depth feasibility study was conducted on the possibility of an isolated DC-microgrid that is designed to use batteries and solar energy to supply power to this site. To determine the best-case design for the system, HOMER (Hybrid Optimization of Multiple Energy Resources) is used. More details can be found in [19]. We have designed a low-cost, open-source, peer-to-peer energy trading system for this community and presented details of the server, components, and local communication channel to host the server. The whole system comprises a Raspberry Pi 4B, ESP32, and Field Instrumentation Devices (FIDs) hosted on a private network. By implementing the proposed system, residents will be able to monitor and trade energy independently. A fully autonomous and low-cost system, which can be accessed remotely, has been developed.

4. Hardware and Network Structure for the Proposed P2P Energy Trading with Microgrid Configuration

This section overviews the architecture of the proposed IoT and blockchain-based P2P energy trading system. An illustration of the system architecture is shown in Figure 3. The proposed low-cost, open-source, IoT and blockchain-based system is comprised of a local secured Wi-Fi network. The local network is assured to extend to all houses connected to the isolated microgrid. The Raspberry Pi 4B, ESP32 microcontroller, voltage sensor, current sensor, and relays make up the rest of the system architecture. The system server is set up on Pi4B, which is utilized for executing blockchain-based energy trading tasks. The server dashboard is available for human–machine interface (HMIs) for remote access and P2P energy trading actions. An ESP32 microcontroller is used to monitor energy transfer data with the help of voltage and current sensors. The relays are used to perform the switching operations. As soon as the energy demand is received, the relays turn on, and the energy transfer process starts, and it stops as soon as the energy demand is satisfied. The process of doing so is automated using an algorithm, which does not require any effort from the human. The pseudocode for the algorithm is presented in the later section of this article. For the security of the system, the local Wi-Fi network is configured for user authentication. Figure 3 also shows the PV panels to represent PV energy generation, a battery bank to represent a battery storage system, and the DC-load of the participating peers. Hypertext Transfer Protocol (HTTP) is used for communication between the server and the client.
The proposed P2P energy trading system is designed for a remote community in Pakistan. Figure 4 represents the microgrid configuration of the IoT and blockchain-based P2P energy trading system. Ten houses of the proposed community are connected with the microgrid. Each household is equipped with its own PV generation system and battery bank and an IoT server. There is one main server in the community that hosts the private Ethereum blockchain and React.JS based user interface. The main server is a remote server configured on raspberry Pi for trading activities within the community. Each house also has an IoT server that is created for the purpose of monitoring and executing energy transfer activity. It also starts or stops trading activities upon the request received from the main server over HTTP. Once any request for the trading session is received at the main server, it will figure out the Internet Protocol (IP) addresses of both the buyer and sellers with the help of a computer algorithm and will send that request to ESP32 over HTTP. The ESP32 microcontroller will then turn on the house relay (R1, R2, R3, …, R10) associated with the houses, and the energy trading process will start. It will stop automatically once the requested amount of energy is transferred to the buyer.

5. System Components and Technology Used

The details of each of the low-cost hardware components and open-source software used in the realization of the suggested IoT and blockchain-based P2P energy trading system we present here. Among these components is the Hall effect current and a voltage sensor that serve as field instrumentation devices to monitor energy consumption, a relay for switching operations and ESP32, a versatile microcontroller configured as an IoT server at the premises to control energy consumption and enable trading. A Raspberry Pi 4B single-board computer on which the local web interface is installed and the blockchain server is hosted, which is built for human–machine interactions, dashboards, and lastly, a Wi-Fi router for setting up a private communication network.
A few limitations, such as the range of the local network, distance of peers from main servers, and the number of peers, are present in the proposed system. The outdoor range of the system is 400 m/1312 feet, and the system can accommodate ten peers. This system is stable, resilient, and can easily be replicated as it is based on open-source hardware and software tools.

5.1. Raspberry Pi 4B

A Raspberry Pi (Raspberry Pi 1 Model B, generation 1) machine was released in February 2012, making it the first Raspberry Pi device. The low price of USD 35 made the device an instant success. One of the most common terms used to describe it is Single-Board Computer (SBC). The basis of this definition is that it runs a full operating system and supports adequate computer peripherals. As a low-cost SBC, the Raspberry Pi Foundation made is available to everyone [20]. The authors proclaim that Raspberry Pi is a low-cost, low-power SBC that comes with all the functionalities of conventional computers. Besides being able to access and control the Raspberry Pi remotely as a headless computing unit, it can also be programmed in a variety of computer languages to run autonomously [21]. According to [22], Raspberry Pi 4 is a low-cost micro-computer that can support a wide range of coding functions and has high processing power.
The Raspberry Pi 4 Model B (Pi4B) used in this project is 85 × 56 mm2 and is the first of a new generation of SBC’s with a Quad-core 64-bit ARM-Cortex A72 running at 1.5 GHz and 4 Gigabyte LPDDR4 RAM. This chip is robust and appropriate for the proposed IoT and blockchain-based P2P energy trading system due to its low-cost compliance with IEEE 802.11 b/g/n standard protocol and the following features [23].
  • A 1.5 GHz Quad-core 64-bit ARM-Cortex A72
  • 4 Gigabyte LPDDR4 RAM
  • VideoCore VI 3D Graphics
  • Supports dual HDMI display output up to 4Kp60
  • 802.11 b/g/n/ac Wireless LAN
  • 1× SD Card
  • 2× USB2 ports and 2× USB3 ports
  • 28× user GPIO supporting various interface
  • Mature Linux software stack
  • Pi4B ambient operating temperature range from 0 to 50 °C.
This study uses Pi4B as the main server that can be accessed through HMIs by browsing http://localhost:3000. This main server hosts a user interface and Ethereum private blockchain. The participating peers of the P2P energy trading system can access the server to perform trading activities. All the trading actions performed by the participants will be recorded on the blockchain. One noteworthy point, this IoT and blockchain-based P2P energy trading system will have one main server for participants connected with the grid. The server is installed and configured on the latest release of Raspberry Pi OS 64-bit [24].

5.2. ESP32-WROOM-32

ESP32 is an 18 × 25.5 mm2 size module containing two low-power Xtensa® 32-bit LX6 microprocessors that integrate a powerful Wi-Fi component following the IEEE 802.11 b/g/n protocol. It is well-suited for anything from low-power sensor networks to the most demanding applications. The Central Processing Unit (CPU) clock frequency can be adjusted from 80 to 240 MHz. Two CPUs have been designated as “PRO_CPU” and “APP_CPU” (for “protocol” and “application”, respectively), and the CPU cores can be controlled independently. ESP32 incorporates a wide range of peripherals, ranging from capacitive touch sensors, Hall sensors, Universal Asynchronous Receiver/Transmitter (UART), SD card interface, high-speed serial peripheral interface (SPI), serial communication protocol (I2S), and serial bus interface standard. With a sleep current of less than 5 µAmperes, the ESP32 is suitable for battery-powered applications. [25,26]. The device is a low-cost, low-power microcontroller that includes integrated Wi-Fi, dual-mode Bluetooth functionality, and energy-saving features, making it highly adaptable. The wide range of temperatures proved to be an advantageous feature in an industrial setting. As a standalone microcontroller, it can act as a complete system [27].
A part of this study was the development of a local server using ESP32-WROOM-32. The server is configured for energy monitoring and control within an individual household of the proposed community. ESP32 is connected to a current sensor, a voltage sensor, and a relay. The server receives real-time energy transfer data and displays it on a dashboard. The relay serves as a switch to initiate or stop the energy trading process based on energy demand. The dashboard can be accessed by browsing to a local internet protocol address.

5.3. The Blockchain

A blockchain is conceptually a chain of records referred to as blocks wherein the information stored is encrypted. This ensures privacy and security. As of now, blockchain technology is a leading disruptive technology that is particularly paving the way for the development of new financial and industrial services [28]. In the context of establishing trust between entities involved in a business process, blockchain technology and smart contracts are becoming increasingly important. In technical terms, it can be described as a distributed digital ledger. All transactions on the ledger are immutable and auditable [29]. In many cases, blockchain-based applications and tools can easily integrate with existing systems due to their diverse tools and interconnected communication and consensus requirements. The general-purpose nature of blockchain technology makes it possible to use it in a variety of applications across a wide range of systems [30]. In the context of this study, we have configured the Ganache command-line interface (CLI), an Ethereum client. Ganache CLI offers access to local blockchains to test and run decentralized applications. A local Ethereum blockchain server can be accessed through it. The advantages of using Ganache CLI include no transaction cost, reset and instantiated with a fixed amount of Ether, accounts can be re-cycled, Gas price and mining speed can be modified, and transactions are “mined” instantly [31]. Figure 5 represents a Ganache CLI RPC (remote procedure call) server running. It gives us ten accounts, each associated with 1000 Ethers, and a private key associated with each account. The application of the blockchain to this study is explained in Section 8 of this article.

5.4. User Interface

The user interface to execute P2P energy trading activities is described in Figure 6. For the purposes of this study, this user interface has been configured on Pi4B and can be accessed by browsing to http://localhost:3000/. MetaMask as a chromium extension and Ganache CLI are integrated with the user interface. The local Ethereum blockchain is used to deploy the smart contract.
React.JS, an open-source java script library, is used in the configuration of the user interface. For the development of the smart contract and user interface, we extended the source codes from [32]. Reference [33] provides a detailed guide to the basic concepts and procedures. MetaMask ensures the security of the Ethereum wallet with the help of a private key, user authentication, and secret phrase (as depicted in Figure 6). More details on the user interface and MetaMask can be found in [14].

5.5. HTTP Request-Response Protocol

The HTTP (Hypertext Transfer Protocol) is the lingua franca of the internet. An application-level protocol for client–server interaction [34]. Internet protocol HTTP is the basis of the World Wide Web. As an application layer protocol, HTTP is designed for the communication of information/data between devices over the network. A typical HTTP request involves an HTTP client sending a request to a server, which then sends a response message back to the client. In response to the HTTP request, these responses convey valuable information [35].
Throughout the scope of this study, we have implemented an HTTP request-response protocol to transfer energy trading data between clients and the servers. Once the main server receives a trading request from the client, it sends information to the IoT server in the individual household that then starts the trading process. After the trading request is fulfilled, the transfer stops automatically with the help of a computer algorithm.

5.6. Communication Channel

A D-Link DI-524 wireless router is used to create the communication channel between the IoT server and the blockchain-based central server. It is an IEEE network standard, including IEEE 802.11 b, IEEE 802.11 g, IEEE 802.3, and IEEE 802.3 u, compliant router. It features an up to 400-m range, 54 Mbps data transfer rates, and an operating frequency band of 2.4 GHz [36]. Since ESP32 follows the IEEE 802.11 b/g/n protocol, the router is used to create a local Wi-Fi network for communication between the servers. With a range of 100 m/328 feet indoors and 400 m/1312 feet outdoors, this router can connect all the houses in the community to the local Wi-Fi network. Figure 7 shows the houses’ location in relation to the Wi-Fi server in the proposed community. The Wi-Fi router range and the distance of each house in feet shown in Figure 6 make D-Link DI-524 a perfect selection for the site. The SSID and password for network access control and network security are set up, and the firewall is enabled.
The other components used as a part of this study are 8.5-Watt (W) LED lights, Lead- acid 12 V batteries, battery connectors, manual switches to operate house load, and wires.

6. Prototype Design and Experimental Setup

This section describes the design and hardware implementation of the proposed low-cost, open-source P2P energy trading system based on the above-described hardware components and their operation principles. Figure 8 shows the Pi4B, analog current sensor, a relay, pull-down resistor arrangements, and ESP32 together on a Breadboard. The Pi4B acts as the main server in the proposed P2P system and hosts both a user interface and a blockchain server that can be accessed remotely. Through this server, residents of the remote community can perform trading tasks. As a household server, an ESP32 is installed in every single house connected to the micro-grid. As part of this research, the primary purpose of the ESP32 controller is to monitor and control energy using field instrumentation devices, as outlined in Figure 8.
Figure 9 illustrates the complete experimental setup. The experimental setup includes two batteries represented by B1 and B2, respectively, a Wi-Fi router designated as CC used to create a private communication channel in low-cost, IoT, and blockchain-based P2P energy trading system, and a Pi to serve as the main server of the system. The system’s ESP32-based servers are pictured as P1 and P2, representing peer1 and peer2 in the remote community, and loads of each peer are exhibited as L1 and L2. We can see in Figure 9 that the main P2P server is accessible using HMIs. As the scope of this study, we considered two peers and actual trading actions are performed between P1 and P2. B1 and B2 serve as the energy storage system of the peers. L1 and L2 are assigned to the peers to represent the actual household load in the hoses of the community.
The configuration of a private communication channel is performed by using an IEEE 802.11 standards-compliant Wi-Fi router, labeled CC. The local communication channel provides access to the P2P energy trading system for the participants, enabling them to perform trading actions and transfer sensor data to the IoT server.

7. Implementation Methodology

The proposed P2P energy trading system implements a low-cost, open-source energy trading solution on a Pi4B and ESP32. The ESP32 microcontroller is programmed with the Arduino Integrated Development Environment (IDE) for receiving sensor data and sending it, later via Wi-Fi, to a web server that can be remotely accessed and monitored. Analog sensors are connected to a battery bank to collect the required data, and ESP32 receives the sensor data and transmits it to the dashboard. The blockchain server and a user interface are set up on Pi4B. Using HMI dashboards, the data can be visualized, monitored, and controlled remotely. Algorithm 1 below shows the pseudocode for the implementation methodology. A connection process is represented in steps 1 to 6 of Algorithm 1, which connects the IoT server with the local Wi-Fi network and displays the status of the connection in Arduino IDE’s serial monitor. Following receipt of energy demand, steps 7 to 16 of Algorithm 1 describe the process of trading energy. If the client posts energy demand through the main server’s user interface, the IoT server will receive the energy demand over HTTP, and the relay will initiate the energy trading process. The ESP32 calculates the values received from Field Instrumentation Devices and displays them on the dashboard. The server compares energy consumed with energy demand and stops the energy trading process over HTTP after the trading request is fulfilled. After disconnecting the client, as described in line 17, a new process will start, as illustrated in line 18 of the pseudocode.
Algorithm 1: Energy trading, data acquisition, and energy data display.
   Initialization;
   IDemand = 0;
   Consumed = 0;
  while
    1.
ESP32 is not connected to local network;
    2.
Establish ESP32 and local network connection by passing, SSID, and password;
    if
    3.
ESP32 connection successfully established with local Wi-Fi;
    4.
Display “Connected” on Arduino IDE Serial Monitor;
    else
    5.
Display “Connection failed…. retry in 5 s” on Arduino IDE Serial Monitor;
    6.
ESP32 connects to local Wi-Fi network;
    While
    7.
Refresh sensor value;
If client is availablethen
    8.
ESP32 reads energy demand data over http;
If demand from main server then
    9.
Update energy demand;
    10.
ESP32 turns on relay;
    11.
Energy transfer starts;
    12.
ESP32 reads sensors values and calculates power and energy;
    13.
ESP32 displays data on local webserver;
    14.
Update energy consumed;
If energy consumed ≥ energy demandthen
    15.
ESP32 turns off relay over http;
    16.
Energy transfer stops;
    17.
Disconnect client;
    18.
Step 7;
    end

8. Results

This section outlines the results obtained after successfully testing the proposed low-cost, open-source, IoT, and blockchain-based P2P energy trading system explained in the earlier sections of this paper. Testing of the proposed low-cost, open-source P2P energy trading platform has produced the required results. Figure 10 illustrates a flowchart explaining the system’s operation. It describes the entire energy trading process briefly.
The system is designed for ten peers to trade energy. A user interface shown in Figure 6 allows the peers to perform trading actions. They can present energy demand to the other peers within the community using the bid option, and they can also sell excess energy by clicking the energy sell button on the user interface. The user interface also incorporates MetaMask as a chromium extension in this study. Accounts created on the blockchain server (Figure 5) can be imported using MetaMask for further use in trading. Once a peer inputs an energy trading request, the MetaMask extension will pop up on the screen with the account details of the peer performing a trading session at that time. The client will then have an option to double-check whether they confirm the transaction through their account or reject it, as shown in Figure 11. The excess energy offered by sellers will appear on the user interface of the system and will show up under BUY Energy with the details, including the amount of energy, its price, and the seller’s account information. Any peer on the network who accepts the offer can click on the buy button with the offer details, and the energy transfer will start through the relays installed with the servers of both buyers and sellers. The ESP32 server will measure the amount of energy being transferred and will disconnect the relays after the energy purchased is successfully transferred. The system also allows the buyer to post energy demands with the price. This enables the sellers to see the price and the amount of energy required. All the peers connected with the system can see the trading activities by browsing the user interface. The biding feature gives an option to other peers to sell the energy at the price of their choice after observing offered price, and it provides an opportunity to buyers to fulfill their energy demand at an even lower price.
All the trading activities on the user interface are recorded on the blockchain server. As a part of this study, we have implemented Ganache CLI, an Ethereum client, to establish a local blockchain network on the main server. All the participants, as a part of this network, have access to the blockchain server through http://localhost:5051/. We have configured an open-source local ganache-CLI block explorer. It is a web-based block reader that lets the participants explore local blockchain network blocks.The participants on the P2P network can explore the transaction information such as the amount of energy transfer, mining details, gas limits, gas used, and size stored within each block. In this study, the Go language Ethereum library is used to communicate with the ganache CLI client [37]. Figure 12 exhibits the blocks mined on the blockchain server in response to the transactions performed on the user interface of the system. In total, 26 blocks are generated and can be seen on the dashboard of the block explorer. Each block mined following the energy trading activities during this study is available on the dashboard of the Ganache CLI blockchain explorer, which can be further explored by providing a block hash to get the block information option. Figure 13 illustrates the details of block 26 mined on the blockchain server. It shows a block hash that is a unique address of each block mined after a successful transaction, the time stamp that is the representation of the time and date at which the block is mined, gas used, and an Ethereum transaction fee. Gas is paid in Ether (ETH), Ethereum’s native currency. The gas fee is represented in gwei, Ethereum’s unit of measure for gas prices, and 1 gwei is equivalent to 10-9 ETH [38]. In addition, the block size, gas limit, and parent hash (of the previous block) can be found there. This study’s scope does not extend to information on uncle hash, which is also provided by the block explorer. Figure 14 represents the process of getting more information regarding the blocks, Figure 15 shows the impact of trading on account balances, and energy transaction details are presented in Figure 16. Figure 17 illustrates how the buyer’s energy demand appears on the user interface. In the proposed community, every household has an ESP32 controller that monitors and controls energy and functions as an energy meter. The ESP32 controller initiates the transfer process once the energy transfer request over HTTP has been received and ends once the desired amount of energy has been transferred. The ESP32 controller dashboard is depicted in Figure 18 when running on a network, and the energy offers by the seller are shown in Figure 19.

9. Discussion

This section aims to highlight some of the main features and benefits of the low-cost and open-source P2P energy trading system developed for the remote community in Pakistan realized following successful testing.
  • System configurations: The Internet-of-Things and the Ethereum Private blockchain provided a concrete foundation for a robust distributed application for P2P energy trading in the case studied, as well as for remote locations in general. For this study, the Ganache Ethereum blockchain is used since it is fast and customizable. The number of accounts and associated balances can be customized as needed. The IoT server is set up on a low-cost ESP32 that facilitates trading and monitoring in the system. This system features the essential elements for an efficient and effective blockchain-based P2P network, including an IoT server, a blockchain server, a Communication Channel, and Field Instrumentation Devices.
  • Low-cost and open-source: The hardware components employed in this design are readily available and are reasonably priced. The breakdown of the cost of each component, as well as the total cost of the designed IoT and blockchain-based P2P energy trading system, is presented below in Table 1. According to Table 1, the installation of both IoT server and the blockchain server per house would cost Pakistani rupees 7639/-, about CAD 50, and this is indeed a low cost as compared to the high-cost existing system presented in [14]. The system is based on free and open-source software and code, another factor contributing to its low cost. References [39,40,41,42,43] provide more details on costs.
  • Low power: When designing an IoT-based system, 24 × 7 power consumption is a significant consideration. Thus, in designing the system, the power consumption of each component was a key concern. The main server of the proposed system is configured on Raspberry Pi that consumes 2.5 Watts. The IoT server is set up on an ESP32 that requires a maximum of 0.8 Watts. This proves the microcontroller is a low-power device. The overall power consumption of a server within a household of the community is 3.3 Watts, and the Wi-Fi router consumes 4.4 Watts of power. The power consumption of each component is observed while under operating conditions, and data sheets can be referred to for details. A summary of the power consumption of each hardware component used as part of this study can be found in Table 2.
  • The availability and reliability of the system: The open-source nature of all the components used in this study, and the fact they are readily available, as well as the fact that all servers, interfaces, and devices are locally installed and self-managed, allows the participants to ensure continuous reliability and availability of the system.
  • The acquisition of data, monitoring, and control: An IoT server installed on the peer side provides real-time data acquisition, monitoring of energy transfer data and control of transmission operations based on requests from the central server via HTTP.
  • Remote monitoring and trading: The proposed IoT and blockchain-based P2P energy trading system is human–machine interaction enabled. In this manner, peers have the opportunity to perform, observe, and monitor energy trading remotely.
  • Security: As the proposed P2P energy trading system uses blockchain and IoT servers that are locally configured, data integrity and security are taken into account. This includes login credentials for MetaMask, a unique private key for authorized access to the Ethereum wallet, SSID and password requirements, firewall security, and secret recovery phrase.
  • An easy-to-use system: In the proposed P2P energy trading system, the interface has been designed to be intuitive and user-friendly. It does not require users to go through any special training.
  • Fast and efficient settlements: The blockchain server implemented in this study is capable of fast settlements. It executes transactions instantly and transfers funds immediately. A smaller ledger also contributes to the efficiency of the system.
  • Electronic payment system: A system of electronic payments is introduced to remote communities without internet access along with solutions for energy monitoring, control, and trading.
  • A comprehensive guide for future research: This research has an important impact on providing electricity trading and management solution to this unserved community. The research described above provides a solid foundation and justification for planning and designing an isolated-microgrid-based P2P energy trading system for remote areas without internet access.

10. Conclusions

The world still has a large population who live without electricity. The World Bank estimates that 25 percent of Pakistan’s population lacks access to electricity, and that figure rises to 40 percent in remote areas. The observed reasons include limited government resources, low generation capacity, and high transmission costs. Even though Pakistan has abundant renewable energy resources, the lack of knowledge and know-how of such systems has been a hindrance toward its utilization. While it is important to have distributed energy generation, it is also critical to have a platform that ensures energy management and trading services among neighbors. This will raise interest in distributed generation and ultimately result in the electrification of remote areas since proper returns on energy can be realized.
The objective of this study is to develop a low-cost and open-source peer-to-peer (P2P) energy trading system based on the Internet-of-Things (IoT) and blockchain for a remote community in Pakistan. The system presents the most recent technologies and is unique in the sense that we have not seen such a low-cost, open-source system implementing the latest technologies we have used as a part of this research. Another novel aspect of this system is the geographical location of the selected community. The proposed energy trading system has been designed and implemented with six critical components, including Field Instrumentation Devices, a relay, ESP32, a user interface, Ethereum private blockchain, and a Local Wi-Fi Network. To validate the design of the P2P energy trading system, an experimental setup was created. The results demonstrated that the system could be used to carry out the desired functions of a P2P energy trading system, namely Energy Transfer, Data Acquisition, Data Monitoring, Data Display, Networked Data Communication, and maintaining a Digital Ledger on the blockchain network. This system is proven to be low power, with its central server only consuming 2.5 W, the IoT server alone 0.8 W, the IoT server in its entirety 3.3 W, and the communication channel 4.4 W. Additionally, the system was found to be very inexpensive. Its overall cost is under CAD 50. Authentication for MetaMask, private keys for each peer to access digital assets, firewalls, login credentials, and seed phrases are also considered data security measures.
Although the proposed P2P energy trading system in this study is considered for a remote community in Pakistan. This research can have a significant impact on promoting distributed energy generation for remote locations. It can serve as a marketplace for prosumers to sell excess electricity to their neighbors.

11. Future Work

The authors would like to extend the application of this study to the larger remote communities with no electricity and internet access. The authors believe that this study will encourage the adoption and investments in distributed energy generation. Expanding the range of communication channels with low power consumption can also contribute to future work extensions.

Author Contributions

M.J.A.B.: methodology, software and hardware implementation, data curation, writing—original draft. M.T.I.: conceptualization, resources, supervision, funding acquisition, writing—review and editing. M.J.: co-supervision, writing—review and editing. J.K.: co-supervision, writing—review and editing. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Acknowledgments

The authors would like to thank Mirpur University of Science and Technology (MUST), Mirpur-10250, Azad Jammu and Kashmir, Pakistan, and the Higher Education Commission (HEC), Islamabad-44000, Pakistan, for providing an opportunity to carry out this research under the Human Resource Development program.

Conflicts of Interest

The authors declare that there is no conflict of interest regarding the publication of this paper. In the actualization of this work, all components and software used were selected on a professional basis.

Abbreviations

This manuscript uses the following key abbreviations:
IoTInternet of Things
DGDistributed Generation
P2PPeer-to-Peer
HMIHuman–Machine Interface
SBCSingle-Board Computer
Pi4BRaspberry Pi 4 Model B
HTTPHypertext Transfer Protocol
CPUCentral Processing Unit
CLICommand-Line Interface
SSIDService Set Identifier
PVPhotovoltaic
FIDField Instrumentation Device
IPInternet Protocol

References

  1. Our World in Data. Access to Energy. 2019. Available online: https://ourworldindata.org/energy-access#access-to-electricity (accessed on 30 April 2022).
  2. The World Bank. Access to Electricity, (% of Population) Pakistan. 2020. Available online: https://data.worldbank.org/indicator/EG.ELC.ACCS.ZS?locations=PK (accessed on 19 May 2022).
  3. The World Bank. Access to Electricity, Rural (% of Rural Population) Pakistan. 2020. Available online: https://data.worldbank.org/indicator/EG.ELC.ACCS.RU.ZS?locations=PK (accessed on 19 May 2022).
  4. Aghenta, L.O.; Iqbal, M.T. Low-Cost, Open Source IoT-Based SCADA System Design Using Thinger.IO and ESP32 Thing. Electronics 2019, 8, 822. [Google Scholar] [CrossRef] [Green Version]
  5. Ismail, N.S.; Rashid, N.A.; Zakaria, N.A.; Khan, Z.I.; Mahmud, A. Low Cost Extended Wireless Network Using Raspberry Pi 3B+. In Proceedings of the 2020 IEEE Symposium on Industrial Electronics & Applications (ISIEA), TBD, Malaysia, 17–18 July 2020; pp. 1–4. [Google Scholar] [CrossRef]
  6. Parra, S.; Carranza, E.; Coole, J.; Hunt, B.; Smith, C.; Keahey, P.; Maza, M.; Schmeler, K.; Richards-Kortum, R. Development of Low-Cost Point-of-Care Technologies for Cervical Cancer Prevention Based on a Single-Board Computer. IEEE J. Transl. Eng. Health Med. 2020, 8, 1–10. [Google Scholar] [CrossRef] [PubMed]
  7. Kumar, K.; Kumar, M.; Soomro, A.M. To Design an off Gird PV System for un electrified area of District Tharparkar, Pakistan. Int. J. Green Energy 2021, 18, 920–932. [Google Scholar] [CrossRef]
  8. Jan, I.; Ullah, W.; Ashfaq, M. Social acceptability of solar photovoltaic system in Pakistan: Key determinants and policy implications. J. Clean. Prod. 2020, 274, 123140. [Google Scholar] [CrossRef]
  9. Xu, L.; Wang, Y.; Solangi, Y.A.; Zameer, H.; Shah, S.A.A. Off-Grid Solar PV Power Generation System in Sindh, Pakistan: A Techno-Economic Feasibility Analysis. Processes 2019, 7, 308. [Google Scholar] [CrossRef] [Green Version]
  10. Shrestha, A.; Bishwokarma, R.; Chapagain, A.; Banjara, S.; Aryal, S.; Mali, B.; Thapa, R.; Bista, D.; Hayes, B.P.; Papadakis, A.; et al. Peer-to-Peer Energy Trading in Micro/Mini-Grids for Local Energy Communities: A Review and Case Study of Nepal. IEEE Access 2019, 7, 131911–131928. [Google Scholar] [CrossRef]
  11. AlSkaif, T.; Crespo-Vazquez, J.L.; Sekuloski, M.; van Leeuwen, G.; Catalao, J.P.S. Blockchain-Based Fully Peer-to-Peer Energy Trading Strategies for Residential Energy Systems. IEEE Trans. Ind. Inform. 2021, 18, 231–241. [Google Scholar] [CrossRef]
  12. Abdella, J.; Tari, Z.; Anwar, A.; Mahmood, A.; Han, F. An Architecture and Performance Evaluation of Blockchain-Based Peer-to-Peer Energy Trading. IEEE Trans. Smart Grid 2021, 12, 3364–3378. [Google Scholar] [CrossRef]
  13. Guo, Z.; Pinson, P.; Chen, S.; Yang, Q.; Yang, Z. Online Optimization for Real-Time Peer-to-Peer Electricity Market Mechanisms. IEEE Trans. Smart Grid 2021, 12, 4151–4163. [Google Scholar] [CrossRef]
  14. Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. Design and implementation of an open-Source IoT and blockchain-based peer-to-peer energy trading platform using ESP32-S2, Node-Red and, MQTT protocol. Energy Rep. 2021, 7, 5733–5746. [Google Scholar] [CrossRef]
  15. Takeda, Y.; Nakai, Y.; Senoo, T.; Tanaka, K. Designing a User-Centric P2P Energy Trading Platform: A Case Study—Higashi-Fuji Demonstration. Energies 2021, 14, 7289. [Google Scholar] [CrossRef]
  16. Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. IoT and Blockchain Based Peer to Peer Energy Trading Pilot Platform. In Proceedings of the 2020 11th IEEE Annual Information Technology, Electronics and Mobile Communication Conference (IEMCON), Vancouver, BC, Canada, 4–7 November 2020; pp. 0402–0406. [Google Scholar] [CrossRef]
  17. Zhou, K.; Chong, J.; Lu, X.; Yang, S. Credit-Based Peer-to-Peer Electricity Trading in Energy Blockchain Environment. IEEE Trans. Smart Grid 2021, 13, 678–687. [Google Scholar] [CrossRef]
  18. Baig, M.J.A.; Memorial University of Newfoundland; Iqbal, M.T.; Jamil, M.; Khan, J.; Hydro, B. Peer-to-Peer Energy Trading in a Micro-grid Using Internet of Things and Blockchain. Electron. ETF 2021, 25, 39–49. [Google Scholar] [CrossRef]
  19. Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. Design and Analysis of an Isolated DC-Microgrid for a Remote Community in Pakistan. In Proceedings of the 2021 IEEE 12th Annual Ubiquitous Computing, Electronics & Mobile Communication Conference (UEMCON), New York, NY, USA, 1–4 December 2021; pp. 0712–0716. [Google Scholar] [CrossRef]
  20. Johnston, S.J.; Cox, S.J. The Raspberry Pi: A Technology Disrupter, and the Enabler of Dreams. Electronics 2017, 6, 51. [Google Scholar] [CrossRef] [Green Version]
  21. Jolles, J.W. Broad-scale applications of the Raspberry Pi: A review and guide for biologists. Methods Ecol. Evol. 2021, 12, 1562–1579. [Google Scholar] [CrossRef]
  22. Uzair, M.; Al-Kafrawi, S.Y.; Al-Janadi, K.M.; Al-Bulushi, I.A. A Low-Cost IoT Based Buildings Management System (BMS) Using Arduino Mega 2560 and Raspberry Pi 4 for Smart Monitoring and Automation. Int. J. Electr. Comput. Eng. Syst. 2022, 13, 219–236. [Google Scholar] [CrossRef]
  23. Raspberry Pi 4 Model B—Datasheet. Available online: https://datasheets.raspberrypi.com/rpi4/raspberry-pi-4-datasheet.pdf (accessed on 15 May 2022).
  24. CNX Software Embedded Systems News. Available online: https://www.cnx-software.com/2022/02/03/raspberry-pi-os-64-bit-officially-released/ (accessed on 1 April 2022).
  25. ESP32-Datasheet. Available online: https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf (accessed on 15 May 2022).
  26. Oton, C.N.; Iqbal, M.T. Low-Cost Open Source IoT-Based SCADA System for a BTS Site Using ESP32 and Arduino IoT Cloud. In Proceedings of the 2021 IEEE 12th Annual Ubiquitous Computing, Electronics & Mobile Communication Conference (UEMCON), New York, NY, USA, 1–4 December 2021; pp. 0681–0685. [Google Scholar] [CrossRef]
  27. Biswas, S.B.; Iqbal, M.T. Solar Water Pumping System Control Using a Low Cost ESP32 Microcontroller. In Proceedings of the 2018 IEEE Canadian Conference on Electrical & Computer Engineering (CCECE), Quebec, QC, Canada, 13–16 May 2018; pp. 1–5. [Google Scholar] [CrossRef]
  28. Deepa, N.; Pham, Q.-V.; Nguyen, D.C.; Bhattacharya, S.; Prabadevi, B.; Gadekallu, T.R.; Maddikunta, P.K.R.; Fang, F.; Pathirana, P.N. A survey on blockchain for big data: Approaches, opportunities, and future directions. Futur. Gener. Comput. Syst. 2022, 131, 209–226. [Google Scholar] [CrossRef]
  29. Da Xu, L.; Viriyasitavat, W. Application of Blockchain in Collaborative Internet-of-Things Services. IEEE Trans. Comput. Soc. Syst. 2019, 6, 1295–1305. [Google Scholar] [CrossRef]
  30. Berdik, D.; Otoum, S.; Schmidt, N.; Porter, D.; Jararweh, Y. A Survey on Blockchain for Information Systems Management and Security. Inf. Process. Manag. 2020, 58, 102397. [Google Scholar] [CrossRef]
  31. Ganache CLI—Documentation. Available online: https://docs.nethereum.com/en/latest/ethereum-and-clients/ganache-cli/ (accessed on 5 May 2022).
  32. Ethereum Marketplace Step-by-Step Tutorial. Available online: https://github.com/dappuniversity/marketplace (accessed on 30 April 2022).
  33. How to Build a Blockchain App with Ethereum, Web3.js & Solidity Smart Contracts. Available online: https://www.dappuniversity.com/articles/how-to-build-a-blockchain-app (accessed on 30 April 2021).
  34. Bressoud, T.; White, D. The HyperText Transfer Protocol. In Introduction to Data Systems; Springer: Cham, Switzerland, 2020; pp. 609–648. [Google Scholar] [CrossRef]
  35. CLOUDFLARE. Available online: https://www.cloudflare.com/learning/ddos/glossary/hypertext-transfer-protocol-http/ (accessed on 15 May 2022).
  36. D-Link DI-524 Wireless Router—Datasheet. Available online: https://icecat.us/prefere/us/p/d-link/di-524-de/wireless+routers-di-524-716873.html (accessed on 5 April 2022).
  37. Ganache-CLI-Block-Explorer. Available online: https://github.com/vivekganesan01/ganache-cli-block-explorer (accessed on 30 April 2022).
  38. Ethereum Gas and Fees. Available online: https://ethereum.org/en/developers/docs/gas/ (accessed on 13 May 2022).
  39. ESP32. Available online: https://www.daraz.pk/products/wrom-esp32-wifi-i222111657-s1437471924.html?spm=a2a0e.searchlist.list.2.229064f8ebIhOa&search=1 (accessed on 5 April 2022).
  40. Raspberry Pi 4 Model B 4 GB. Available online: https://www.daraz.pk/products/4-b-4gb-5a-i211220280-s1418470648.html?spm=a2a0e.searchlist.list.60.208176a3EkdooR&search=1 (accessed on 5 April 2022).
  41. Relay Module. Available online: https://w11stop.com/1-channel-5v-relay-shield (accessed on 5 April 2022).
  42. Current Sensor ICs. Available online: https://electrobes.com/product/acs712-30a-current-30-amp-sensor-module/ (accessed on 5 April 2022).
  43. Class 10 SanDisk 32 GB Ultra Micro SD Card For Raspberry Pi. Available online: https://electronicshub.pk/product/class-10-sandisk-32gb-ultra-micro-sd-card-for-raspberry-pi/ (accessed on 30 March 2022).
Figure 1. An aerial view of the selected location.
Figure 1. An aerial view of the selected location.
Energies 15 04862 g001
Figure 2. Actual view of the proposed site.
Figure 2. Actual view of the proposed site.
Energies 15 04862 g002
Figure 3. Proposed P2P energy trading system architecture.
Figure 3. Proposed P2P energy trading system architecture.
Energies 15 04862 g003
Figure 4. Micro-grid configuration of proposed P2P Energy trading system [16].
Figure 4. Micro-grid configuration of proposed P2P Energy trading system [16].
Energies 15 04862 g004
Figure 5. Ganache blockchain server.
Figure 5. Ganache blockchain server.
Energies 15 04862 g005
Figure 6. User interface for peer-to-peer energy trading.
Figure 6. User interface for peer-to-peer energy trading.
Energies 15 04862 g006
Figure 7. The distance between houses and the Wi-Fi server.
Figure 7. The distance between houses and the Wi-Fi server.
Energies 15 04862 g007
Figure 8. Hardware implementation of the low-cost server.
Figure 8. Hardware implementation of the low-cost server.
Energies 15 04862 g008
Figure 9. Experimental setup for the proposed P2P energy trading system.
Figure 9. Experimental setup for the proposed P2P energy trading system.
Energies 15 04862 g009
Figure 10. Flow chart of the proposed P2P energy trading system.
Figure 10. Flow chart of the proposed P2P energy trading system.
Energies 15 04862 g010
Figure 11. MetaMask extension.
Figure 11. MetaMask extension.
Energies 15 04862 g011
Figure 12. Blockchain Server.
Figure 12. Blockchain Server.
Energies 15 04862 g012
Figure 13. Block details.
Figure 13. Block details.
Energies 15 04862 g013
Figure 14. Access to Block details.
Figure 14. Access to Block details.
Energies 15 04862 g014
Figure 15. Accounts status after transactions.
Figure 15. Accounts status after transactions.
Energies 15 04862 g015
Figure 16. Transaction details on the blockchain.
Figure 16. Transaction details on the blockchain.
Energies 15 04862 g016
Figure 17. Energy demand on user interface.
Figure 17. Energy demand on user interface.
Energies 15 04862 g017
Figure 18. IoT server status.
Figure 18. IoT server status.
Energies 15 04862 g018
Figure 19. Energy offered by sellers.
Figure 19. Energy offered by sellers.
Energies 15 04862 g019
Table 1. An itemized bill of components.
Table 1. An itemized bill of components.
Sr. NoNAME OF COMPONENTPRICE (PAK RS)
1Raspberry Pi 4 Model B
(Cost per house)
38,000
(3800)
2ESP32899
3Relay140
4Current sensor270
516 GB SD Card1400
6D-Link DI-524 Wireless Router
(Cost per house)
2300
(230)
7Miscellaneous (Breadboard, Jumper wires, wires, Pi case, Resistors)900
Grand Total per housePAK RS 7639/-
Table 2. Power requirement of the proposed system.
Table 2. Power requirement of the proposed system.
Sr. NoHARDWAREPOWER (W)
1Raspberry Pi 4 Model B2.5
2ESP320.8
3Breadboard, ESP32, Sensors, Resistors3.3
4D-Link DI-524 Wireless Router4.4
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. A Low-Cost, Open-Source Peer-to-Peer Energy Trading System for a Remote Community Using the Internet-of-Things, Blockchain, and Hypertext Transfer Protocol. Energies 2022, 15, 4862. https://doi.org/10.3390/en15134862

AMA Style

Baig MJA, Iqbal MT, Jamil M, Khan J. A Low-Cost, Open-Source Peer-to-Peer Energy Trading System for a Remote Community Using the Internet-of-Things, Blockchain, and Hypertext Transfer Protocol. Energies. 2022; 15(13):4862. https://doi.org/10.3390/en15134862

Chicago/Turabian Style

Baig, Mirza Jabbar Aziz, M. Tariq Iqbal, Mohsin Jamil, and Jahangir Khan. 2022. "A Low-Cost, Open-Source Peer-to-Peer Energy Trading System for a Remote Community Using the Internet-of-Things, Blockchain, and Hypertext Transfer Protocol" Energies 15, no. 13: 4862. https://doi.org/10.3390/en15134862

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop