Author Topic: Interfacing an ACS37220 current sensor to MCU ADC.  (Read 536 times)

0 Members and 1 Guest are viewing this topic.

Offline djsbTopic starter

  • Frequent Contributor
  • **
  • Posts: 955
  • Country: gb
Interfacing an ACS37220 current sensor to MCU ADC.
« on: July 30, 2024, 05:00:31 pm »
I'd like to interface a ACS37220 +/- 100A 20mV per amp current sensor (ACS37220LEZATR-100B5) with a 5V supply to a PIC/ESP32/PICO MCU.

https://www.pololu.com/product/5297

The output of the sensor with nothing connected to it is 2.48 Volts. I need to send the CHANGE in voltage to an ADC convertor. So if the voltage goes ABOVE or BELOW 2.48 volts, then pass this along to the ADC. If the voltage stays at 2.48V then the output of the interface circuit stays at ZERO or maybe just pass the 2.48 volts through? I am used to only working with 0 to 5 inputs to an ADC so I'm just wondering the best way to proceed with this bidirectional voltage. It's probably really simple, but a nudge in the right direction would be nice. Thanks.
David
Hertfordshire, UK
University Electronics Technician, London, PIC16/18, CCS PCM C, Arduino UNO, NANO,ESP32, KiCad V8+, Altium Designer 21.4.1, Alibre Design Expert 28 & FreeCAD beginner. LPKF S103,S62 PCB router Operator, Electronics instructor. Credited KiCad French to English translator
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4684
  • Country: dk
Re: Interfacing an ACS37220 current sensor to MCU ADC.
« Reply #1 on: July 30, 2024, 05:12:25 pm »
when there's no current the voltage is 2.5V, when there's current in one direction the voltage is above 2.5V, when there's current in the other directed the voltage is below 2.5V

Currrent in amps = (voltage - 2.5V)/20mV  ...
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2498
  • Country: gb
  • Recovering Electrical Engineer
Re: Interfacing an ACS37220 current sensor to MCU ADC.
« Reply #2 on: August 01, 2024, 10:22:10 am »
A level shifting opamp circuit will do the job, see attached.
Its a simple subtractor with a gain of 2
The opamp needs to be a single supply RIRO eg MCP6497.
See this handy pdf on solving single supply offset and gain issues.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4172
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Interfacing an ACS37220 current sensor to MCU ADC.
« Reply #3 on: August 01, 2024, 10:36:59 am »
Will you be measureing AC or DC?

If AC, ignore the 2.48V, put a high pass filter in software.
If DC, put a potentiometer on other ADC channel and subtract this value. Zero offset calibration performed with potentiometer.
 

Offline djsbTopic starter

  • Frequent Contributor
  • **
  • Posts: 955
  • Country: gb
Re: Interfacing an ACS37220 current sensor to MCU ADC.
« Reply #4 on: August 01, 2024, 04:59:16 pm »
Thanks for all of your replies.
My application is DC. I want to measure the current into and out of my motorcycle battery. It is a lithium-ion battery with built-in battery management (that's what they claim). I suspect that there is a parasitic current draw as well.
Initially, I want to try using a Sparkfun OpenLog Artemis.

https://www.sparkfun.com/products/16832

The problem is the ADC of the Artemis has a maximum allowable input of 2 volts, so I have to scale the output of the current sensor to match the Artemis.
David
Hertfordshire, UK
University Electronics Technician, London, PIC16/18, CCS PCM C, Arduino UNO, NANO,ESP32, KiCad V8+, Altium Designer 21.4.1, Alibre Design Expert 28 & FreeCAD beginner. LPKF S103,S62 PCB router Operator, Electronics instructor. Credited KiCad French to English translator
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4684
  • Country: dk
Re: Interfacing an ACS37220 current sensor to MCU ADC.
« Reply #5 on: August 01, 2024, 06:53:37 pm »
Thanks for all of your replies.
My application is DC. I want to measure the current into and out of my motorcycle battery. It is a lithium-ion battery with built-in battery management (that's what they claim). I suspect that there is a parasitic current draw as well.
Initially, I want to try using a Sparkfun OpenLog Artemis.

https://www.sparkfun.com/products/16832

The problem is the ADC of the Artemis has a maximum allowable input of 2 volts, so I have to scale the output of the current sensor to match the Artemis.

resistive divider to get 0-5V down to 0-2V

 

Offline djsbTopic starter

  • Frequent Contributor
  • **
  • Posts: 955
  • Country: gb
Re: Interfacing an ACS37220 current sensor to MCU ADC.
« Reply #6 on: August 01, 2024, 06:56:42 pm »
Yes, I'm going to try a 10k and 6k8 resistor. I'm hoping it's that simple.
David
Hertfordshire, UK
University Electronics Technician, London, PIC16/18, CCS PCM C, Arduino UNO, NANO,ESP32, KiCad V8+, Altium Designer 21.4.1, Alibre Design Expert 28 & FreeCAD beginner. LPKF S103,S62 PCB router Operator, Electronics instructor. Credited KiCad French to English translator
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf