Easy measure of any AC voltage with Arduino and ZMPT101B (up to 250V)

  Рет қаралды 72,747

SurtrTech

SurtrTech

Күн бұрын

This is the easy and the precise way to measure AC voltage of any shape, not like the other one that rectifies the signal or use a peak to peak measure to calculate the RMS, here we're using a simple library and a simple module to calculate the True RMS of any voltage, sine, triangular and square ...
No sketchy wiring no false code, be careful don't mess with the powerline.
Please consider a Like and Subscribe
Wiring and codes:
surtrtech.com/2...
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

Пікірлер: 112
@SurtrTech
@SurtrTech 5 жыл бұрын
People who have trouble with Slope/Intercept values, Sorry my bad I tought it was clear, you can check my tutorial about AC current measuring using the same method: kzbin.info/www/bejne/fZS2d6l9Zql5eJI at 18:00. It may look a bit different because it relies on the module potentiometer setting first, then on the testing conditions. Mine required a "further calibration" part, because I used it first in other things and didn't want to lose those values, you can skip that and set only the correct slope and intercept.
@nitinkumar29
@nitinkumar29 4 жыл бұрын
Best way to calibrate it to use the relay between this module and connection to power socket. Open the relay, then take lots of sample and average the values to get zero value or mid value where zero crossing will happen. Then close the relay, so now you will have live voltage to the module. This calibration can be implemented as a function, called in the setup function and later using command for runtime calibration. Of course, you have to find the slope using the voltage values and sensor adc measurement, say 0v will be near 512 and 230V may be near 740 depending on the trim position, consider the sensor as linear and save as a global variable and use this slope for further calculations. Also, you have to set the pot so the waveform is not clipped in the voltage range you want to measure, this has to be done in the beginning, if you have oscilloscope the better else this video describe it beautifully. By doing above mentioned step, you won't need any filtering library or complicated passive calibration calculation routine. For sine wave, you don't need to take sample and sum and take mean of it to be squared off later, wiki says if signal is sine wave, you can divide by square root of 2, just run a loop of say 100 or 1000 samples and find peak value, convert to rms value and then using slope and new reading, find out new rms voltage. That's it.
@algunvatansever8283
@algunvatansever8283 3 жыл бұрын
Is there a module that performs exactly the same function as this module?
@gulshan0799
@gulshan0799 4 жыл бұрын
does it has any protection if exposed to 260 - 270 volt Ac ?
@aliens1192
@aliens1192 4 жыл бұрын
Thanks for the video, buddy! :D
@perceptrongaming4290
@perceptrongaming4290 4 жыл бұрын
great job!, but i think think the best way to find rms of any periodic wave would be through basic stuff...like ...taking square of n samples,divide by n and taking the square root of the the result .
@nitinkumar29
@nitinkumar29 4 жыл бұрын
If you know that your signal is sinusoidal then you don't need to do that, just take samples and get maximum value or peak value and then divide it by square root of 2. For square wave, rms value is peak value and for trapezoidal wave, it is square root of 3 instead of 2 for division. No need to make it more complicated, because it is not easy to sample and calculate rms values with arduino, you have to consider the timing and zero offset for zero crossing for wave.
@LifeGeneralist
@LifeGeneralist 3 жыл бұрын
On you cheap multimeter, check if the battery is new and has proper voltage. Most multimeters show inaccurate readings due to that battery
@SurtrTech
@SurtrTech 3 жыл бұрын
No, it's not... you can check in the video, on sinewave it works fine but on unsual shapes it start measuring wrong. Check for difference between TRMS and RMS multimeters.
@50Hz
@50Hz 5 жыл бұрын
Pretty cool, I used a Energy Metering IC to measure AC
@hacker6695
@hacker6695 Жыл бұрын
can we increase the range of measurement upto 300V ?
@mohamedsuhailirfankhazi6628
@mohamedsuhailirfankhazi6628 5 жыл бұрын
Hello my friend. Thank you for this awesome tutorial. I would like to ask if you can please elaborate a little bit more on how you went about finding the slope and intercept values. It would be helpful.
@SurtrTech
@SurtrTech 5 жыл бұрын
The hard work of RMS calculation is done by the Filters library and its functions... If you don't add the (intercept / slope) calculations, you'll read false RMS values, and they need a little calibration further, it's like that all the RMS values are making a line of sultions, this line should be adjusted so we make: "y=mx+b" where "y" are the new correct solutions, "x" are old solutions (They are still RMS values), "m" is the slope and "b" is the intercept. You can find your own slope and intercept by just measuring two or more known values with a multimeter then compare these values with ones measured with Arduino without the (slope/intercept).
@DissyWorld
@DissyWorld Жыл бұрын
My voltage sensor shows noise in output but current sensor dose'nt show any noise to direct supply. Is my voltage sensor faulty??
@alzaroughalzarough6153
@alzaroughalzarough6153 Жыл бұрын
can I use this. sensor with Arduino Due board, if so how to achieve that??
@rubijantojunipribadi9485
@rubijantojunipribadi9485 5 жыл бұрын
this helps my project, thanx u v much
@smoothengineering42
@smoothengineering42 3 жыл бұрын
hello friend, I am facing some problem while using the sensor, the calibrations is not working. with lower voltages less than 30V i get a clean sine wave but the wave forms gets distorted if the voltage is 220V. I tried increasing the VCC input voltage still wave form is looking very bad, for my work i need to capture the waveforms and use it in some other works. what can i do to make the waveform looks better?
@impulse_ger
@impulse_ger 4 жыл бұрын
Is there a module to measure up to 50v dc?
@karthick4683
@karthick4683 5 жыл бұрын
Is that Current limiting resistor and sampling resistor has to be connected mandatorily?
@alzaroughalzarough6153
@alzaroughalzarough6153 2 жыл бұрын
hello there, can I use this code with arduino due board??
@AlexAlexOmsk
@AlexAlexOmsk 2 жыл бұрын
работает! спасибо!
@ML-sr2ep
@ML-sr2ep 5 жыл бұрын
The output of this transformer is 5V max, 0V min, with 2.5V at the "zero" crossing? What is the deal with the 2 mA rated output? Is that just the max current output? We are still programming the arduino to scale the 5Vpp back up to 120V/220V?
@SurtrTech
@SurtrTech 5 жыл бұрын
I don't know if you're talking about the transformer part only or the whole module, that 2mA output is because there's a sampling resistor and this type of transformers is made for measurements only, the output voltage of the transformer is 0 - 5 VAC but the output of the module has a 2.5 V offset and it varies between 0V and 5V. The Arduino has to deal with a voltage that varies 0 - 5V but in the screen we should display the real value at the transformer input.
@zest167
@zest167 5 жыл бұрын
Hi, I'm a last year student using this module. Could you explain how the module add voltage offset to rectified the low AC voltage?
@SurtrTech
@SurtrTech 5 жыл бұрын
There's a transformer that lowers the AC voltage, there are two OpAmps, one sets the amplitude of the signal you can set with a potentiometer, the other one adds a 2.5VDC to make the offset at 2.5V instead of 0V because you can't put negative signal to the Arduino. I have a PDF document about the module but it's in Thai (I don't speak it), if you can't too you can translate it or just read the schematic, send me a message on Facebook page.
@zest167
@zest167 5 жыл бұрын
@@SurtrTech Thank you for replying. This is really the answer I was looking for, I was wondering why there are 2 op amp in the module. It meant a lot for me(and my thesis), thank you so much.
@SurtrTech
@SurtrTech 5 жыл бұрын
@@zest167 You're welcome.
@hkmun8779
@hkmun8779 6 жыл бұрын
You have done a great project. I had tried this too. I had tried connecting the ZMPT101B voltage sensor to the Arduino UNO. The ACC pin, OUT pin and Ground Pin of the ZMPT101B are connected to the 5 V pin, A0 pin and Ground Pin of the Arduino UNO respectively. The ADC output should be around 512 at 0 V input voltage. However, I can't get this value, the ADC output of my Arduino Uno is only 35. This project is really important to me. Could you advise me on that matter?
@SurtrTech
@SurtrTech 6 жыл бұрын
This is strange, Try to use a potentiometer only with one analog input and check if the values goes from 0 to 1023, if okay it means the ADC is good then try to power your module and check if it has correct power (5v) and check its output with a multimeter
@hkmun8779
@hkmun8779 6 жыл бұрын
Thanks. I had checked the ADC (A0) is working well. You said that check if it has correct power (5V). Which pin of ZMPT101B voltage sensor that I should check?
@SurtrTech
@SurtrTech 6 жыл бұрын
@@hkmun8779 Just the Vcc and GND pin should be 5v there, I think there's a light in the module that shows that it's powered
@hkmun8779
@hkmun8779 6 жыл бұрын
@@SurtrTech Yes, it is power and the internal LED is light up
@SurtrTech
@SurtrTech 6 жыл бұрын
Well try to measure with a multimeter between the Output pin and the GND pin or Vcc pin and GND pin while the module is powered by 5v and don't use the terminal for the AC input so it should be a 0, and on your multimeter you should read around "2.5V" which is "512", if you don't have this value I'm afraid that something is wrong with the module.
@abdulraheemm5797
@abdulraheemm5797 4 жыл бұрын
Sir i m facing a problem with filters.h library
@alepassos3022
@alepassos3022 3 жыл бұрын
Hello, do you know some DC module to measure upper 30V? I just found one to measure from 0-25V.
@syafiqsallehudin2650
@syafiqsallehudin2650 4 жыл бұрын
what is the max current input that the sensor can withstand? 2mA as per stated?
@SurtrTech
@SurtrTech 4 жыл бұрын
A perfect voltmeter should have 0A (open circuit), the 2mA is just the maximum parasitic draws, ideally shouldn't be there.
@syafiqsallehudin2650
@syafiqsallehudin2650 4 жыл бұрын
@@SurtrTech oic, thanks!
@nitinkumar29
@nitinkumar29 4 жыл бұрын
How did you get 311V value?...by multiplying 220V to square root of 2?
@nitinkumar29
@nitinkumar29 4 жыл бұрын
Got it, yes the wiki says so, it should be that...Vpeak = Vrms x sqrt(2).
@shehriyarbinak3776
@shehriyarbinak3776 4 жыл бұрын
why you have multiply 40.3231 with current_volts?
@johnarvinlising6834
@johnarvinlising6834 5 жыл бұрын
Hi! How do you set your assumptions/calculations for the values in the code? the 40.3231 one and the -0.04?? is there formulas i can use to obtain them? or is there any graph i should use/see?
@SurtrTech
@SurtrTech 5 жыл бұрын
The RMS values measured can be offset sometimes for example a real 0VAC it will give you another value so you should set the "intercept" to calibrate it, then same thing for a real 100VAC it will show another value so you set the "slope", it's like a line of solutions that you need to calibrate.
@nitinkumar29
@nitinkumar29 4 жыл бұрын
@@SurtrTech I used a relay instead of intercept, I cut the connection using relay, takes around 100 values and average them to determine zero value, then turn turn the connection on.. my offset is 0.708 (using 0V, 220V and 0V and 253V) after adjusting trim pot which I calibrated using an oscilloscope. I tested between 230V and 253V, because that's two voltage i have because of 3 phase residential connection(one regulated to 230V, other unregulated) . My measurement comes under +-2 Volts. It doesn't exactly goes to 0V though, but doesn't matter anyway.
@mutiulmuhaimin9156
@mutiulmuhaimin9156 3 жыл бұрын
Does 512 always read 2.5V? And this is the RMS, right?
@SurtrTech
@SurtrTech 3 жыл бұрын
Arduino's analog input goes from 0-5V and the analog digital conversion goes from 0-1023... Yes 512 corresponds to 2.5V.... that's not the AC voltage RMS, that's the module output when you have 0VAC at the input.
@MrZomhad
@MrZomhad 6 жыл бұрын
Thanks a lot! Cheers
@DEEPAKSV99
@DEEPAKSV99 4 жыл бұрын
At what frequency is the Triac operating in this video?
@SurtrTech
@SurtrTech 4 жыл бұрын
Twice the main frequency, main is 50Hz.
@DEEPAKSV99
@DEEPAKSV99 4 жыл бұрын
@@SurtrTech Thanks for the quick reply. Also at 8:08 the time period of the waveform seemed to be around 7 seconds (while plotting at a rate of 10Hz). Could you tell me how did you generate that waveform?
@SurtrTech
@SurtrTech 4 жыл бұрын
@@DEEPAKSV99 Just change the delay until you get the waveform you want, of course that's not real time (you won't be able to see anything), so you keep playing until you get a more/less synchronized waveform with a lower frequency.
@DEEPAKSV99
@DEEPAKSV99 4 жыл бұрын
@@SurtrTech Wow. That seems to be such an intelligent method to view the Waveform at a slower speed. Haven't thought of this before. Thanks for the idea. . .
@tlogic23
@tlogic23 5 жыл бұрын
Can I use ZMPT107B instead.. I am planning to implement the module in a PCB.. Please advice
@SurtrTech
@SurtrTech 5 жыл бұрын
Hello, if the 107 has the same specifications as the 101 you can use it, same output and current..., the differences in some errors marges is not a problem, and if you can contact me on Facebook: facebook.com/SurtrTech/ Or Twitter: twitter.com/SurtrTech, I'll send you a document that I found about the module, in Thai (I don't know that neither) but contains the schematic.
@ShopperPlug
@ShopperPlug 3 жыл бұрын
You can't fiddle around using code based on arduino IDE, it has too much overhead and will give nothing but problems. You need to write in pure c code and also use interrupts without all the arduino IDE overhead.
@rrestapani
@rrestapani 5 жыл бұрын
Hello there could this module to withstand 115VAC 400Hz? And also do you have advise what kind of current module and frequency module should I use for interfacing with arduino? Thanks in advance.
@SurtrTech
@SurtrTech 5 жыл бұрын
For the frequency, I don't really have concrete idea, the recommended one is 50Hz-60Hz but for 400Hz I don't know, for the current you can ACS712 or GY712, or a split core one like SCT013 And you can use the same algorithm to measure its RMS too. To measure the frequency you can measure the duration between each peaks or between every 2 zeros and do the math...
@rrestapani
@rrestapani 5 жыл бұрын
@@SurtrTech SurtrTech thank you for fast respond, you've explained very clear. I'm preparing for my final year project and it's related to generator produces 115VAC 400Hz as mentioned above. Please don't be bothered if I ask you again one day 😃
@SurtrTech
@SurtrTech 5 жыл бұрын
@@rrestapani No problem, I hope I helped.
@mastiff1995
@mastiff1995 5 жыл бұрын
Having a hard time calibrating this, Using the initial basic code. I doing this at 120vac and 60hz, would the code be different?
@SurtrTech
@SurtrTech 5 жыл бұрын
You'll have to modify the frequency in the top, it's 50 make it 60, for the calibration the slope and intercept are very difficult to calibrate, so the easy way is to calibrate the part where you find //Further calibration But if you give enough time to calibrate slope and intercept you'll have better results
@mastiff1995
@mastiff1995 5 жыл бұрын
So start the calibration with float testFrequency = 60; // test signal frequency (Hz) void setup() { Serial.begin(9600); } void loop() { Serial.println(analogRead(A0)); } like this?
@SurtrTech
@SurtrTech 5 жыл бұрын
Did you ask about the first code where there's only "analogRead"? No there you don't have that testFrequency variable
@karthick4683
@karthick4683 5 жыл бұрын
Is this sensor measures 250V peak (or) the 250V rms ?
@SurtrTech
@SurtrTech 5 жыл бұрын
RMS
@karthick4683
@karthick4683 5 жыл бұрын
@@SurtrTech Can the sensor sustain the 353.5 V peak value?
@BG-dk2lp
@BG-dk2lp 6 жыл бұрын
Hi, I really like this project Can you tell me, from your code , where you got the values below ? float intercept = -0.04; // to be adjusted based on calibration testing float slope = 0.0405; // to be adjusted based on calibration testing current_Volts= current_Volts*(40.3231); //Further calibrations for the amplitude I have adjusted the Trim Pot as you suggested ..and the readings look good - . what is my next step to calibrating ? How do I get the the readings translated to the correct voltage. NOTE: My AC voltage is 240 Volts so I assume the values you have above are not correct for me ? How do I get the values I need ? thanks
@SurtrTech
@SurtrTech 6 жыл бұрын
Hello, it's the 3rd time you ask the same question I responded you on Hackster and my website I hope you read them.
@taro9751
@taro9751 4 жыл бұрын
Thanks a lot
@zivkloda882
@zivkloda882 4 жыл бұрын
hi, can i measure the AC frequency with this sensor?
@SurtrTech
@SurtrTech 4 жыл бұрын
Probably, but I've never did it, you may wire the module take a value to measure with and calculate durations... should give you the frequency.
@zivkloda882
@zivkloda882 4 жыл бұрын
@@SurtrTech Okay, what is the value I take for the purpose of doing this calculation? Because there is no such thing in the sketch
@SurtrTech
@SurtrTech 4 жыл бұрын
@@zivkloda882 Well, this sketch is not meant to do that, you asked if "it's possible with this sensor?" The sketch should be changed completely, take any raw value as long as it's not the peak of the sinewave and everytime the signal passes through that value trigger a duration counter and stop it on the signal period, few math and you got the frequency. example take value 600, when it reaches trigger the duration counter and when the value reches 600 again don't stop it, but stop it when it reaches 600 the third time. 1/duration=frequency. Looks interesting may do it some day.
@nitinkumar29
@nitinkumar29 4 жыл бұрын
You can certainly do that, you have to sample and find the count of maximum values in a second, you can use timer. Other way to do the same is comparator to process the signal to square wave pulse and then use arduino to detect its frequency.
@ArvindRao33455
@ArvindRao33455 5 жыл бұрын
Is it 240 volt rms or 240 volt peak?
@nitinkumar29
@nitinkumar29 4 жыл бұрын
240Vrms
@Remontnik_
@Remontnik_ 4 жыл бұрын
like/ Но почему всего лишь до 250 вольт? Разве до импульсных 280 вольт нельзя скейч написать?
@ahmadfaqih5968
@ahmadfaqih5968 6 жыл бұрын
I want to ask, do we need to add an llibrary to the Arduino IDE application?
@SurtrTech
@SurtrTech 6 жыл бұрын
Once you install the IDE it comes with few libraries, if you need others you can download and install them...
@mufidzzukhruf3497
@mufidzzukhruf3497 5 жыл бұрын
Hello, I using the ZMPT101B on my research, if I want to use this method, where I can find the paper referencing that formula(s)? Thanks a lot my friend
@SurtrTech
@SurtrTech 5 жыл бұрын
First you need to know how to calculate the RMS of any signal, there are some good subjects about this on the internet, but since those calculations cannot be done by a computer in the same exact way, if you want to know how its done here, check the "RunningStatistics.h" file in the "Filters" library, and you'll find how it's done using the Sigma, Variance, Average...
@aurdinoexplorer6353
@aurdinoexplorer6353 5 жыл бұрын
can the module withstand 80 amp ?
@SurtrTech
@SurtrTech 5 жыл бұрын
This is a voltage sensor, it's wired parallel to the load, it doesn't consider the load amps, you just have to consider the voltage 0-250VAC.
@omaral-gallab7735
@omaral-gallab7735 2 жыл бұрын
Can you shearing your cood
@TheDarkforce95
@TheDarkforce95 5 жыл бұрын
can i get the zmpt101b fritzing part ?
@SurtrTech
@SurtrTech 5 жыл бұрын
Hi I just have a PNG image that I inserted there. Here's its link if you want it: drive.google.com/file/d/15Qx__7YBNRmUHkQpN9UurQ5EwEHYljJc/view?usp=sharing
@androidsha4995
@androidsha4995 4 жыл бұрын
I am Try ur method it working well but if i use any "delayMicroseconds() or use TM1637 Library" it value is not stable ,now this condisition what can i do ,please help. Library of TM1637:github.com/avishorp/TM1637
@electricalengineeringsures7965
@electricalengineeringsures7965 3 жыл бұрын
Voice is very low
Measure Any AC Current up to 30A with ACS712 and Arduino
25:52
Вольтметр на Arduno/ Измеряем напряжение до 1000в на ZMPT101B
14:44
Интересные Самоделки
Рет қаралды 1,3 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
#347 Measuring Mains Voltage, Current, and Power for Home Automation
24:10
RMS Voltage Sensor Part2: Setup & Calibration
16:43
EETechStuff
Рет қаралды 12 М.
Control AC Devices with Arduino SAFELY - Relays & Solid State Switches
43:46
The world's worst video card?
32:47
Ben Eater
Рет қаралды 7 МЛН
Measuring AC Current with Arduino
19:29
misperry
Рет қаралды 79 М.
Op-Amps  - Using Operational Amplifiers
44:21
DroneBot Workshop
Рет қаралды 312 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН