Jump to content

Recommended Posts

  • 2 weeks later...
Posted

Here we go with a small update.

 

The electronics, as you can see it's not exactly complex. I built it on a scrap of strip-board, didn't even need to cut any tracks.

 

Mainsmonitor.jpg

 

The sketch that drives it Datalogging_V1.5.ino

 

And it working monitoring a test load (kettle)

 

20180210_161057.jpg

 

Here's the raw data from the kettle boiling test PowerMonitor.xlsx I've added header rows and a simple graph of voltage for interest.

 

The system makes about 2.7 measurements per second, not going to catch surges but it should be good enough to go and annoy PEA if you have chronic supply issues.

 

I tweeked the calibration by adjusting the "fiddle factors" so it reads the same as my Kill-A-Watt meter, not perfect but good enough. At this point I noticed that the calibration factor for current was "somewhat" different from what I expected. This turned out to be because the current transformers I bought are 1:5000 not 1:2000, I'll be adjusting the load resistor accordingly once I box it all up.

 

Of course, like all good ideas it's been done before https://learn.openenergymonitor.org/electricity-monitoring/ac-power-theory/introduction so I filched the libraries to do the RMS sums from there, no point re-inventing the wheel. I will be updating to keep a running total of energy usage (in FLASH so it doesn't get reset by a restart).

 

More coming when it gets installed on our supply so we can see what's going on when I'm not looking :smile:

 

 

 

  • Like 2
Posted

The beast is sitting in my workshop monitoring the supply to the irrigation pumps and workshop. It's still not in a box so is not permitted in the main house yet.

 

Some (possibly) interesting observations.

 

Firstly it generates a LOT of raw data, with the file limit set to 60,000 samples (so Excel can load it) each file covers about 6 hours and is around 3.5MB. Four files per 24 hours = 14MB, the 2GB SD card I'm using is in no danger of filling up (just under 5 months of data will fit).

 

I also suspect some interference between the voltage and current sensors, possibly because they are sharing the Vref (2.5V) source. Time to add buffers to the reference voltage methinks.

 

See the plot. This is our 2HP irrigation pump starting, I believe the current spike (green line) and reduced voltage (red line) during the run, I don't believe the 340V voltage spike (I would expect the voltage to dip during the startup surge). I really (really) hope it's a measurement error!! :sad:

 

Untitled-1.jpg

 

On the whole it's going fairly well and providing suitable brain exercise. And I have remembered how to solder properly :smile:

Posted
On 2/13/2018 at 12:45 AM, Crossy said:

I really (really) hope it's a measurement error!

It was :tongue:

 

I separated the Vref supplies for Voltage and current and got something much more sensible.

 

One can see the 15A (about 3x run current) start surge of the 2HP pump (single phase induction motor) and the associated volt drop.

 

The 6A run current causes about 3.5V drop equating to a supply impedance of around 0.58 ohms which matches reasonably well with my measurements made when specifying our AVR (there's an extra 15m of 4mm2 from where those tests were made), see the pinned thread.

 

There's still a good deal of jitter on the voltage measurement but (oddly) not on current. I'd like to apply some smoothing but the start surge only lasts for 2 samples, don't want to disguise this type of thing.

 

VI 14-2.jpg

 

Investigation continues.

 

Like British Rail - "We're getting there".

 

Posted

Applying my jaded brain to the voltage "jitter" issue I suspect it's related to the Arduino Uno's 10 bit ADC (Analogue to Digital Converter).

 

We are sampling voltage and current a number of times per cycle to make the RMS calculations, nothing is done in hardware except scaling the input. Of course this means that the mains voltage to be measured goes from -325V to + 325V (230V RMS). That's 650V being chopped up into 1024 (10 bit) measurement steps = 0.6V per step (of course this is scaled and offset to fit the 0-5V input range of the Arduino).

 

I may invest in an Arduino Due, it has 12bit ADCs so we get 4096 steps = 0.16V per step. The libraries I have will work with the Due in 12 bit.

 

Unfortunately I need to same up my pennies as the Due is $12 

https://www.aliexpress.com/item/Due-R3-Board-DUE-CH340-for-arduino-ATSAM3X8E-ARM-Main-Control-Board-with-1-meter-USB/32847070719.html

 

HTB15XRSotzJ8KJjSspkq6zF7VXaN.jpg

 

Posted

Update time, since we had Friday off (company has Chinese connections so CNY is a holiday) I got on with the task in hand :smile:

 

The beast is now in a box, so is allowed in the lounge with the electrical panel. Madam hasn't complained about the wiring, yet! The outlet is straight off the incoming supply (via a 6A MCB) so power and voltage monitoring via one wire.

 

20180217_161529.jpg

 

The innards.

 

20180217_161541.jpg

 

And the outards.

 

20180217_161534.jpg

 

The current transformer load resistors live in the yellow heatshrink "power bulges".

 

An important note about current transformers. Never, ever, leave them with the secondary open-circuit when on an energized supply. Even the baby ones we use on this job can generate hundreds of volts, not going to kill you but you may get a rude awakening.

 

My CTs gave me a headache, the blurb on AliExpress describes them as "100A/20mA" making them 1:5000. Having set up and calibrated the beastie with 85 Ohm load resistors all seemed well. Until I loaded up past 24A or so, at 37A load we were still reading 24A, oops.

 

A quick look at the output voltage said 2.4V, way over the 1.5V rms maximum for the Arduino analog input. 2.4V across 85 Ohms = 28mA. 37A / 28mA gives a ratio of  1: 1300 so the transformers are probably 1:1500 (maybe 2000). Grrrrr.

 

Re-calculating the load resistor put things at about 25 Ohms, I bunged 39 Ohms in parallel with the existing 85 Ohms (for 26.73 Ohms, close enough to calibrate out) hence the two bulges on the CT wire.

 

 

  • Like 1
Posted

Some test results, now I've fettled the current reading.

 

Untitled.jpg

 

Voltage is the blue trace (left side axis) current is the orange trace (right side axis). The big amps were me testing with our "carefully calibrated variable load" (OK the big water heaters). Got up near 60A (our poor 15/45 meter was crying in pain) with broad agreement to the supply meters.

 

So now we do the 24 hour monitoring test :smile: Let's see what our power really does when nobody is looking :tongue:

 

Posted

Another day, another plot.

 

Supply looks a lot cleaner on a weekday, I was thinking the spikes on the current were a measurement aberration but there are a lot fewer than at the weekend.

 

All day.

image009.png

And 6 hour chunks.

image001.png

image003.png

image005.png

image007.png

 

 

Posted

OK, this is probably the "final" software update.

 

Correctly displays month, day, hour, minute, second with leading zero if <10.

Does the same when creating the .csv files so they sort properly.

 

Datalogging_V2.0.ino

 

Also a macro-enabled Excel 2013 sheet with a VB script that imports the .csv files (oiked off the net).

 

Power Monitor.xlsm

 

  1. Select cell A1 of Sheet 1
  2. Hit alt F11 to run VB
  3. Select module "Import_CSV"
  4. Hit F5 to run
  5. Follow the prompts.

 

The charts on the second sheet should now be filled correctly.

  • Like 1
Posted

One "final" update, this simply forces a new data file to be generated at midnight making life easier when you want to import into Excel.

 

Datalogging_V2.0.ino

 

Now we wait for something interesting to happen.

 

Next project time methinks.

 

Posted

Crossy, I envy you the time and resources for your projects.

 

Back in the old days on a planet far far away I used to have similar hobby. On this far far away planet it was easy to get parts and modules from places like RS and Maplin. Unfortunately I don't now have the time or resources or the money to indulge my hobby anymore :sad:  (wife kids and all that goes with it)

 

Next project? How about your mates diesel jenny cut off switch?

 

Or would that be too easy for you? :whistling:

Posted
9 minutes ago, Daffy D said:

Next project? How about your mates diesel jenny cut off switch?

 

I was actually thinking of that, maybe "universal" like this beastie https://www.gencontrol.co.uk/auto-start-for-hyundai-genset.html which can simply replace the keyswitch of a genset with electric start/stop and an automatic choke if it's petrol.

 

We can put something together with more functionality for a lot less than the 102 Squid that unit costs.

 

Time I have in the evenings and weekends, no kids and I really don't watch much TV. Wifey looks after her plants and I do "mysterious things" involving a computer.

 

Madam did make a comment that our electrical panel looks like a swarm of fireflies, there are "a few" LED indicators and LCD displays.

 

  • Like 1
Posted
1 hour ago, Forkinhades said:

...without hijacking the thread. Xy was wondering if you know where I could get a start-up electronics kit for my boy (me). emoji4.png

Not something I've seen here, but I've not looked either. 

 

How about one of the Arduino based hobby robots, simple electronics to interface and it does something interesting?

  • Like 1
  • 10 months later...
Posted
6 minutes ago, johng said:

could you give links for purchase of the transformers ?

These are the CTs I used, read the thread to see my saga with the burden resistor. Also don't use the same voltage divider for I and V unless you use op-amp buffers to prevent interaction. 

 

https://www.aliexpress.com/item/5PC-Precision-AC-current-transformer-coil-PZCT-100A-20mA/32609298932.html

 

Voltage transformers came from NPE in Zeer, the smallest mains/12V trannies I could find, tiny cost.

 

  • Thanks 1
  • 2 weeks later...
Posted
1 hour ago, johng said:

Well one small setback from Lazada

...why on earth would a transformer be a prohibited item !!! ????

It shouldn't be of course.

 

But I've had the occasional item cancelled due to "customs issues", one was a pack of breadboard jumper wires.

 

I'll bet it was simply they had no stock / couldn't get any.

 

I'd just order from another supplier.

 

  • Thanks 1
  • 8 months later...
Posted

Eventually after 2 more goes I gave up and ordered this

https://www.lazada.co.th/products/watt-meter-4-in-1-voltage-current-power-watt-energy-electricity-meter-with-coil-ct-pzem-061-ac-80-260v-0-100a-multi-function-lcd-digital-display-btc-eth-miner-i227787961-s348264618.html

 

which comes with a current transformer as part of the package !

 

Thought about hacking it to talk wirelessly via an ESP826 wifi  board to my MQTT server (turn it to a smart meter)

https://www.domoticz.com/forum/viewtopic.php?f=38&t=7325&sid=4a9e05f550ffdd3afedfcc07ff79725e&start=60

and

https://gizmosnack.blogspot.com/2014/10/power-plug-energy-meter-hack.html

but  its using a Vango V9811A chip that nobody has published any successful method  and I can't work it out + the soldering pads are tiny and my hands shaky. :blush:   so its just a dumb energy monitor ( for now)

 

Yesterday I wired it all up..no smoke no flash bang ????

 

Taadaaa !!!

P_20190927_095937.thumb.jpg.9bf6f78ef73f27743ef478e880d4a031.jpg

 

Posted
1 hour ago, johng said:

I am confused. The linked meter has only 4 items 

voltage, current, power, energy.

 

though the one you pictured also has 

Frequency and power factor (the last will be very useful if we start getting charged for apparent power, think smart meters).

 

1 hour ago, johng said:

which comes with a current transformer as part of the package !

Wouldn't that usually be called a current sensor? 

 

All the meters that I've seen, have those included. 

Posted
20 minutes ago, sometimewoodworker said:

Wouldn't that usually be called a current sensor? 

All the meters that I've seen, have those included. 

 

If it's the type with a toroid and coil I'd call it a "current transformer", if it's the alternative Hall-effect (electronic) type I'd call it a "current sensor".

 

In reality the terms are used interchangeably.

 

I'm more confused as to why johng wasn't able to buy the beasts successfully.

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.



×
×
  • Create New...