Using the ACS712 Hall Effect Current Sensor Module (part 3)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so here's the acs-712 current sensor module and i've hooked it up to a leonardo arduino and it's just sitting there with nothing connected to the high current side so it's measuring zero amps so i'm expecting the data coming out of this thing to be zero let's have a look now the first number there is amps and it's just measuring 0.03 0.05 and occasionally some other numbers the second number there is noise um so what i've done is i've got it to measure the lowest number it's ever seen and the highest number it's ever seen and calculate the difference and at the moment that's showing 130 milliamps so the code is here i've added a few statements the first line there amps equals 516 minus analog read 27.03 amps is the full scale deflection on the current sensor and 1023 is the number of analog to digital steps but the new lines i've added are max amps is using the max function the maximum of max amps and current amps min amps is the minimum of min amps and current amps and noise is one minus the other so we're getting 130 milliamps of noise and that's a problem because it's causing uh havoc with my current measurements for the mppt charge controller so i was wondering whether i could get that noise figure down now i did think of using an averaging technique which is simply to take the current amp's value and average it with the previous amps value but what i wanted to do was look at the data sheet and see whether there's anything on there that would help with the noise figure so on the datasheet there's this graph and it plots the noise figure in amps or milliamps up the left-hand side against the capacitor filter and the capacitor filter is a little capacitor that's attached to pin six of the chip now if you look at the module um it's one of those two capacitors one is just a decoupling capacitor on vcc the other one is the filter cluster i think it's the one on the right in this image and on this module it happens to be a 10 nano farad but on other modules i've got um there's different one there's a one then a third so let's look at what the noise figure should be for those capacitors so looking along the bottom um well let's look at first with no capacitor or that 0.01 nano farads which is what um 10 picofarads is it yeah 10p if you count up from the 100 milliamps on the left side there 200 304 so it's about 500 milliamps of noise with a one nanofarad it's about 400 milliamps of noise with a 10 nanofarad that's about 200 milliamps of noise now if you go up the 100 nanofarad has about what's that 100 milliamps of noise and they also show these last two are 220 nanofarads and 470 nanofarads and if you go for the top of the shop value it looks like you can get the noise down to about 75 milliamps so here's another acs-712 module that i've got this one just happens to have a very bright red led on it but you can see that i've soldered the 470 nano farad 474 it's marked directly across the existing filter capacitor so i've now got the maximum filter capacitor on there that the data sheet recommends and if we look at the output coming from the module now things are a lot more stable um the only two numbers i can see in terms of amps the first figure is 0.03 and 0.05 and the second figure which is noise is now down to 30 milliamps so that's actually a lot better than the data sheet was predicting it said 75 milliamps and i've got 30 milliamps so that seems to be a result now of course you don't get something for nothing there is a trade-off and if you look at this table down here you'll see that by raising the filter capacitor value it affects the rise time so the one nanofarad the rise time is 5.8 microseconds with the big 470 nano farad capacitor the rise time is 11 20 microseconds so that's 1.1 milliseconds but that means that you'd be limited to taking current measurements uh less than a thousand times a second but that's still pretty fast 500 250 times a second for example you'd be able to get away with and i'm only reading current here about 10 times a second so for my application 470 nanofarad capacitor is perfectly fine now as i say i was wondering whether i could get that number even lower by doing a bit of digital filtering and if you look at the second and third lines in the loop function there amps equals amps plus last amps divided by two last lamps equals amps and that's just a simple averaging you're taking the current amps value adding it to the previous amps value dividing by two just averaging the two values and if we look at the numbers coming out we've still got 30 milliamps of noise but i've just put in a reset facility so that's reset it now and for a while it sits there on 20 milliamps of noise we're getting three numbers coming out that's flipped up to 30 milliamps now so it has a small beneficial effect ultimately it doesn't um reduce the noise further but it it probably smooths it and that might help for um my application where i'm measuring watts multiplying amps by volts so a small extra benefit can be gained by doing a little bit of digital filtering but averaging is a very crude technique so you're not going to get a huge amount of benefit but i'm quite happy with that i'm now down at 30 milliamps of noise whereas previously i was at 130.
Info
Channel: Julian Ilett
Views: 73,546
Rating: undefined out of 5
Keywords: hall effect, acs712, arduino, leonardo, microcontroller
Id: etsIFUUhO6I
Channel Id: undefined
Length: 6min 55sec (415 seconds)
Published: Fri Jul 26 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.