ACS711 not outputing full voltage range. - Page 1
Forum section: electronics / projects

author: guitchess
author_rank: Regular Contributor
timestamp: October 23, 2019, 02:40:35 pm
content: Hello.I am trying to design a switched receptacle that is triggered by current on a parallel receptacle.The issue I'm having is that the ACS711 starts with a normal output (Vcc/2) but after amperage reaches about 5 amps, the output falls/rises back to the original level.The IC is the x25AB version.Vcc is from a 1117-3.3 giving a base Vout of 1.64v. Depending on current direction, Vout will rise to about 1.91v or fall to 1.58 before resetting.I'm testing with a drill, which has a peak current draw rating of 7.8 amps. The Vout resets at about 3/4 trigger pull.If any of you more experienced designers have some advice, I would greatly appreciate the input.Attached are schematic, pcb images, and ACS711 datasheet.

author: jdraughn
author_rank: Regular Contributor
timestamp: October 24, 2019, 09:11:20 am
content: When you say resetting, do you mean from 3/4 to full the current reading output resets to vcc/2, but if you release the trigger a tiny bit like back to 1/2 then the current goes back up?

author: mikerj
author_rank: Super Contributor
timestamp: October 24, 2019, 11:46:52 am
content: Is that a 1uF capacitor on the output of the ACS711 (marked 105 on the schematic)? The datasheet specifies the maximum capacitive load as 1nF, a thousand times lower.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 12:40:31 pm
content: Quote from: jdraughn on October 24, 2019, 09:11:20 amYes. Once I hit that threshold, the 711s output reverts back to Vcc/2. If I slightly release the trigger, it does go back to working. Also, if I pulse the drill at a low level, being careful not to go past half or so, the Viout(the datasheet label) will peak higher.I got to wondering if the ACS711 was being upset by the magnetic flux(I'm a rookie, not sure what this is really called) of the relay, but yesterday I tested without the jumper that leads to the MCU and it functioned no differently.I was also thought that the current draw of the relay may be keeping the 711 from functioning properly, but the no jumper tests made no difference.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 12:46:00 pm
content: Quote from: mikerj on October 24, 2019, 11:46:52 amYes, I had made that mistake. Unfortunately, changing it to the proper value made no difference in the IC's output.I had also used a 10k instead of the 1k resistor for the fault pullup. Sadly, the change to 1k failed to make the IC function as expected.

author: mariush
author_rank: Super Contributor
timestamp: October 24, 2019, 12:50:39 pm
content: It's probably not the issue, but I don't see any tantalum capacitor on the board, for the 1117 output.Keep in mind that 1117 regulators can oscillate, without a capacitor on the output that has ESR between 0.1 ohm and 1 ohm - ceramic caps should be avoided (or add a resistor in series), a 10-47uF electrolytic would probably be good choice.There are some 1117 regulators, made by some companies, which claim they're safe to use with ceramic capacitors, but I found it best to just treat them as if they require 0.1 ohm or higher ESR on the output.Considering the small distance between the two chips, you can probably drop the ceramic capacitor on the input of the ACS711 IC ... for decoupling purposes it should be closer to the pads anyway.

author: wraper
author_rank: Unknown
timestamp: October 24, 2019, 01:01:47 pm
content: Where did you get this ACS711? It might be counterfeit. Also try placing ferrite beads on current sense wires.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 02:05:30 pm
content: Quote from: mariush on October 24, 2019, 12:50:39 pmYes, being a rookie, I haven't learned where substitutions are ok and where they're not. I had this one in place before I read that it takes a 10uf and up to equate to a small tantalum. What's really frustrating is that when I learn something like this, it makes me wonder how many times it has caused issues in the past and I was too ignorant to know.Thanks for looking and the tip.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 02:07:20 pm
content: Quote from: wraper on October 24, 2019, 01:01:47 pmI got this one from Digikey. I hope we don't have to start worrying about fakes from them.Also, I'll see if I can dig some up.Thanks for the tip.

author: wraper
author_rank: Unknown
timestamp: October 24, 2019, 02:14:52 pm
content: As you are connecting drill, it likely produces wide band noise. And coupled through internal capacitance of ACS711, quite likely it can make IC go nuts. Hence I suggested placing ferrite beads. Using noise suppression capacitors might help as well.

author: djacobow
author_rank: Super Contributor
timestamp: October 24, 2019, 03:01:29 pm
content: What is the fault/ output doing? A short current spike from the drill could be sending the unit into fault mode, which it recovers after current goes down and stays down for a bit.Would be interesting to test with a less noisy load, perhaps a resistive heater driven through a variac.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 05:02:25 pm
content: Well I started the morning changing loads. Didn't try a resistive load, just different. a single speed blower motor. Probably not much less noisy. It did reveal a few things.Thank you and everyone for your input.I think I may have it sorted out. Unfortunately, it shows my lack of experience/technical knowledge.I think my issue is that I had DC on the brain. When I measure the VIOUT on AC mode, it appears to work properly. However, it measures 0v with no passing current. When current is applied, the voltage goes up. Measurements show that it is an accurate 55mv/amp as well.To my way of thinking this is right because VIOUT goes the same direction as the measured current. I think the only reason any VIOUT was showing with the drill is because of noise or possibly the variable speed circuit. With the blower motor that I tried this morning, there was no reaction from VIOUT when measuring DC but when measuring AC, the voltage was right on.How does this theory sound to more experienced designers?Unfortunately, this thesis requires a version 3. Which, will have to include a rectifier and an op amp.Again, thanks for all the help. Any tips, input, or advice is always appreciated.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 05:05:14 pm
content: Quote from: djacobow on October 24, 2019, 03:01:29 pmI haven't measured the fault output yet. I really had ruled that out because the datasheet said that the IC had to power off to reset it. I will try that direction though. Thanks.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 05:53:39 pm
content: Well here's V.3. It feels a bit overkill to use an op amp for a precision diode, but unless I'm calculating wrong I would have to be pulling 3 amps just to get over the voltage drop of a simple peak detector.I'm going to try to breadboard this up and find out if I have my head screwed on straight. Feel free to let me know if you think is not.

author: IDEngineer
author_rank: Super Contributor
timestamp: October 24, 2019, 07:02:51 pm
content: Quote from: wraper on October 24, 2019, 02:14:52 pmOn this particular topic: I used several models in the ACS series a few years ago during a study of brushed DC motors. Peak startup currents were on the order of 70A with sustained currents in the low 10's of amps - in other words, far more than the ~8 amps mentioned by the OP. If you want to talk about noise, I can post some amazing scope photos. There aren't many noisier "signals"!The ACS devices worked flawlessly. They revealed an amazing amount of detail on the commutation as the brushes made and broke contact. Absolutely no "resetting", etc. If the current exceeded the range of the particular device its output would saturate, but when the current came back down the output signal would follow faithfully. The one caveat here is that the ACS's we were using did not have the "fault" output. They simply saturated as described. (The internal current path will sustain ~500% of the device's rated current so you can saturate them to some degree without damage.)Based on my experience, I'd trust the ACS is working properly - unless the "fault" thing is the cause. There are standard versions without the fault output, and since it seems you don't care about the fault output anyway, why not use a similarly rated version without the fault feature? That would eliminate one possible source of the problem.EDIT: Studying the functional diagram in the posted spec sheet, it's hard to see how latching the fault output would affect the analog signal path.

author: IDEngineer
author_rank: Super Contributor
timestamp: October 24, 2019, 07:05:41 pm
content: Quote from: guitchess on October 24, 2019, 12:40:31 pmThere are (internally) differential versions of the ACS family that eliminate sensitivity to external magnetic fields. The "standard" ones can be affected (since they are Hall devices). We encountered this phenomenon (relay coils causing a measurement offset) but switching to the (pin compatible) diff versions resolved it.

author: IDEngineer
author_rank: Super Contributor
timestamp: October 24, 2019, 07:17:39 pm
content: Quote from: guitchess on October 24, 2019, 05:02:25 pmHuh? The ACS will give you an output voltage based on current flow, no matter if that current flow is AC or DC. It is not an AC coupled device. The version you're using is biased at 1/2 the supply rail so it can report current flowing in both directions, as you'd expect with AC, but it will report DC just fine. There are other unidirectional versions for pure DC applications, and they don't have the midpoint output bias, but the midpoint versions still report DC in either direction just fine."no reaction from VIOUT when measuring DC" doesn't make sense. Are you certain you were flowing some current when you performed this "DC" test?EDIT: Up to the frequency limit of the device (looks like 100KHz from this spec sheet), an AC current should give you an AC output (into a pure resistive load, anyway). This device does not "convert" AC current into a DC representation - that implies filtering which this device does not do. There are versions that have a filter pin to which you can connect a capacitor for some first-order filtering, but this device has the fault output instead. Try running a (say) 10KHz sine wave through the ACS - what do you see on the output? It should be a 10KHz sine wave.

author: guitchess
author_rank: Regular Contributor
timestamp: October 24, 2019, 08:48:54 pm
content: Quote from: IDEngineer on October 24, 2019, 07:17:39 pmFirst, thanks for replying.Second, I'm no longer sure of anything. :/ After today's testing I only have more questions.You are correct that I should trust the device is working. I took the time/effort/risk to change the IC only to get exactly the same results.I'm fairly certain that I'm passing current. I can use the same set up with a DC motor and get perfect results. I just haven't focused on DC current because I'm trying to switch an AC receptacle.I get an AC signal on my scope(small ebay kit unit). A 60hz sine that varies in amplitude depending on amperage measured. I has a DC offset of the 1.64v, which is Vcc/2. Unfortunately, this shows my lack of knowledge/experience. In V.3 I was trying to rectify that Sine wave into something usable. I'm assuming that the DC offset is keeping the rectifier from working. It's just voltage following the whole wave.I'm sure by now I really showing my ignorance. I'll keep studying. Thanks again

author: IDEngineer
author_rank: Super Contributor
timestamp: October 25, 2019, 07:31:48 am
content: Here's an idea: Switch to one of the unidirectional ACS parts. You'll magically get only one half of the AC waveform, which will effectively act as rectification with no extra parts. Then average that using a simple RC filter (if sufficient) or a higher order filter built with an opamp, and you'll have a "DC" level that indicates average AC current flow. That can be digitized by the A/D in the PIC and away you go.In case you're wondering... yes, the ACS will still pass your normal AC current. The current sensing terminals are a direct shunt, no rectification or filtering occurs. But the unidirectional part will only "report" current in a single direction - classic single-diode rectification behavior. Follow it up with a filter and it's almost like building a small power supply.

author: ZaphodBeeblebrox
author_rank: Contributor
timestamp: October 25, 2019, 05:33:17 pm
content: Looking at your V3 schematics, I think you are overcomplicating things. I've used an ACS711 in the past as well, and the schematic was basically your V1, but without the extra capacitor on the output pin of the ACS711 (and as has been mentioned: the datasheet only allows for 1nF). The pullup on the \Fault pin should not interfere with correct functioning of this IC.You also got me very confused when you talk about the AC versus DC thing. Could you connect a known current source to the IC and measure the output voltage with an oscilloscope and post the picture? And then the same again with a varying load (say a block wave of 1kHz or similar -- or 50 Hz sine wave if that is easier)? Note: measure this without attaching the output pin to the MCU.Also, the LM358 you used does not have a rail-to-rail output, which is an issue if you want to use the full range of the ACS711.

author: guitchess
author_rank: Regular Contributor
timestamp: October 26, 2019, 06:37:25 pm
content: Quote from: IDEngineer on October 25, 2019, 07:31:48 amThat's probably a good idea, but as I am a hobbyist and a cheapskate, I hate to spend more money on parts when there is no doubt a way to solve the issues. What really bites is that when I went to research other available parts, I realized I paid twice as much as required. I could have bought the 5v version and used a separate regulator cheaper than using this device which is the 3.3v version.Quote from: IDEngineer on October 25, 2019, 07:31:48 amThanks. It turns out that's exactly the solution I found, with some caveats. (see next post)Thanks again for your input.

author: guitchess
author_rank: Regular Contributor
timestamp: October 26, 2019, 06:58:51 pm
content: Quote from: ZaphodBeeblebrox on October 25, 2019, 05:33:17 pmThat's exactly what I thought, especially after initial testing with DC. The V1 circuit worked perfectly in those tests. The issues came when I started testing AC. Then those issues where compounded by me using a noisy drill as a testing subject.Quote from: ZaphodBeeblebrox on October 25, 2019, 05:33:17 pmIt probably doesn't help that as a rookie, I'm probably not using/using incorrectly jargon that most consider basic. My confusion came from expecting the same type of output from the ACS for both AC and DC.Quote from: ZaphodBeeblebrox on October 25, 2019, 05:33:17 pmYes, I'm just using it because I have a ton of them. If I'm reading the datasheet properly, I'll lose .3v at the top and bottom from Vcc.Thanks for the reply. Any input/advise is always welcome.

author: guitchess
author_rank: Regular Contributor
timestamp: October 26, 2019, 07:38:15 pm
content: Ok, after some breadboarding, I have a V.3.1First, I gave up on testing with the drill. It still gives all sorts of weird results. My primary test load is a fan and motor. It draws about 2.4amps.Second, my inexperience kept me from being able to use the precision rectifier shown in V.3. Please correct me if this is wrong, but I think the DC offset caused this.The solution I have shown in V.3.1 comes from a simple high pass filter. Based on the scope signal, it removes the DC offset and crudely rectifies the signal. I've used a pot to GND so I can tune the voltage input to somewhat match the amperage of the test load.The LM358 still seems to be necessary as a buffer.Unfortunately, the voltage offset of the LM358 and the PIC keep me from being able to use the ACS to its full potential. However, the "flaw" in the design may turn out to be a benefit, allowing me to set the minimum current allowed to trigger the relay.I've attached V.3.1. As usual, input is always welcome.I realize there are still flaws(no base resistor).Thanks

author: StillTrying
author_rank: Super Contributor
timestamp: October 26, 2019, 08:41:37 pm
content: What a mess!An LM358's output will only go up to about 1.8V with a Vcc of 3.3V, so it's not a lot of use.All you really need to do is apply the ACS711's 1.65V output directly to the PICs ADC, and thendetectwhen it changes from the 1.65V level.

author: IDEngineer
author_rank: Super Contributor
timestamp: October 26, 2019, 10:10:50 pm
content: Quote from: StillTrying on October 26, 2019, 08:41:37 pmAgreed, but I would still switch to the unidirectional ACS part. Doing so gives you two things: The inherent rectification I mentioned earlier, and a significant increase in useful dynamic range. The bidirectional part has a quiescent output bias of 1.65V. That means the bottom HALF of its dynamic range is essentially useless. The output of the unidirectional part goes from Gnd+0.5V to Supply-0.5V, and would only report on the positive half of your waveform. This nets you a huge increase in useful dynamic range and you can apply it directly to the analog input pin of the PIC.Going unidirectional has a bunch of benefits. Why mess around with a pile of extra parts, and settle for design compromises, when a single part swap will address so many deficiencies using fewer parts for less money?

author: guitchess
author_rank: Regular Contributor
timestamp: October 27, 2019, 04:32:57 am
content: Quote from: StillTrying on October 26, 2019, 08:41:37 pmYes I know. That's what happens when an old, uneducated redneck carpenter decides to step into the complex world of EE.For the purpose intended, the low rail cap is not important. Since I'm feeding to a 3.3v PIC, I didn't really think I would need the headroom, especially considering the simple purpose of the circuit. However, if that changes, I can always supply the 358 with a separate regulator, or even directly from the main supply.Connecting directly is how I started. With DC it works perfectly. With AC, the PIC sees the DC offset, but does nothing with the amplitude change caused by more current. My meter also sees it the same. For some reason it did while testing with the drill, but 3 other AC loads have the same effect. With this new circuit, it works with every AC load I've applied except the drill. I'm at a loss on how to get the PIC to detect something I can't even see with the meter.

author: guitchess
author_rank: Regular Contributor
timestamp: October 27, 2019, 04:55:00 am
content: Quote from: IDEngineer on October 26, 2019, 10:10:50 pmWhat you have to keep in mind is that I am a hobbyist trying to recreate from scratch a device that I can buy commercially for $40-$50. If I order a new part every time a super smart and more experienced engineer suggests, I'll have $50 in parts lying here with no project in mind. Foolishly chosen or not, I will find a method to use what I already have, however inelegant that may be.I am not bucking what you've offered out of stubbornness, just merely expressing my state of mind.Also, my search on Digikey showed only a few unidirectional parts with similar specs and they were over $5 each(more than I have in the rest of the board). They have a 5v version for $2.81, but since it would be feeding a 3.3v PIC it's really not much benefit.I have no optimistic delusions that I will port this to a commercial product and make a zillion dollars. It will be made 3 or 4 times(probably still optimistic) for some fellow carpenters as an educational project for me and as gift for friends.As always, thank you and thank everyone for your input.

author: StillTrying
author_rank: Super Contributor
timestamp: October 27, 2019, 10:10:35 am
content: Quote from: IDEngineer on October 26, 2019, 10:10:50 pmYes, with a +/- 25A ACS711 and an 8-bit ADC its resolution isn't going to be high, but maybe good enough for the OP's current level detection.I'd get rid of the LM358.For the AC current measurement I'd probably provide aset zerowhich averages and remembers the ~1.65V zero current level, and then averages lots of ADC valuesabove and belowthe 1.65V zero level, which should give a binary value equivalent to 0.9x the RMS value of AC current.Quote from: guitchess on October 27, 2019, 04:55:00 amIs it to switch on/off a dust collector.

author: guitchess
author_rank: Regular Contributor
timestamp: October 27, 2019, 03:48:44 pm
content: Quote from: StillTrying on October 27, 2019, 10:10:35 amYes it is. At least switch a vacuum. My friends don't have a dust collection system and mine has a startup spike that I'm fairly sure is more than this 711 can handle. May give it a try though. I would also have to upgrade the relay.I also have plans to use one to start a fume extractor when switching on my soldering iron. I may go with a DC motor, however.Thanks

author: ZaphodBeeblebrox
author_rank: Contributor
timestamp: October 27, 2019, 07:08:40 pm
content: Quote from: guitchess on October 26, 2019, 06:58:51 pmBut AC is only DC that changes polarity? I'm assuming you are using a net frequency of 50 or 60 Hz, so from the point of view of the ACS, that is DC changing polarity - it should output more than Vcc/2 for the positive half, and equal that amount under Vcc/2 for the negative half.You could then choose to calculate the RMS or quasi-peak value directly in hardware, or let the ADC of the MCU sample it and do some basic DSP'ing there. I don't thick you need a very high sample rate to get something workingQuote from: guitchess on October 26, 2019, 06:58:51 pmI'm afraid the actual value is worse: you'll only get as high as 3.5V (and that is pushing the limit), which means you lose 1.5V.I really think you should remove the output cap of the ACS711 too. The datasheet mentions a maximum value. Since there is no real need to place a capacitor there anyway, why even put one there? Fewer components leads to fewer headachesOn another note, the difference you see between different loads could be due to RF currents being measured? This can be solved by placing a small capacitor right across the sense terminals of the ACS711 (something like X7R, 10 nF, 0603 would probably be a good start if this is the case). I have never seen this happen though (which does not mean it can't).