» » » Current Monitoring with Raspberry pi!!

Current Monitoring with Raspberry pi!!

posted in: Others | 0


Problem Statement:

Every household has a problem of how much power they have consumed in a particular duration and what is going to be the electricity bill for this cycle.



This problem can be solved by using a Current monitoring controller with Raspberry Pi. Using a I2C header connect a Current monitoring controller to the Raspberry pi.

Then Multiply the current output with the voltage to get the Power. This Power unit is multiplied with Rate per unit to get Final Amount.


Using a Current Monitoring Controller:

Steps to connect Raspberry Pi with Current monitoring controller PECMAC45A:

Here,we will be using the Raspberry Pi 2 Model B V1.1, Current monitoring controller, GPIO header, I2C connecting cable, A bulb for output and an Power supply adapter.

To buy this stuff click on the link given below or click buy now at end of page to get the product at offer price.


to buy product individually click on link:







New Image-min


1. Take Raspberry Pi and GPIO header


New Image5-min


2. Connect the GPIO Header to the Raspberry Pi’s GPIO pins.

New Image6-min


3. Using an I2C cable,connect the Current monitoring controller to the Raspberry via the I2c connecting port on GPIO header

New Image4-min


4. Pass the live wire to the Bulb through one of the current ports in the Current Monitoring Controller

New Image8-min


5. Power up the boards(Raspberry Pi and Current monitoring controller).

6. Raspberry Pi can be  powered by any Micro USB adapter. It works on 5V and 2A.

7. Input voltage to the Current monitoring controller is 12V and this can be given by a 12V adapter

8. Now this board is ready to be used.


Steps to use this set-up: (Using Java)

We have booted the device with Linux(Raspbian). In this, we are using the Raspberry Pi with a Monitor Screen

  1. Install the “pi4j libraby” from http://pi4j.com/install.html. Pi4j is a Java Input/Output Library for Raspberry Pi.
    An easy and most preferred method to install the “pi4j library” is to execute the undermentioned command directly in your Raspberry Pi:

    curl -s get.pi4j.com | sudo bash
    curl -s get.pi4j.com
  2. To create a new file where the code can be written,the following command will be used:

    vi FILE_NAME.java
    Eg. vi SAMPLE1.java
  3. After creating the file, we can input the code in here.
    1. Some sample java code are available online on the below link:
      Click Here
    2. These are ready to be used simply by copying them from here.
  4. To insert the code press “i” key.
  5. Copy the code from the above mentioned repository and paste it in the window here.
  6. Click “esc” once done with the coding.
  7. Then use the below-mentioned command to exit the code window:

    This is write quit command to come back to the terminal window
  8. Compile the code using the following command:

    pi4j FILE_NAME.java
    Eg. pi4j SAMPLE1.java
  9. If there are no errors, run the program using the undermentioned command:

    pi4j FILE_NAME
    Eg. pi4j SAMPLE1


Output Screen: 

As in the image provided you can see that we have used 3rd channel of our device
so we get the exact current value through that channel.


Screen Shot 2016-09-01 at 6.21.00 PM



Current Monitoring Kit

Leave a Reply