Measure Any AC Current up to 30A with ACS712 and Arduino
HTML-код
- Опубликовано: 27 авг 2024
- Wassup!! This tutorial is about measuring any Alternating Current (AC) using the ACS712 module with Arduino Uno board, I also add a LCD screen at the end and a code for OLED too.
This code uses a method that permits yous to measure the AC current of any shape without any problem, and turn your Arduino to a TRMS Ammeter.
Wiring and codes:
surtrtech.com/2...
Measure Any AC Voltage up to 250 VAC:
• Easy measure of any AC...
Arduino Modules playlist:
bit.ly/2Dh4pJC
Arduino Projects playlist:
bit.ly/2Fxm2Y7
Arduino Shields playlist:
bit.ly/2APsndI
Siemens TIA Portal playlist:
bit.ly/2MhtSFT
Facebook: / surtrtech
Twitter: / surtrtech
Hello, all the wirings/libraries/codes can be found on the link below the video.
I'm sorry, the video was supposed to be around 7 - 9 minutes but ended up 25 minutes long so here's a map to help you skip to the part you want:
- Beginning : Little talk, setup the test bench and signal visualisation
- 9:26 Here we have a simple code that can measure sinewaves signal only and displays it on the serial monitor
- 14:41 Here's the code that works with all signal shapes, can measure the TRMS of any signal and displays it on the serial monitor
- 18:13 Explaining how to get the slope intercept values
- 24:20 Adding the LCD to the last code
Hi SurtrTech, Is this module reliable for continous use with arduino uno.if i ask you to suugest one from ACS712 or CT 12A-100 module which will you recommend.
Hello, well I've never tried the CT 12A, for me it's better to work with non invasive current transformers, it's more safe and can work for a longer time without a problem.
pro trick : you can watch movies on flixzone. Been using them for watching lots of of movies these days.
well. thats a good video. popular youtubers never do things we require. i cannot believe that you have only this much subs.
Great video, thanks for sharing. For the algorithm to be perfect, just need to measure also DC. Good job!
great work
i was look for precise current reading and the code i made was based on theory
but your code is based on practical values
thank you a great help , this is the proper way to measure sine wave current
keep it up : )
💯Very nice explanation. Thanks for sharing.
would that code work on mini arduino ? would it work on high frquency also like 300kHz?
Hello, I'm trying to measure V and I from a 30 W solar panel with Vmpp 17.2 and Impp 1,74A. I'm not getting accurate measurements from it. how would you suggests I change that.
Hi there, i dont get that sine wave at the beginning of test 1. Is there something wrong with my acs712?
Hello, make sure it's wired correctly, it should be in series with the circuit, also make sure that you have a load ! it's also better to add an Amp meter to make sure you have current there.
Hello sir, i have done the code part accroding to your code, but i can't get the intercept and slope correctly ,according to your sensor it's give you zero in inputStats.sigma() when no cureents flowing throuh it,but my case i have values even if the current is not flowing ,can't i get the your values in my sensor? or if it's not can you give me a way to calibrate intercept and slope precisely.
Hello there!
I am getting accurate results with this code but the problem is being that when i am converting these with my CT turns ratio it gets more complicated to me on 0 Amp it's showing offset amps.
So how can i get rid of it?
Please help me out if u understand it.
Thank you
Wondering How to measure uA on arduino, I have failed on ideas how to. Any Ideas please. I have ordered INA219 and INA226 and nothing, only at order of mA and above. How about this sensor, Can I detect uA to get mV or uV units?
Hello, Sir good day! Is it possible to add a gsm arduino shield in the circuit? I want to ma a Open Cicuit Alert System. Basically, I intend to make an alert system that sends a text message if the current ammeter detects 0 current. Is that possible?
I calibrated using 3 loads(0,75,200 kw) and got the intercept and slope value,but when i put a load of 250kw it will give me wrong currnet value and also i am getting higher fluctuation in the inputStats.sigma() function. can you give me solution to overcome this problem.
runningstatistics?
what a video and project
Thank You so much Sir
can you share a little bit of information in the second test why do you multiply 0.06?
As I said it's just to get the right values (calibration), that value is my own, when you do your own test remove it first then put something else if needed... The test 2 is not that important as it fails once the signal's shape changes.
This is awesome, just what i've been looking for - thank you !! I have a question though, i'm trying to implement this into a larger project which reads data from a solar charge controller, checks the DC amps in (from charge controller) and AC amps out (using your code) and switches on different loads as and when enough power is available.
But i'm really struggling to get your code to work outside of the "while" loop, when it gets to this section it just loops infinitely (as originally intended). Ideally i'd like to run a few instances to get an accurate reading and then move on to the next thing in the main void loop. I've tried adjusting the code to run through only a few iterations but every time it just gives me messed up Amp readings - any advice would be greatly appreciated !!
Hello, thank you, first I recommend you to test the code as it is and make sure you've set your "slope" and "intercept" values, then you can move "RunningStatistics inputStats;" as a global declaration, move it next to the libraries declaration.
Then put this function "inputStats.setWindowSecs( windowLength );" in the "Setup" function.
After that Take everything in the loop and put it in a separate function, instead of "while" loop -Here's an example-:
void Read_Amps(){
ACS_Value = analogRead(ACS_Pin); // read the analog in value:
inputStats.input(ACS_Value); // log to Stats function
if((unsigned long)(millis() - previousMillis) >= printPeriod) { //every second we do the calculation
previousMillis = millis(); // update time
Amps_TRMS = intercept + slope * inputStats.sigma();
}
And in the loop you can use Read_Amps() to call the function and add some prints to display the value.
Here you have to be very careful if you want to use it with another things, this method requires a lot of readings to give the right value, I recommend adding a "For" loop and do at least 10 readings before getting the value.
Do the tests to be sure and adjust if needed.
@@SurtrTech you are amazing, thank you so much for taking the time to get back to me and for providing such a detailed well explained and speedy response! I'll give your suggestions a try and hopefully get this up and running soon :)
@SurtrTech Just wanted to let you know that this worked perfectly, thank you again for you help and excellent code !!
Glad for you.
That's great. Thank you man. However During test our code I opened Serial Monitor and found it at the first or second line.
It showed high value . It seems incorrect and so strange . How can I fix it ?
The code algorithm needs to do multiple readings before giving the correct values...
Thank You
👍
can me instal 3 sensor acs 712
Can this measure up to 300v ac?
Hello sir, i want to use this project using NodeMcu, but when i am uploading it to the board, the board is getting restarted repetitively can you give me some idea?
If it gets reset everytime it means it's stuck on some place... try moving the two declarations on the loop to the setup and remove that while... I'll try uploading a video using a NodeMcu.
@@SurtrTech thanks for your response sir...will wait for the nodemcu code...
To not make you wait because I don't know when it will be uploaded:
Those line below, try to put them in Setup, and remove that while(true) from the loop.
RunningStatistics inputStats;
inputStats.setWindowSecs( windowLength );
Hi , can we use the same code to measure DC current ??
Not tested but probably not, the DC is easy to measure, with just a proper calibration you can measure DC.
Real Current = a * Measured value + b... "b" can be obtained by calibrating at 0A real current and "a" can be calibrated at a value.
Can it be used to measure the current of 50A??
Depends on the module type, mine is 30A.
can we measure 200A with this code?
Depends on the module type, mine is 30A.
@@SurtrTech actually i am using solid core Current transformer with the rating of 200A/5A with ACS712 5A module and trying to achieve result with the help of these technique if you have done this before so it might be helpful for me.
Thankyou.
@@shehriyarbinak3776 I've never did that but I think it should be possible, but if you're wishing to go up to 200A better use ACS712 10A so you won't be too much close to error margin.
@@SurtrTech Thanks for you feedback your method of doing work is really very appreciated.