Understanding Allegro Current Sensor Output - Page 1
Forum section: electronics / beginners

author: trilerian
author_rank: Regular Contributor
timestamp: June 11, 2023, 11:21:07 pm
content: I need some help deciphering the output from an Allegro ACS 772 - 50B current sensor. I get the sensitivity, and how to calculate based on the DC voltage out. But the output on my scope doesn't make a lot of sense to me. My current setup, lol, is high side in series with a battery going to a bldc controller and that is running a small 100w bldc motor. I have got it hooked up to another bldc motor as a generator with 100watt 2 ohm resistors on the phases to create a load. What I don't understand is how the output deforms as the voltage goes up. Some of it is probably do to the pwm frequency of the controller, which should be 12khz. But the waveform changes a lot, not just losing the pwm.I am attaching some pics...EDIT: Sorry, the pic of the setup is a different sensor, but they all show the same characteristics. I have a few I am testing.

author: trilerian
author_rank: Regular Contributor
timestamp: June 11, 2023, 11:25:24 pm
content: Here is an updated pic of the setup.

author: wraper
author_rank: Unknown
timestamp: June 11, 2023, 11:30:43 pm
content: Why do you think it should be constantly consuming the same power? There are two things to this. One of them is winding switching which you see as short pulses. Second thing is that controller is trying to keep set RPM so it regulates power (PWM) depending on if motor needs to rotate faster or slower. But you don't see PWM, just average current because controller has some decoupling on its power rail or because current sensor is not fast enough to show PWM frequency.

author: trilerian
author_rank: Regular Contributor
timestamp: June 11, 2023, 11:57:34 pm
content: I don't expect it to keep the same power. I fully expect the amp draw to go up as I increase the throttle. I don't understand why the waveforms distort so much as I increase throttle.Also, this is in series with the battery, shouldn't the battery give more of a steady wave? I want to eventually measure this on the phase wires, but I want to fully understand this output first. Why is there a dip between what seems like the bigger part of the wave? It seems to be small rise and fall followed by a big rise. Are those 2 supposed to be the same? I am asking because my readings, which are averaged over 300 reads, are about 0.5 amps lower than the "Motolyser" I am using to compare to.

author: wraper
author_rank: Unknown
timestamp: June 12, 2023, 12:15:12 am
content: QuoteBattery does not decide how much current is consumed by driver/motor. Want nicer waveform, add some bulk capacitance to the power rail on driver side.

author: trilerian
author_rank: Regular Contributor
timestamp: June 12, 2023, 12:22:03 am
content: Quote from: wraper on June 12, 2023, 12:15:12 amSorry, but I find that post insulting... I put a load on the motor specifically to draw more current, you would think by my setup I understood at least that.

author: Buriedcode
author_rank: Super Contributor
timestamp: June 12, 2023, 12:38:17 am
content: Its hard to read that Y axis, but are you talking about a 0.1 - 0.2V variation centred on 2.5V? Thats only an 8% variation. Given the nature of how its driven, I don't see that as a problem. And the X-axis? Is that seconds?You mention a scope, but those screenshots dont look like scope software, I assume you're using the ADC on an Arduino Nano - these aren't that great but can be improved with buffering, a stable andcleanpower supply - which is also used as a reference - or are you using an external reference? A variation of +/-15 LSB isn't unheard of when powered by USB, with the ADC running fast and little buffering. All of that can be checked just by running this without the motor connected, which would of course give you a steady output form the sensor, as well as eliminate EMI from the motor.

author: trilerian
author_rank: Regular Contributor
timestamp: June 12, 2023, 01:10:07 am
content: Quote from: Buriedcode on June 12, 2023, 12:38:17 amScope is an Instek 1054B. Software is openwave, or something like that. X axis is 1ms. I am using the ADC on the nano, I have some 12 bit ADCs that I will be using in the future, but I haven't figured them out yet. I bought them for another project I haven't started, but I can look into using them for this.With the motor not running, yes the output is a flat 2.338v according to my 3478a, and the wave is a straight line on the scope.I do have 7805s coming to be able to run this off of my 2s lipo, the ones I got on Amazon were junk... I also tried running this using the board power supplies that connect with a 9v ac adapter. That was even worse...I'm going to pick up some of the unidirectional sensors and see how they read as well.

author: Jwillis
author_rank: Super Contributor
timestamp: June 12, 2023, 02:27:31 am
content: The current on any motor will change depending on where in the rotation the motor is. So any single that you grab will look just like the signals you have posted. This is typical inductive noise produced by the changing fields inside the motor. As a field collapses the current stored "Flies back'' when it discharges. this will create a "bump" in the wave form then another "bump" when another field charges. This is normal characteristic wave form of any DC motor.

author: trilerian
author_rank: Regular Contributor
timestamp: June 12, 2023, 03:20:45 am
content: Quote from: Jwillis on June 12, 2023, 02:27:31 amHow about a good recommendation for reading? I’ve read a lot about bldc motors, I understand, at least the basics, of inductance. But I am struggling to understand why a current sensor off the battery would be subjected to induction in the motor windings.I think I am going to put one inline on my battery charger and see what that looks like. That should give me a good baseline as the charger is supposed to be constant current.

author: bdunham7
author_rank: Super Contributor
timestamp: June 12, 2023, 03:36:20 am
content: Quote from: trilerian on June 12, 2023, 03:20:45 amWhat don't you understand? The current has to to through the motor windings, right? So the reactance of those windings will be a factor in how much current flows and when, no?

author: Jwillis
author_rank: Super Contributor
timestamp: June 12, 2023, 07:04:38 am
content: Quote from: trilerian on June 12, 2023, 03:20:45 amhttps://www.mouser.ca/pdfDocs/ACS772-Datasheet.pdfhttps://www.mouser.com/pdfDocs/AN296158-High-Power-Density-CB-Package-Current-Sensors.pdfLook at the note for Application 1 on the first page . " RF and CF are for optimal noise management, with values that depend on the application." Rf and Cf are the output filter . On your experimental board you only have the Bypass cap in place.I don't know the characteristics of the motor your using.I have an ACS758 on a module board and it has a 22 ohm for Rf and a .01uF cap for Cf. I only have very small BLDC motors so I used a typical 12v DC brushed motor. A 100uF cap in place of the .01uF Cf cap cleaned up the output to a flat line. You'll need to experiment as to which value of capacitor will filter out the reactive noise.ALL DC motors are noisy no matter what power supply is used. As bdunham7 mentions the reactance. The charging and discharging of the coils creates this reactance that propagates through the circuit of the motor and the ACS 772as an AC wave .Any Alternating Current can "ride" a DC voltage . The Cf capacitor bypasses the AC to ground but prevents the DC from passing to ground. A clean DC voltage can go to the measuring device.

author: Psi
author_rank: Super Contributor
timestamp: June 12, 2023, 07:21:02 am
content: Always filter a current sensor to the bandwidth you require.Current draw is usually quite a mess.Simple RC filter is all you need.BLDC motor controllers have to detect the rotation based on back EMF so there is some fancy stuff going on behind the scenes.It maybe creating odd current artifacts as it hunts for the optimal timing for the load.It may also be changing timing depending on speed to optimize the transfer of energy into the motor coils at a given voltage.Especially modern quadcopter BLDC motor controllers that have to respond super fast to the flight controller to maintain stability.

author: mikerj
author_rank: Super Contributor
timestamp: June 12, 2023, 12:31:12 pm
content: Quote from: trilerian on June 12, 2023, 12:22:03 amYou find it "insulting" but you don't seem to understand what he is telling you. You have said multiple times that you think the current waveform should be more stable because you've connected the sensor right at the battery, which strongly implies that you think the battery determines the current waveform or at least has a strong influence over it. Is it possible you are confusing current and voltage? Voltage close to the battery should be more stable (lower resistive and inductive losses), but the current is entirely dependant on the load.

author: trilerian
author_rank: Regular Contributor
timestamp: June 12, 2023, 01:31:32 pm
content: I tried a couple of values for low pass rc filters but they didn't change the output at all. To be honest I don't have a clue on what values to try since I have no idea what frequency I should be trying to filter out. As to this system, it is sensored so it is not using the back emf to detect rotor position. If you look at the setup you will notice that I have 3 wires connected to the board that are using digital pins on the arduino. I am reading the rpm through that, these wires are tapped into the sensor wire harness of the motor. I did look around the web, stumbled into some robotics forums and used rc values they were using. Also, some of the sensors I am using were bought as complete units so they have an rc filter on the board already, like I said, no difference in the output. The values I used were 220Ω and 4.7nf, which would be about double the cutoff of the above post. I also tried a 1000uf capacitor on the battery (+/-). We generally have these on the esc where the battery inputs are, so I figured I would try that as well. Although there is a lot of speculation in the RC racing world of what that capacitor actually does. Some say it helps with the voltage drop the battery has under load, some say it just reduces ripple.As to why I thought the sensor should be more stable at the battery...When I first thought about doing this, I wanted to put the sensor on one of the phases. After doing a lot of reading I decided that due to the inductance characteristics that putting the sensor on the phase would probably require some smoothing of the data. In other words, I fully expected the current to be erratic on a phase wire so close to the coils. I then thought that measuring at the battery might yield a more constant current since I think it should be isolated from the coils by the mosfets. Right? Current doesn't flow back through the mosfets from the coils?So I am looking at the chart for 2v. The repeating waveform looks to have a frequency about 220hz. The motor is spinning at appx 4250 rpm, so appx 71hz. Should there be 3 or 6 pulses during that time? I know that it is 6 step commutation, but I think 2 phases energize at the same time, so there should only be 3 pulses? If that is the case, then 3*71=210hz, which seems to be the frequency of the wave. If I look at the 8v plot, the frequency looks to be about 1.65khz, but it looks like there should be 2 peaks per waveform, so it is half that, which would be about 825hz. The motor is spinning at 17200 ish rpm, which is ~287hz. Multiplied by three again for the pulses, and that is 860hz. Pretty darn close to that 825hz, which I eyeballed anyway, so I think these assumptions are correct.EDIT: Of course my assumption could just be data bias to fit to something I understand.I think maybe I see something here. The current drain on the battery is reduced during the cycle because of the current remaining in the coil, as pointed out many times above. If there wasn't any inductance, would this then resemble a saw tooth wave?I'm thinking I need to figure out a way to use the rpm reading of the motor to find the start and stop limits of the average reading. But I am lost on where to start with that...

author: trilerian
author_rank: Regular Contributor
timestamp: June 12, 2023, 01:35:37 pm
content: Quote from: mikerj on June 12, 2023, 12:31:12 pmNot helpful... I completely understand that the load will determine the current.Maybe people reading this don't understand the setup is set to draw a relatively continuous current.

author: bdunham7
author_rank: Super Contributor
timestamp: June 12, 2023, 01:54:27 pm
content: Quote from: trilerian on June 12, 2023, 01:31:32 pmA capacitor across a battery reduces its AC impedance. How that changes anything depends on the circuit it is being used in.QuoteI'm not familiar with the device you have and you haven't posted a schematic, but if is anything like what I imagine, it should be obvious that the MOSFETs can't simultaneously isolate the coils and allow current to continue to flow from the battery. If there weren't any significant energy storage (capacitor or inductor) downstream of the current sensor, the current would be the same at every point, all the way back to the battery.

author: trilerian
author_rank: Regular Contributor
timestamp: June 12, 2023, 02:04:17 pm
content: Quote from: bdunham7 on June 12, 2023, 01:54:27 pmSo this might be something I am confused on. If this were a standard DC motor, then it would have a flyback diode to circulate the current back through the coils and avoid the crazy voltage spike, right? But with a bldc motor, my understanding is that is part of the mosfet. But it still switches off and doesn't allow the current to go back through it. Mosfets are one way, I thought.The device I am referencing is called a Motolyser. It is basically a sensored bldc motor controller that has a microprocessor that can read current from the battery, current on each the phases (my guess is by a lowside shunt), rpm, and the hall sensor angles. I have no schematic of it, because I have no idea where to even start, lol.

author: bdunham7
author_rank: Super Contributor
timestamp: June 12, 2023, 03:44:43 pm
content: Quote from: trilerian on June 12, 2023, 02:04:17 pmIt depends on the circuit. The individual MOSFETs themselves have body diodes and will always conduct one way even when 'off'.