DIY ESP32 AC Power Meter (with Home Assistant/Automation Integration)

22. 11. 2020
179 681 zhlédnutí

Have fun and win via JLCPCB E-exhibition:
$2 for 4-Layer PCBs:
Previous video:
Home Assistant video:
Power video:
Support me for more videos:
More project information (pictures, schematics,....) on Patreon:
Parts list: (affiliate links)
Current Transformer:
Voltage Transformer:
Resistor Kit:
Capacitor Kit:
Websites which were shown in the video:
In this project I will show you how to build an ESP32 AC power meter that can be used with your home assistant setup. That means I will firstly explain how to actually measure and calculate real and apparent power along with the power factor and then I will show you how to use the ESP32 in combination with some complementary components in order to create the power meter. Let's get started!
Thanks to JLCPCB for sponsoring this video.
Visit to get professional PCBs for low prices.
2011 Lookalike by Bartlebeats

  • Your "Smart phone" is not your friend.

    Miles MooreMiles MoorePřed 2 hodinami
  • Power factor - 0.3? Something is wrong in there

    Jose SzychowskiJose SzychowskiPřed 12 dny
  • Excellent video and a generous giveaway. Nice.

    Primitive FuturologistPrimitive FuturologistPřed měsícem
  • isnt the area underneath the instantaneous power waveform the total energy consumed? Not average power. The sum of the area divided by time is the average power. Two different but related concepts.

    Gustavo FossGustavo FossPřed měsícem
  • I never thought so careful about this problem. Thanks Scott

    Jiang XuJiang XuPřed měsícem
  • By creating this project, more power is consumed.

    Haihong HuangHaihong HuangPřed měsícem
  • Hi, Thanks for your project, I did exactly your steps but I get a couple of erros with compiling in Home Assistant. Does the files have been or need to be updated since you made the video?

    Hugo MiguelHugo MiguelPřed měsícem
    • Where did you get the code for the powermeter.h, using only the Amps not voltage?

      Hugo MiguelHugo MiguelPřed měsícem
  • Amazing. I want one. Could you please share the schematics for the auxiliary components?

    Pedro Henrique PeixotoPedro Henrique PeixotoPřed 2 měsíci
  • We need to get this man to 2 Million

    TMDTMDPřed 2 měsíci
  • You should add a money had to pay by you for electricity , it will be shown in your home assistant

    Techy Adarsh ProTechy Adarsh ProPřed 2 měsíci
  • you can show a summary in video of how much all components cost that you need

  • Thank you. I will cehck on the emon code. but do you know if i can connect multiple current transformers and use a few more pins on the esp32. will the controller be able to handle 4-5 CT coils ?

    timaelabutimaelabuPřed 2 měsíci
  • Thanks for the helpful video

    Arduino любительская автоматикаArduino любительская автоматикаPřed 2 měsíci
  • Thank you for the great tutorial, Just a quick question, I have never used my oscilloscope to measure 220v AC, what is the safest way to do it without damaging my oscilloscope? Thanks again

    Abolfazl AbbasiAbolfazl AbbasiPřed 2 měsíci
  • Hi Scott, I am a great fan of yours. I see tons of equipment like in a lab. What do you do as a job? All the best for your efforts. You are a great teacher 😊😊😊

    Rahul ThoppilRahul ThoppilPřed 2 měsíci
  • Awesome bro.... This is from India... Vera level.... Thank you for the video...

    Ramesh PrakashRamesh PrakashPřed 3 měsíci
  • The number of likes of this comment is the number of people that want a collab of GreatScott with ElectroBOOM

    Vlad BosocVlad BosocPřed 3 měsíci
  • The low team ganguly shiver because pancreas regrettably subtract out a capricious mark. jaded, wiggly locket

    irina lacatusuirina lacatusuPřed 3 měsíci
  • waiting for a video on "main electricity safety essentials". What care should be taken when handling AC 230 V

    Manohar KuseManohar KusePřed 3 měsíci
  • Hey, I saw your face for the first time :) After watching soooo many videos where I have only heard your voice. :) Nice to see you :)

    Anil MaharjanAnil MaharjanPřed 3 měsíci
  • Can we make HDMI wireless video transfer for TV using Arduino and wifi module

    M Vijay KumarM Vijay KumarPřed 3 měsíci
  • Hi, May be a stupid question: I have got solar panels and I would like to measure the power going home from grid but eventually the one going out when solar production is greater than consumption. For that I need to identify the direction of current. Do you think this is feasable ? Thanks for advise.

    Patrice DeschilderPatrice DeschilderPřed 3 měsíci
  • Hi! Which scope probes did you use to measure the mains voltage and the current? Or asked differently: which would you recommend? :-) Thanks, Hansi

    Johann GlaserJohann GlaserPřed 4 měsíci
  • sir can you please share the schematic diagram of this project?

    Muhammad TahirMuhammad TahirPřed 4 měsíci
  • Simply interfacing the blinking led of your smartmeter with a ldr probably will also do the job.

    Christian FuchsChristian FuchsPřed 4 měsíci
  • Great Video! Thanks a lot Scott!

    FunBotsFunBotsPřed 4 měsíci
  • Do a collab with the hacksmith

    Anju SinghAnju SinghPřed 4 měsíci
  • I have a question about the esp32-s2-wroom-1 series... and maybe the esp32 in general. I am completely new to programming and got this for my birthday. After some libraries and coding I have gotten an hc-sr04 and a dht-11 working together to output data to the arduino serial monitor... my question is on WiFi do I have to do the network and password or is there a way to just communicate wireless without a network??? I haven't really done much with programming before??? Thanks for any replies!!!

    Dread Quill11168Dread Quill11168Před 4 měsíci
  • Its super cool , but its really difficult when you start. For beginners point of view, various topics like working of esp32, how data came into mobile app, current sensor calibration etc are alot of things to learn. 🤖 All the best to all and do share your experiences. 👍

    Vaibhav BhasinVaibhav BhasinPřed 4 měsíci
  • Cool 🔥🔥🔥

    ignition_electronicsignition_electronicsPřed 4 měsíci
  • What if there is current >5A? Oh and also let me guess the error of measurement is like 10-30% ? Heh that is not practical at all plus esp32 has cheap inaccurate adcs. better make a wifi ac dimmer or regulator

    Browarus PierogusBrowarus PierogusPřed 4 měsíci
  • Dear sir can you make a video on how to use Rs 485 with esp32 or esp8266 and then accessing the values stored by register adress And then upload it to the cloud Please reply

    Yogesh BawaneYogesh BawanePřed 4 měsíci
  • Very nice idea. How can we get this product commercially.

    Rattehalli RaviShankarRattehalli RaviShankarPřed 4 měsíci
  • you also have a P1 port that you can use. and an Easton meter is not that expensive and MID certified

    Ruurd van BuitenRuurd van BuitenPřed 4 měsíci
  • We just did this for our EE senior design project back in the spring! We won first place!

    Nick BishopNick BishopPřed 4 měsíci
  • first time i see the owner of this channel, i thougt he was mach youngar than that. from his voice

    Mr.Hassoni AMMr.Hassoni AMPřed 4 měsíci
  • Esp32 is not cheap. Use Arduino pro mini or stm32 bluepill

    Ekiskalibur NirvanaEkiskalibur NirvanaPřed 4 měsíci
  • The CT Clamp component in ESPHome is based of the emonlib library and has very easy integration, it even allows you to use a higher precision external ADC such as ADS1115.

    Khayhen SarveswarahKhayhen SarveswarahPřed 4 měsíci
  • My AC is my biggest power draw

    Atoool KAtoool KPřed 4 měsíci
  • 6:00 tinned wire - so mains voltage is not handled correctly :-D

    David PolacekDavid PolacekPřed 4 měsíci
  • I inspired from your videos. Thanks for your great effort and keep on posting. Very useful one. I request you to make a video on, Which is the best ceiling fan regulator type ( Electric (Resistive), Triac based (smooth control), Step control (Capacitor based ) )

    Raji GRaji GPřed 4 měsíci
  • electroboom said i watch your video and subscribe...

    Quinn Matthew C. ZaballaQuinn Matthew C. ZaballaPřed 4 měsíci
  • Hi brother ... Can u please tell me what is the best replacement for NJM5532D DUAL OP AMP.. because I didn't found njm5532d so please suggest me better replacement ic (microphone booster project)... How about NE5532D DUAL OP AMP

    karthik munnakarthik munnaPřed 4 měsíci
  • how about another project for a 24 or 48V system to measure current and voltage i.e from a battery

    Richard KühneRichard KühnePřed 4 měsíci
  • hey i have a question, can i use 6 18650 batteries to power an imax b6 lipo charger (12v, 4amp input) to charge a 4s 1300mha lipo battery?

    MountainSun PRODUCTIONSMountainSun PRODUCTIONSPřed 4 měsíci
  • 4:48 Can I swap the shown Safety Transformer with a simple transformer available in my music amplifier.

    Paul JacksonPaul JacksonPřed 4 měsíci
  • Couldn't you have used op amps to multiply and integrate values instead of the u-controller ?

    Cog of knowledgeCog of knowledgePřed 4 měsíci
  • HiHome smart plug with meter is like 13 EUR with google integration.. But making it diy style can be fun of cause 🤓

    TheStuartstardustTheStuartstardustPřed 4 měsíci
  • Hello nice project.In the future use this IC M90E32AS from Atmel.

    Maurício MauMaurício MauPřed 4 měsíci
  • If can transfer to Chinese language, is better😁

    Lam Che fengLam Che fengPřed 4 měsíci
  • I'm glad to see your face. :)

    simplersimplerPřed 4 měsíci
  • Bro can make a video on wireless video transmission system for a spy Carma without Wi-Fi

    abdul razzakabdul razzakPřed 4 měsíci
  • Please review transparent batteries. (If you can buy one)

    baishakhi haldarbaishakhi haldarPřed 4 měsíci
  • You may use ordinary 2-3w 230v to 12v transformer as voltage sensor. So that you can fit in small area. Thank you for very usefull application:))

    Abdulkadir GözüoğluAbdulkadir GözüoğluPřed 4 měsíci
  • Great Videos, Scott!

    Natte ScottNatte ScottPřed 4 měsíci
  • These meters work directly with ESPHome, so no fiddling with the esp32 ADC:

    John deGlavinaJohn deGlavinaPřed 4 měsíci
  • @GreatScott!! : Awesome circuit . I was in search of a product like this . And how about the android app needed to ti display kt

    Vaseem Mehran CPVaseem Mehran CPPřed 4 měsíci
  • How can I charge a 200v capacitor using a battery, I can't find a decent circuit diagram

    Joel VercitteJoel VercittePřed 4 měsíci
  • In orda, to create powa mita.

    Gene CodeGene CodePřed 4 měsíci
  • Hi Scott you maybe need a pnp machine like this for R&D

    Alex RalliAlex RalliPřed 4 měsíci
  • Great Scott is with us!!!

    Harrison PhillipsHarrison PhillipsPřed 4 měsíci
  • Great Scott, love watching your videos! It improved my electronics knowledge by a ton!

    Patrick JosephPatrick JosephPřed 4 měsíci
  • wonderful demo project... thanks...:)

    q zornq zornPřed 4 měsíci
  • Have someone tested it? Because I've got a lot of noise from ESP32 ADC when trying to read AC voltage and current in some tests made in the past.

    kelvincesarkelvincesarPřed 4 měsíci
  • Power can be measured also this way: Modern power meters have a LED that pulses every Wh or so.

    TheNewKill1212TheNewKill1212Před 4 měsíci
  • Can you do video iPhone DIY or BUY please

    Xk FaXk FaPřed 4 měsíci
  • can we use for dc application? i want to add it to my mini solar generator

    Jhon DauxJhon DauxPřed 4 měsíci
  • pls make a video on pzem 004t power sensor

    احمد خلیلاحمد خلیلPřed 4 měsíci
  • I was going to ask you for a vid on what oscilloscope to buy for tinkering like you. Then i saw the part number on this vid and searched for the one you use, holy shyte, thats a 12000 euro oscilloscope. ok nevermind, i'm gonna keep using my multimeter like the noob i am. good vid btw, as always

    ImpDevilImpDevilPřed 4 měsíci
  • If possible create a video converter from Arduino for old laptop display to convert it into a second display

    Vivek DadhichVivek DadhichPřed 4 měsíci
  • turn off the home assistant system for more power saving.

    zMii -zMii -Před 4 měsíci
  • The ESP32 ADC has significant non-linearity. I don't know whether this is fixed in firmware now, but a few years ago it was a big problem. Just FYI.

    Christian D'AbreraChristian D'AbreraPřed 4 měsíci
  • Hey bro how to esp8266 name change

    Soham VariaSoham VariaPřed 4 měsíci
  • I always imagined, by the voice I was listening , That he would be a very elegant British guy or a blond boy, but he looks Latin or maybe from the Middle East, I don't know, There's nothing offensive, just like that, I hope I don't disturb anyone.

    Rick Hunt RaslamRick Hunt RaslamPřed 4 měsíci
  • There are meters that provide these values and are more compact, possibly more precise and reasonably priced. You could even read then with the cheapest arduino

    Zoltán DamóZoltán DamóPřed 4 měsíci
  • Urmom

    hoobly dooblyhoobly dooblyPřed 4 měsíci
  • What an incredibly distorted and noisy mains waveform. Good place for a shortwave listener? :)

    Graeme LastnameGraeme LastnamePřed 4 měsíci
  • Freund, gutes Projekt, mit viel Potenzial für die Herstellung. Gibt es etwas, das mit Arduino + WiFi ausgestattet ist?. Schöne Grüße.

    Victor TorresVictor TorresPřed 4 měsíci
  • deal with it fraudulents industries!

    Alejandro Alzate SánchezAlejandro Alzate SánchezPřed 4 měsíci
  • I came on line to just now literally to search for someone who has done this project - nice timing :)

    John BoenJohn BoenPřed 4 měsíci
  • Das waren grad "Grundlagen der Elektrotechnik" (1.Semester) und "HM 1 " ( Höhere Mathematik I ) in 10 Minuten. Der Mann hats echt drauf ! :=)

    Dirk LaubuschDirk LaubuschPřed 4 měsíci
  • @GreatScott! what if I want just to use an Arduino and display the measurement in Lcd what I should do.

    lahcen asbayoulahcen asbayouPřed 4 měsíci
  • Hey, you made a video on NE555 timer in which you showed how to get decent PWM using TLC555 instead of NE555. You told that NE555 uses bipolar transistors and TLC555 uses MOSFETs. But I am not getting any TLC555 timer IC in my area. Is there any method or idea to convert NE555 into TLC555 ??

    Sajid MohammadSajid MohammadPřed 4 měsíci
  • This is cool I did this the far using cheep aliexpress bluetooth AC meters. But not as small as this one.

    Michael LeitnerMichael LeitnerPřed 4 měsíci
  • @10:41 -42.78W and power factor -0.25! What was the load?

    Vassilis VassiliadisVassilis VassiliadisPřed 4 měsíci
  • For a second I thought it said DIY Esp32 XD

    Equestria dynamicsEquestria dynamicsPřed 4 měsíci
  • Your videos are awesome man. Please keep it up! Thank you

    B SandB SandPřed 4 měsíci
  • This is literally creative and well explained from you 👍 But as long you want to single phase and max 16A and want to go the short path, I recommend to buy a sonoff PowR2 module and flashing tasmota on it. Now you can easily integrate them into mqqt based systems. Additionally you can adjust them later on the integrated terminal function in the web interface.

    matneu27matneu27Před 4 měsíci
  • Nice work ;)

    Aurélien RenoultAurélien RenoultPřed 4 měsíci
  • would be nice if you had explained your circuit a bit better, but thanks for the video

    André BarataAndré BarataPřed 4 měsíci
  • Are you a leftie

    gurupriya sukhdhamigurupriya sukhdhamiPřed 4 měsíci
  • This video is cool as educational stuff, but in reality it's much easier, accurate and maybe even cheaper to buy something like sonoff pow r2 (not an ad, just an example) smart relay with all this measuring functions included.

    Алексей ЕрошкинАлексей ЕрошкинPřed 4 měsíci
  • I recently bought a 3-Phase power meter from ABB, works fine, just didnt figured out how I have to read the modbus values to show them over my esp

    Lego Mini Movie ProductionsLego Mini Movie ProductionsPřed 4 měsíci
    • I did the same but got Schneider electric. I'm only using single phase and I'm logging it to file at 10hz and outputting data via MQTT as well. For 1 month I metered 200Wh more than my utility did for the same period. Given our clocks weren't synced that is amazing. I need to go back and run my analysis again.

      bravo bravobravo bravoPřed 4 měsíci
  • i would like to recommend using "PZEM-004T " module to measure AC data.

    Andrew James O. MaraguinotAndrew James O. MaraguinotPřed 4 měsíci
  • I just learned you are in Germany. You have a great channel, some of the best technology videos ever made. Check out a device in the USA called sense. it uses CT’s to measure amps, and a voltage detection BUT also DSP’s to see the feedback of equipment and can detect motors, heaters, and equipment

    Jim JenkinsJim JenkinsPřed 4 měsíci
  • Hmmm whz didn't you go for this 16€ PZEM-004 Module?

    Jakob KasererJakob KasererPřed 4 měsíci
  • I use sonoff pow r2 Crazy feature for 9$

    JoestarJoestarPřed 4 měsíci
  • I had a doubt Scott, why dont you use ACS712- Current sensor and ZMPT101B- Voltage Sensor and make it as simple as possible and well portable as well with no external circuits as well?

    ResourcesResourcesPřed 4 měsíci
  • Did any company started make smart RCB and RCCB if not I am patenting

    athul mathul mPřed 4 měsíci
  • Can you build this

    Agent OfficeAgent OfficePřed 4 měsíci