Introduction: Current Sensing Tutorial
This project attempts to provide a brief review of the current sensing techniques underlying 2 common types of current sensors: the conventional DC current sensor and the hall-effect sensor. The DC current sensor used in this project is an INA219 High Side DC Current Sensor Breakout and the Hall Effect sensor used is an ACS712 Low Current Sensor Board.
Step 1: Hardware List
Arduino Uno 1 To process the signals from the sensors
ACS 712 Hall Effect Current sensor 1 To measure the current
INA219 High Side DC Current Sensor 1 To measure the current
Arduino Motor Shield Rev3 1 To manipulate Motors
Breadboard 1 To provide a convenient workspace for the circuit
DC Motor 1 Acts as a load in the tested circuit
Batteries 4 To provide voltage in the circuit that is being tested
Battery case 1 To hold the Batteries
Computer 1 To view the data
Capacitor (probably) 1 To moderate the current spikes caused by the motor
Wires 12+ To connect parts
Step 2: How the Breadboard Works
When the breadboard is held vertically as shown in the figure above, the positive and the negative lines run vertically on the sides, not connecting to anything else but the ports on the lines themselves. The middle part of the breadboard is horizontally connected (a-b-c-d-e and f-g-h-i-j). However, the valley running through the center of the board divides the horizontal lines into two sections. There are no vertical links in the middle.
Step 3: Procedure
1. Gather the breadboard, Arduino Uno, and the Arduino Motor Shield.
2. Fit the Arduino Motor Shield on top of the Arduino Uno micro-controller appropriately.
Step 4: High Side DC Current Sensor INA_219
i. Connect the 5 volt pin of the Motor Shield to row A, column 1, notated as (A, 1), of the breadboard.
ii. Connect the ground pin to the breadboard’s ground/negative line.
iii. Connect the SCL (Clock Line) pin of the Arduino to (A, 3)
iv. Connect the SDA (Data Line) pin of the Arduino to (A, 4)
v. Lastly, connect a wire from the ground line of the board to (A, 2). This will complete the circuit to provide power supply to the sensor
i. Place the sensor in the breadboard to link the first four terminals of the sensor to the connections made before.
ii. Connect V+ to the positive terminal of the power supply (batteries) for the circuit under test.
iii. Connect V- to the positive terminal of the load (however, motors can operate in both the directions of the current). This puts the sense resistor in-line with the circuit.
iv. Finally, connect a wire from the negative terminal of the power supply to GND. This allows the sensor to measure the load voltage as well as the load current.
Ultimately place the motor to complete the test circuit. The terminals can attached in any direction as it will only change whether the motor spins clockwise or counter clockwise.
NOTE: Noisy loads such as DC motors can cause sharp
current draw and cause the sensor to reset. To avoid this, include a bidirectional capacitor parallel to the load to decouple it from the power supply.
Step 7: Hall-Effect Sensor ACS_712
i. Connect 2 breadboards together side to side with each other.
ii. Then connect the hall-effect sensor vertically across each power line of the breadboard as shown in the figure abocve.
i. Connect the 5v pin of the hall-effect sensor directly to the 5v pin of the Arduino.
ii. Connect the GND pin of the sensor directly to the corresponding pin of the Arduino.
i. Connect the IP+ pin of the sensor to the power line.
ii. Connect the IP- pin to either terminal of the DC motor.
iii. Connect the other terminal of the motor to the power supply.
Connect the batteries to their appropriate place in the power supply line.
Step 11: Software: Adafruit_INA219
To store the serial output as processable data we need download CoolTerm. To download the software, go to http://freeware.the-meiers.org/. Then, extract the CoolTerm folder to the desired location.
Step 12: Libraries
To utilize the the current sensor using the Arduino, download the INA219 libraries from https://github.com/adafruit/Adafruit_INA219.
Then extract the folder inside the zip file into the libraries folder of Arduino.
Step 14: Code: GetCurrent
Use GetCurrent.ino to operate the Arduino and to receive the signals generated by the micro-controller.
Remember to change the interval (milliseconds) to change the frequency of measurements.
Click ‘Upload’ ( → ) on the top left corner of the window to initiate the program on the micro-controller.
Step 16: CoolTerm
Open CoolTerm in order to obtain the data from the Serial port. Then click ‘Connect’ to link the software to the Arduino Uno micro-controller.
Then go to Connection > Capture to Textfile > Start OR
Press Ctrl + R to start recording the data.
Save the resulting textfile to any convenient destination.
Then go to Connection > Capture to Textfile > Start OR
Press Ctrl + Shift + R to Stop recording data.
Then click on Disconnect to safely disengage the micro-controller from the PC.
Step 21: Excel
i. Open a new Excel file to save the data in an operational format.
ii. Then go to Data > From Text to transfer data from the text file into Excel.
Import the file that was saved before and then Click ‘Import’.
Click Finish in the dialogue box that appears.
Click whichever cell you want the table’s top-left corner to be on and then click ‘OK’.
Add labels on the top of each column.
Step 26: The End.
Use the table as you want to!
We have a be nice policy.
Please be positive and constructive.