In this tutorial, we will be setting up a non-invasive current sensor to measure current flow.
Material List
- One Arduino Uno
- One Soderless Breadboard
- One 10uF capacitor
- Two 10k Ω resistors
- One 33 Ω resistor
- One Non-Invasive Current Sensor rated at 100A
- Wire Stripper or 3.5 mm audio jack
- Optional: 9V battery connected to Arduino Uno
Breadboard Setup
Breadboard Setup Notes
Setting up the non-invasive current sensor requires some modification of the available hardware. Non-invasive current sensors available come with an audio jack head. I found this to be an unnecessarily clunky and fragile addition to the wiring of the current sensor, so I cut off the head and stripped the wires. This allows you to set up the current sensor as shown above.
There is no non-invasive current sensor piece in Fritzing, so here is a picture to show you what your current sensor looks like unclamped. To sense current traveling through a wire, we put the wire through the square hole and clamp the plastic on the left.
Calculations for burden resistor
According to Power Electronics, “A burden resistor connected across the secondary produces an output voltage proportional to the resistor value, based on the amount of current flowing through it.” What this means in English is that its resistance helps converts current readings into voltage following the equation V=IR.
To determine the size of the burden resistor requires a simple math problem:
Burden Resistor (ohms) = (AREF * CT TURNS) / (2.828 * max primary current)
AREF is the Analog Refernce Voltage (in this case, the voltage given by the Arduino which is 5V), CT Turns is the number of turns in the current sensor to give the peak-current in the secondary coil (2000 turns, according to the data sheet), and the max primary current is the current rating of the sensor (100A). So in this case, the burden resistor in ohms would be
Burden Resistor = (5 * 2000)/(2.828 * 100) = 10000/282.8 = 35.4
It is always better to use slightly less resistance, so I opted for a 33 ohm resistor.
Code
The code aspect of a current sensor is easily provided in the EmonLib (click link to download ZIP file of library to add to your libraries in Arduino IDE).
Install the library in your Arduino Library folder and open the example sketch titled “current_only.” If you cannot find it, it is below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3 #include "EmonLib.h" // Include Emon Library EnergyMonitor emon1; // Create an instance void setup() { Serial.begin(9600); emon1.current(1, 111.1); // Current: input pin, calibration. } void loop() { double Irms = emon1.calcIrms(1480); // Calculate Irms only. Irms = Current Root Mean Square value = Measured current Serial.print(Irms*230.0); // Apparent power. Serial.print(" "); // Apparent power is Irms * Vrms (Voltage Root Mean Square value, which is 230 for Arduinos) Serial.println(Irms); // Irms } |
Upload the code to your Arduino. After putting the wire with the current you want to measure through the current sensor, open the Serial Monitor. Apparent power will be on the left, and current sensed will be on the right. You should see that it goes through peaks and valleys like a wave, as this is how currents travel through wires.
Optimizing Readings
There are some simple tricks to get a better current reading:
- Measure the current a wire with less insulation: This is why I suggested the optional connection of the 9V battery to the Arduino. The wire used to connect the battery has less insulation and provides a good demonstration of concept.
- Make sure your current flows in the same direction as the arrows on the sensor: As the picture below shows, there are arrows on the top of the current sensor. Match the current flow to the direction of these arrows
- Put your wire in the middle of the sensor: This may be difficult given the size of your wire, but the closer you can get it to the middle of the clamp, the better the reading will be due to the nature of the electromagnetic coil in the coil’s hardware.