Home Power Monitoring with the PZEM

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so we have a problem and that is that the electricity bill in this house is very very high and truth be told we don't really know why we've tried uh tracking it down to a few different things but it's going to get the point we want to try figure out what the root cause of this is and what might be so to try and figure out this problem so right here we have what is known as a pset em-004t version three breakout board now what this board is is it allows uh you to measure um power and what's quite handy about this is that it has an output that will allow you to connect it to uh directly to computer or in my case it's going to be connected to a microcontroller that will feed the information to an app that i can monitor over time so basically the way in which this device communicates with the arduino or microcontroller computer is by via a serial connection the uart connection so that happens here your four pin uh connection here so i've just made this up uh on the fly that slots in there and what i've done here is connected the ends of these wires to do punch connections which will be connected to your arduino or microcontroller for the final version i'll probably make these a bit more reliable connections but for a temporary setup this will do the job and what happens is um there's actually a little processor here and what that does is that does all the analysis of your um of your power or your logging of it and then that transmits that over a serial connection to your arduino now one quite nice feature about this board is that the connection between the live side so where the high power is going through and where your microcontroller is connected to are separated so it means that if worst case scenario this explodes because too much power goes through it or something goes wrong say there was a surge in your house your microcontroller in theory shouldn't blow up which is always a nice feature so some of you are probably wondering why go towards of working with this quite big breakout board that has all these extra connections when a lot of the time you could just use a split core transformer and connect that either to a small breakout board or even no cardboard but connect directly to your microcontroller and not have to worry about all these extra features that this has such as having to interface with a serial connection to an arduino or microcontroller or whatever and very good point and the reason for that is when i was looking up how to monitor power accurately i kind of realized that um measuring ac power gets quite complicated quite quickly and this board actually does a lot of the measurements takes that off your hands it gives you a lot more measurements that i'd have to think a lot harder about to try to figure out how to get an accurate reading and truthfully i just don't understand but i figure i kind of want to have them just in case so this thing is able to mark to measure not just the the current but also the energy the frequency of the power the power factor and the footage itself so you get a lot of extra um features without having to do a lot of thinking which is why i like this okay so uh before we go bring this directly into the main breaker i thought we just do a quick run through how this is actually going to work we can do our testing on a small scale set up before going to a mains before going big boys so what is this well this is a little um plug i rigged up just to do some temporary testing on this has two sets of wires connected to this point so the idea being it will mimic how the mains connection is done so if you can imagine you see this wire goes this wire is connected to this plug here this is going to be simulating our circuit to the rest of the house so in other words the power so your load will go through here and the idea being we want this device here to measure the load coming out of this by load i just mean the amount of electricity being pulled so say if your laptops your computer's blah blah blah the amount of electricity going through this so how do we go about that well i don't know if you can see here but i've stripped back the wires here to expose the three wires that we're interested in so we have we have live neutral and ground it's actually the opposite that's live that's neutral that's ground anyway doesn't too much of a difference what will be happening is we have our split core transformer here that is going to be going around one of the wires as such and that we monitoring how much current is passing through here all right next up we have this wire which only has two connections going to it the live and the neutral we don't need the ground for this here and that wire let's get in here connects directly into the pz em zero zero three t version three onto these two connections here and what this will do this will monitor what the frequency of the power is um and um what the actual voltage of this source is because the voltage source here will be default same voltage that's going through here so that's our basic setup and next up we'll show you how it's actually kind of put together okay so here we're going to very quickly run through the software i'm not going to go in depth or anything just to give an overview of how you go about it and how you approach it so here we're using the arduino pz library of note here is when you're dealing with micro controllers or the light you can have uh serial connections in a different a few different ways so you can have what's known as hardware serial where you have two pins on your microcontroller which are dedicated for serial connections specifically or you can use any other two pins and have what's called software serial connections software serial connections are not as fast you can't get as high speeds but uh you can the advantages you can pick any two pins here so that's what we're going to be using here uh software stereo so we've just picked pins six and seven in this case uh so we have to declare them here with this line here and this just lets the arduino know that we're using these two pins for a serial connection the second thing you're going to have to do is to display the data you that i connect to the module itself so doing two things at once you need to set your speed to the serial connection um in this case for the pzem and for your display you have to use 9600 this line here um stand the arduino library comes with a different speed uh by default and that doesn't actually work or at least i couldn't to work so this is the general library library here this doesn't do anything special it's just printing your voltages your currents power all this kind of stuff within two seconds and then um displaying it and this is essentially we'll be using a lot of this is actually handled by the program but behind the scenes this is kind of what it's doing anyway so very minor changes and we can get ourselves up and running only catch we have is that we actually have multiple devices and when we deploy this we want to actually use the same two pins if that makes sense so you want to have four different energy monitoring devices all connected to the same two pins so i'll show you how to do that next how you'd actually register so you can have multiple devices talking along the same two pins okay so here we have um the sketch we'll be using to actually um allow us to call multiple um power monitors using the same two pins so the way we do this is actually quite straightforward so what we'll do is we'll assign an address to each power monitor so the start of here is the exact same since we've registering it on pins six and seven uh this is the speed um serial speed we'll be using and here's where it gets a little bit different so we have to set the address in this kind of form here with 0x04 it's hex decimal version of a number and we just run these commands here which is just simply set address the address you want and through all this is doing otherwise just putting out the address so we know what we set it to really it's just this one here that you need so yeah that's it so the way we'll be um implementing this is that we'll have four devices so we'll have four different addresses so for example zero x zero two three four five i think it can hold 70 plus devices so uh allows us to really efficiently use um just two pins to address a large number of devices which is what we'll be doing uh the other thing of note here that um you there are certain addresses you can't use like zero one i believe um is like a global address so in other words if you were to plug in just one device and it had been set to an address but you'd still want to call that address that no device without knowing his address you could just use a specific address that would broadcast any and all but you can't use that address um if you've got multiple devices on it if that makes sense um so there's certain addresses you can you have to avoid but two three four five six seven eight nine that's fine you'll figure it out pretty quickly uh if you give it a go yourself the other reason we're doing it with these arduino stretches rather than in the program itself is because the program will be using called esp home action doesn't have a feature that you set the address using that program so while it has a feature to call to a specific address uh it doesn't have the ability to write to write a power monitor to a specific address if that makes sense so it means that we have to determine what the addresses are we have to set the addresses before connecting it up to that so that's why we're going to all this effort here okay so here we can see the setup hopefully around this type of area here you'll be able to see what our readings are as you can see there's nothing connected up and we're basically getting zero output here so for a bit of fun i just picked up a random plug i had lying around just happen to have this glue gun on hand once i plug this in and this turns on you can see that straight away we're starting to draw more power there so our power has automatically jumped up to 50 watts 60 watts it'll probably keep rising or 50 watts anyway so if you can think of this um glue gun here representing all the electricity in the house all the appliances this will be able to measure them uh so and you can see here we're getting a bit of an increase in a few different things such as the energy the power factor and to be honest the energy and the power factor are two things i've probably been able to work out but this device just makes life a lot more simpler by figuring that out so once i remove that you should see there that the power there you go instantly drops back down to zero okay so here we have the final product now not sure if you can see here but we have our four power monitoring modules those are connected up using these wires to this which is known as an esp82 which is just like an arduino but with wi-fi built-in uh the wire can now that that's just running back to the plug and that just provides power to the rest of this little circuit board here so similar to what we had before but just repeated four times over so four separate addresses all connecting to the same uh rx and tx pins on the microcontroller ie the arduino ie the esp8266 in this case so we have a four wires here and to these we have our clamp terminals so this is what a mains what a fuse board looks like with the panel taken off so as you can see these are our breakers here as we go along and what we want to do is we want to essentially clamp onto those to measure to measure how much power is coming through so here we can see an example of one um there and that is monitoring the amount of power going through this which supplies the rest of the house so that's how that works um for demo i'll show you this one here i'll explain why i'll focus on this one why i'm focusing on this one in a second but you can see here you have both a brown wire and a blue blue wire coming out of the same fuse as you can see we have our clamp going around the brown which is i believe the live blue is neutral and in the same two ports we have also this wire so this wire is is plugged into the two ports there and that's measuring a voltage across it so again remember this is for this is measuring um the voltage and then this is measuring the current and so those feed into here and in the vast majority of cases that is job done um this means this fuse board is a little bit different because we have what's known as three-phase power and it's sort of laid out a little bit differently so you can see on these fuses all the way on these um fuses along this line there's only brown wires coming out uh the reason for that is that rather than um there being one live one neutral coming out of each fuse we have one um live and then one big uh neutral coming um at one side so in other words all of these fuses share the same neutral so for that reason if we look closer here you'll see the very first the leftmost wire here we have our clamp coming in there and then we have the voltage coming in and then what i've done just for simplicity's sake rather than having lots of wires coming out of this i just use the same voltage across all of this but that should make a difference because it's just showing what the voltage is so yeah that's it uh you can see here every now i get flashes those flashes means it's taking a reading i have it set to take a reading i think every like five seconds or something because i want it to be more or less live and yes that's the uh that's the setup there really so just one other point um that i forgot to mention earlier and that is the main reason or i suppose another reason why i connected all the voltages of this one fuse here as opposed to taking different wires from different places and having each of them individually connected up so while it would be i suppose more accurate one of the big advantages of having um this setup here where all the voltages where all the voltage in the entire setup comes from just one switch there is that when i'm working on those ie when i'm hooking up the um the clamps all that kind of stuff i don't want there to be any high voltage um coming from that because that is a big danger as you can see the terminals they're kind of small it's easy to slip to actually touch something that you shouldn't have and then best case scenario you fried your circuit worst case scenario you fired yourself so by having it connected up into this one breaker here if i want to work on this to do it safely i just flick that down and now you can see there the top's still blinking because that's powered by that but underneath here there is no voltage across there it's completely safe to touch whereas if i flick that on lights are coming on high voltage there so just a point to consider um from safety perspective now as well from another safety perspective that really should be uh fenced off so that no one can actually touch it but yeah make a casing around it that's the word i was looking for so i should really make a casing around that um that is going to happen i actually plan on adding a few more of these modules in so this is only a temporary setup but uh that is plan for the future to have a casing to stop people touching that and getting fried alive okay and so to just round it off uh this is what the actual result of all the work looks like so you see here we have four uh kind of panels each of these panels uh corresponds to one of the um power modules we installed you can see here it lists out the current power energy power factor all that all that stuff so all in one very neat very um aesthetically pleasing application uh so this is called esp home you can access it from anywhere in your browser once you run it um i'm gonna get into how this is set up sorry this is called home assistance i'm not going to get into how this is set up because it's a there's a whole other topic but say for example we look at this panel here we can click on what we want and it's been recording data for a while this is just explaining the last day and you can see we can easily have a look and see to see when the power is particularly high um what the power draw is so that in other words this is corresponding around when we start eating and turn on the immersion heaters to heat the hot water in the house etc etc so it gives you quite a good insight and yeah so again this is displayed with home assistance and the program itself that's controlling the sensors is called esp home i won't get into it but you essentially make uh you register your device here then you just tell esp home what these devices are and what you want from them so there's the pzem uh modules you list out what the address is and then you tell it what you want in other words current voltage energy readings all that kind of stuff and yeah so it displays it neatly on these panels and that's really it thank you very much for uh watching and remind yourself
Info
Channel: FionnOCH
Views: 31,897
Rating: undefined out of 5
Keywords: Power Monitoring, PZEM, HomeAssistant, ESPHome, DIY
Id: hao1jUYB5wI
Channel Id: undefined
Length: 21min 2sec (1262 seconds)
Published: Fri Jul 30 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.