The [MikroElektronika Hall Current 7 Click board allows a current up to +/- 100 A to be measured. The breakout board is part of the mikroBUS ecosystem allowing a developer or student to test-drive the product before designing a PCB. The Hall Current 7 includes an Allegro ACS758LCB-100B-PFF-T sensor featuring a 100 uΩ conductor through which the current is passed. The sensor and terminal and high current connectors are shown in Figure 1.
This engineering brief provides a short introduction to the MIKROE-4420 product followed by a demonstration where the sensor is used to measure a 60 Hz 30 A peak AC current waveform. The reader is assumed to have skills in circuit construction and electrical safety.
Figure 1: Image of the +/- 100 A MIKROE Hall Current 7 Click interfacing with an Arduino UNO R4 Minima.
Safety Disclaimer
The MIKROE Hall Current 7 Click is not a toy, especially when it is integrated into high current and high voltage systems. There are serious safety considerations as a mistake could cost money, damage equipment, cause a fire, or even hurt a person.
As a starting point, ensure:
-
You are qualified to perform the work, or you work under the close supervision of a knowledgeable mentor.
-
Appropriate enclosures and construction practices are used to prevent electrocution.
-
An appropriate circuit breaker or fuse is in place to prevent fire.
-
PPE, such as safety glasses, are worn, as malfunctioning high-current systems present an explosion hazard.
-
You, along with your supervisor and other essential personnel, perform a risk assessment and safety analysis prior to performing the work.
-
Proper Lock Out Tag Out (LOTO) processes are in place.
-
Follow all applicable employer, state, and federal guidelines, especially when the sensor is integrated into line-powered equipment.
Remember, safety is your responsibility. Use the MIKROE Hall Current 7 Click with responsibility to protect yourself and those around you. For more information, refer to DigiKey’s Terms of Use and Conditions of Order
What is a Hall Current sensor?
The Hall-effect sensor provides a convenient way to measure current. The featured Allegro Hall Current sensor is an integrated device that includes an amplifier, a Hall-effect sensor, and a core to effectively couple the magnetic field into the sensor.
Hall sensor complication
While the sensitive sensor can measure the magnetic field in a current carrying conductor, a toroidal magnetic core is often used to concentrate the magnetic flux. A common example is a clamp-on ammeter, where a wire is passed through the clamp’s aperture. The flux concentrator is embedded in the case of the Allegro sensor.
Precision measurements are challenged by hysteresis of the magnetic components. For example, suppose a device rated for 100 A current is subject to a 1000 A spike. The spike tends to magnetize the core resulting in an offset. To a lesser degree, even the rated 100 A will cause a remnant magnetic field with a resulting offset error. This can be especially objectionable when the sensor is used to measure small currents.
The featured Allegro X100B sensor has a 150 mA error after a 100 A current excursion. In other words, after all current is removed, the sensor may display an erroneous +/- 150 mA offset. Note small-current measurement error may be compounded by the sensor’s +/- 20 mV electrical offset as well as drift in the ADC voltage reference.
Tech Tip: Technicians and engineers are often surprised by the magnetic offset error associated with a Hall-effect sensor. They are often disappointed with the performance at low current levels.
Be sure to carefully read the datasheet specification for a better understanding of the magnetic offset error. The magnetic hysteresis can be minimized by degaussing or application of a current in the opposite direction.
Programming the Hall Current 7 Click
The Current 7 Click features a 12-bit Microchip MCP3221 ADC with an I2C interface. Communication is simplified by using the Arduino Wire library as shown in this code listing.
Wire.requestFrom(0b1001101, 2);
uint8_t upper_byte = Wire.read();
uint8_t lower_byte = Wire.read();
uint16_t ADC_12_bit_binary = (upper_byte << 8) | lower_byte;
float ADC_voltage = fMap((float)ADC_12_bit_binary, 0.0, 4095.0, 0.0, 5.0);
float measuredCurrent = fMap(ADC_voltage, 0.5, 4.5, -100.0, 100.0);
Tech Tip: Personally, I like to use an intermediate step and convert the binary ADC value to a voltage. This aids in troubleshooting as the voltage may be sent to the debug window. The software result can then be compared to a physical voltmeter reading.
How fast is the Current 7 Click
The Allegro sensor has a 120 kHz bandwidth. The Allegro literature explores applications in HEV and EV vehicle propulsion with application ranging from vehicle subsystems to monitoring motor currents.
The Allegro sensor has an analog output with a nominal response of 0.5 to 4.5 VDC for a -100 to 100 A input. It will idle at 2.5 VDC. Also, recall that the MIKROE Hall Current 7 Click is equipped with a 12-bit Microchip ADC with an I2C interface. Consequently, the speed at which the Click operates is largely determined by the data transfer time. As shown in Figure 2, the transfer time is approximately 300 us. This limits the sample rate to about 3000 samples per second.
The data transfer rate could be increased by:
-
Increasing the I2C clock speed.
-
Use of the ADC’s consecutive read operation to minimize the number of times the addressing byte is sent.
These techniques are effective but limited. To achieve the 120 kHz bandwidth, we must switch to a high-speed ADC with a SPI, Quad-SPI, or parallel interface. An alternative is to use microcontroller with an onboard high-performance ADC.
Figure 2: Logic analyzer display showing the I2C signal as well as a flag indicating when the microcontroller is collecting and servicing each sample.
Tech Tip: The MIKROE Hall Current 7 Click could be modified to send the Allegro sensor’s output to the analog pin on the mikroBUS socket. This involves lifting the sensor’s output leg and soldering a bodge wire connecting it to the mikroBUS analog pin. You should include an RC low-pass filter to minimize noise and guard against Nyquist frequency aliasing.
This modification bypasses the Click’s Microchip ADC in favor of the microcontrollers onboard ADC. This may be a favorable modification with the Arduino R4 UNO as the Renesas R7FA4M1AB3CFM#AA0 features a 14-bit ADC with a fast conversion time. This may or may not be true for other microcontrollers.
Demonstration of the MIKROE Hall Current 7 Click
For this demonstration, the system is configured to operate like an oscilloscope. Samples are collected at a rate of 2000 samples per second. They will be stored in an array. After 1000 samples have been collected, they are processed and then sent to the serial monitor.
The results are shown in Figure 3. The large graph shown the data collected in a 0.5-second interval. The smaller graph shows the individual samples for the first cycle.
Figure 3: Sampled 60 Hz current waveform with 2000 samples per second.
Safety: Experienced technicians and engineers can deduce the experimental setup used to generate the Figure 3 data. They will identify the inherent risks and know how to mitigate the danger. While I could describe the setup, I chose to limit the description in the interest of safety, as the novice should not conduct this experiment without the direct supervision of a knowledgeable and qualified mentor. Please refer to the safety disclaimer included at the beginning of this note.
The Arduino software is included here: Current_7.ino (1.7 KB).
As my hero once said, “please excuse the crudity of this model.” The code relies on the brute force technique leveraging the power of Arduino’s Renesas RA4M1 processor. A proper software solution would include an Interrupt Service Routine (ISR) to handle the sampling. It would also leverage the RA4M1’s 14-bit ADC and likely use Direct Memory Access (DMA) to transfer the data from ADC directly to memory. Instead of spinning in loops the microcontroller could enter sleep mode or busy itself with other essential tasks.
Next steps
There are many related experiments to be conducted with the Allegro sensor.
-
Use the sampled data to calculate the RMS value.
-
Integrate voltage measurement circuitry and then code the microcontroller to calculate complex power along with phase angle.
-
Modify the circuit so that the Allegro’s analog output is sent directly to a microcontroller featuring a high-performance on-board ADC. Use the ISR and DMA to optimize the sampling.
-
Perform an FFT on the sample data to determine harmonic content.
-
Modify the circuitry to include a high-performance voltage reference. Explore stability across a wide temperature range.
-
Determine the limits of the sensor. As a project, consider a motor application where a trio of sensors are used to measure the phase currents.
-
Determine the response of the sensor when overloaded. Explore methods to mitigate the magnetic hysteresis.
Parting thoughts
The MIKROE Hall Current 7 Click provides a convenient breakout board for the Allegro ACS758LCB-100B-PFF-T sensor. It is well positioned within the mikroBUS ecosystem allowing a designer or student to test-drive the sensor. The best part is that it takes minutes to get the first reading from the sensor.
We end with a cautionary note recognizing that circuits capable of measuring +/- 100 A are not trivial. There are inherent safety risks that must be properly identified. Novice engineers and students must seek guidance to protect against these hazards.
You are encouraged to explore the MIKROE line of breakout boards. Please leave a comment if you would like to explore the operation of a particular board.
Best wishes,
APDahlen
Related information
Please follow these links to related and useful information:
About this author
Aaron Dahlen, LCDR USCG (Ret.), serves as an application engineer at DigiKey. He has a unique electronics and automation foundation built over a 27-year military career as a technician and engineer which was further enhanced by 12 years of teaching (interwoven). With an MSEE degree from Minnesota State University, Mankato, Dahlen has taught in an ABET-accredited EE program, served as the program coordinator for an EET program, and taught component-level repair to military electronics technicians. Dahlen has returned to his Northern Minnesota home and thoroughly enjoys researching and writing articles such as this.