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.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Hardware Needed
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. http://dcubestore.com/product/current-monitoring-...
to buy product individually click on link:
Step 2: Make Connections
1. Take Raspberry Pi and GPIO header
2. Connect the GPIO Header to the Raspberry Pi’s GPIO pins.
3. Using an I2C cable,connect the Current monitoring controller to the Raspberry via the I2c connecting port on GPIO header
Step 3: Turn It ON
1.Pass the live wire to the Bulb through one of the current ports in the Current Monitoring Controller.
2.Turn on your raspberry pi , which have a linux installed on it.
3. Power up the board(Current monitoring controller).
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.
Step 4: Installing Java I2c Library on Pi and Compiling the Code
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
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
OR curl -s get.pi4j.com
To create a new file where the code can be written,the following command will be used:
Eg. vi SAMPLE1.java
After creating the file, we can input the code in here.
Some sample java code are available online on the below link:
These are ready to be used simply by copying them from here.To insert the code press “i” key.Copy the code from the above mentioned repository and paste it in the window here.
Click “esc” once done with the coding.Then use the below-mentioned command to exit the code window:
This is write quit command to come back to the terminal window
Compile the code using the following command:pi4j FILE_NAME.java
Eg. pi4j SAMPLE1.java
If there are no errors, run the program using the undermentioned command:pi4j FILE_NAME
Eg. pi4j SAMPLE1
Step 5: Check the Output
The code will output the number of channels , maximum current of the board and current value in each channel.
The current is shown as instantaneous current. We can multiply with voltage to get the instantaneous power.
Power = Voltage x current
current : as measured by the board
voltage : The standard voltage used in household(110 v or 220v)