Page 1
Page 1
Started By
Message

I built a prototype home energy monitor

Posted on 2/19/19 at 1:14 am
Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/19/19 at 1:14 am
I tend to go DIY whenever possible because it's usually cheaper, it's fun, and I have more control over my data. I had a couple of nodemcu's laying around, and some miscellaneous components, so I picked up a couple of split-core current transformers and found some instructions to make my own energy monitor.

It was hard to find instructions for exactly the parts that I had, so it took a lot of trial and error, especially during calibration, but I think I've finally got a prototype that works pretty well, actually better than I was expecting. The readings are very stable, and very sensitive. So much so that it's obvious when a 10 watt led bulb is turned on.

I went around flipping switches to calibrate against sets of bulbs with known wattages, and I ended up finding out that I had two 100 watt incandescents in the office, which are usually on about 10 to 12 hours per day! So this little project has already saved me about $5/month in electricity.

The total cost was under $20, even at Amazon prices. $12 current transformer, $5 nodemcu, a few cents worth of resistors, capacitor, and miscellaneous wire, plus a couple bucks for a 3.5mm jack, usb wall plug, and a breadboard.

One downside is the nodemcu only has 1 analog input, so it can only monitor one leg in the panel. Now that I know a little more of what I'm doing, I can replace it with an arduino mega, which has 16 analog inputs. With one of those I can monitor each individual circuit if I wanted to. And if I get the parts from Ali instead of Amazon, and get some simple PCB's made, I could monitor both legs in a panel for probably less than $30, or 16 individual circuits for about $80.

The nodemcu has wifi, but the arduino doesn't, so for a few more dollars I'd have to add either wifi or a different radio. With wifi the unit could send data to "the cloud", or if I use one of the various other IoT radios I'd have to put together a bridge/gateway device, in which case I would store my data locally.



There is still a lot of tidying up to do, and a lot of code to write, but I'm happy with the results after a few hours of work. My wife was skeptical of the utility of it and accused me of "playing", but after seeing how it works and getting immediate feedback on the cost of power and the potential savings of being conscious about our usage, I think she's sold.
Posted by jmon
Loisiana
Member since Oct 2010
9243 posts
Posted on 2/19/19 at 9:09 am to
How bout some pics?
Posted by WhiskeyThrottle
Weatherford Tx
Member since Nov 2017
6459 posts
Posted on 2/19/19 at 9:44 am to
That's a lot of nerd talk that is cool as $#!t man.

I've always wondered why something like this didn't exist. I'd happily pay for the plans or even an end device if you made it to where you could sell it.
Posted by 50_Tiger
Arlington TX
Member since Jan 2016
41988 posts
Posted on 2/19/19 at 9:44 am to
Care to share technical specifications or are you trying to patent this?
Posted by mctiger1985
Baton Rouge
Member since Oct 2009
3693 posts
Posted on 2/19/19 at 12:31 pm to
quote:

always wondered why something like this didn't exist

It does. Lookup Sense, CURB, Neurio to name a few
Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/19/19 at 1:28 pm to
quote:

How bout some pics?

Alright, but it ain't much to look at.


Here is the NodeMCU on the breadboard, hooked up to the 3.5mm jack. The transformer puts out milliamps, and you can't see much of it here but there's a burden resistor from the white wire to brown. That's so you can then measure the volts across the resistor rather than milliamps. The other two resistors are a voltage divider, and along with the capacitor they work to keep the voltage from swinging negative as it normally would. I'm not exactly certain how this works, but that's what I read and it does work so I'm not going to frick with it.




And this is the split core transformer. It just clamps over the wire and outputs 1/2000th of the amperage that flows through it to the 3.5mm plug.

Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/19/19 at 1:30 pm to
quote:

It does. Lookup Sense, CURB, Neurio to name a few
Those and Smappee are the only commercial ones I've heard of, and they're mostly $300+.

There is also OpenEnergyMonitor, which is where I got most of the information to build my own.
This post was edited on 2/19/19 at 1:41 pm
Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/19/19 at 1:42 pm to
quote:

Care to share technical specifications or are you trying to patent this?
The only hardware involved is the NodeMCU, the transformer model SCT-013-000, the burden resistor (I think I used 22 ohm), two 10k ohm voltage divider resistors, and a 10uf capacitor. Most of the information I used was on this page.
Posted by 50_Tiger
Arlington TX
Member since Jan 2016
41988 posts
Posted on 2/19/19 at 2:09 pm to
TY Sir!
Posted by 50_Tiger
Arlington TX
Member since Jan 2016
41988 posts
Posted on 2/19/19 at 2:10 pm to
Every considered using a RaspPi?
Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/19/19 at 2:32 pm to
quote:

Every considered using a RaspPi?
I have several Pis that I use for various things, but they're both overkill and not well-equipped at the same time (for this type of project). It's bigger and much more expensive than the nodemcu. It also doesn't have an ADC built in, so it would need additional external hardware just to read the analog signal.

I think a Pi would be better suited to use as a hub/gateway for this project. The wifi on the nodemcu is flaky enough where it is, and I'm pretty sure I will lose the signal altogether if I close it up inside the panel. So I will likely end up putting a different radio, like an RFM95, on the nodemcu (or possibly arduino since it has more analog inputs), and put the same radio on a RPi. That way I can put as many of these cheap monitors as I need (my house has two breaker boxes), and feed the data to my Pi hub where I can do whatever I want with it.
Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/20/19 at 11:21 pm to
Just an update to show how stable the readings are.



The chart shows the last 10 readings at 5 second intervals. The dip is me turning off, then on, 2 LED bulbs, which is about a 20 watt difference in total power consumption. As you can see, it makes a clear difference in the reading, and that's probably the smallest amount of consumption that you'd worry about.

That millisecond figure is there so I could make sure my code for it to self-regulate the measurement cycles was working properly. It's supposed to adjust itself so that it takes 200 milliseconds to read the current, so it's working well. The reason I chose 200 milliseconds is because 1/5th of a second is 12 complete cycles at 60hz and 10 complete cycles at 50hz... whole numbers. This is important when measuring alternating current because anything more/less than a full cycle introduces error into the reading. You can't just take an instantaneous measure because it's meaningless. It could be positive, negative, or zero. So I'm using a library that takes x number of samples as fast as it can, then calculates the RMS current. I found that slight changes to the code caused that part to run faster or slower, even on the same chip, so I'm certain that it will run at a different speed if I use a different chip in the future. So the program starts by timing itself as it takes 100 samples, then it adjusts the number of samples so that it takes 200 milliseconds to run. On this particular nodemcu, that ends up being about 900 samples per 200ms.
Posted by CarRamrod
Spurbury, VT
Member since Dec 2006
57951 posts
Posted on 2/23/19 at 11:03 pm to
In. I want one
Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/23/19 at 11:54 pm to
quote:

In. I want one
Then get to work!

You could just get a Sense/whatever as mentioned above. They cost a lot more (but not prohibitively so for most) than my little hack, but they also do a lot more and are more robust.

I mostly did it because it's fun and I like to learn stuff. I also like to know exactly how my stuff works and what it does. If that's your bag, too, then I'll gladly link you to every part, share the code, and write up a step by step tutorial. I was actually planning on doing all that anyway, eventually. I have dreams of being a six figure blogger.

Posted by UltimaParadox
North Carolina
Member since Nov 2008
47265 posts
Posted on 2/24/19 at 9:00 am to
quote:

I found that slight changes to the code caused that part to run faster or slower, even on the same chip, so I'm certain that it will run at a different speed if I use a different chip in the future. So the program starts by timing itself as it takes 100 samples, then it adjusts the number of samples so that it takes 200 milliseconds to run. On this particular nodemcu, that ends up being about 900 samples per 200ms.


I do not own a NodeMCU, but quick google search shows they have some libraries available with some nice timer functions.

NodeMCU timer library documentation

You could use that to fire off an interrupt and then sample. Using the library should adjust for whatever you have the main cpu clock set to.

Also they make plenty of current clamps with the "burden resistor" already built in so that it output is a fairly steady voltage. Obviously the trade off is it might be more costly and larger in size. You might still need the external circuitry before the A/D input to make sure that you are not exceeding the maximum input ratings, and protect it from static etc..
Posted by CarRamrod
Spurbury, VT
Member since Dec 2006
57951 posts
Posted on 2/25/19 at 9:55 am to
quote:

You could just get a Sense/whatever as mentioned above. They cost a lot more (but not prohibitively so for most) than my little hack, but they also do a lot more and are more robust.
oh i know i have been following this stuff for a while. and none of those are really great. they advertised that they learn your devices but i read that it takes MONTHS! to learn things. which is BS. I should be able to turn a light on and off a bunch of times and it know what it is, based on their advertising of each bulb has its own electrical fingerprint. It shouldnt take months.
Posted by Korkstand
Member since Nov 2003
29000 posts
Posted on 2/25/19 at 10:35 am to
quote:

they advertised that they learn your devices but i read that it takes MONTHS! to learn things. which is BS. I should be able to turn a light on and off a bunch of times and it know what it is, based on their advertising of each bulb has its own electrical fingerprint. It shouldnt take months.
I've read similar things, and I agree it shouldn't take months, but I can see how it might be hard to learn what things are just based on their electric "signature".

Electricity is very noisy, and it's basically that noise that they're trying to use to pick out what is what. It might get better one day if they collect enough data, but personally I would prefer the "dumber" approach of measuring each circuit individually rather than just the mains. That would make it easier to map what is on which circuit, and you'd be dealing with less noise when trying to determine what is switched on and off.

Ideally we'll start to see smart outlets and switches become common and they can report their consumption individually. I've been toying with the idea of knocking out some sheetrock and putting a double gang box on some of my switches. You could put a little LCD there next to the switch that shows power consumption in watts and dollars. You could also put a PIR there for occupancy detection, bluetooth for identification, etc. Hell you could probably even make it a wifi mesh node.

I'm not sure I could make it totally safe, but if there's a divider in there separating high and low voltage, it can't be too bad right?
Posted by CarRamrod
Spurbury, VT
Member since Dec 2006
57951 posts
Posted on 2/25/19 at 11:16 am to
I agree on the individual circuit thing.
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on X, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookXInstagram