Electricity monitoring with a twist...

Show or discuss your existing Home automation project here, so a detailed explanation!.....
Post Reply
aris_coronel
Starting Member
Starting Member
Posts: 4
Joined: Mon Jan 01, 2007 6:37 am
Location: Philippines

Electricity monitoring with a twist...

Post by aris_coronel »

Hi,

Just wanted to share my current project on electricity monitoring. The thought of monitoring my electricity consumption always fascinated me. After bumping into Bwired's site, I knew I had to have mine [:)]

My electricity meter is the traditional one with a spinning disk. So all I need to do is setup a photo diode, a light source, then some 1-wire components, right? So i thought...

I hit my first hurdle right away. The parts needed to build the pulse sensor is kinda hard to come by here in the Philippines. Also, apart from minor soldering skills, I couldn't tell a resistor from a transistor even if my life depended on it [:(]

So I did some hard thinking. And some more. Then it hit me - what if I can monitor the spins (the small, black stripe on the disk) with a webcam mounted below the meter and focused on the spinning disk.
All I needed then was a motion detection software which focused on a small area on the image and watch for black stripe to pass by. Once it passes (and motion is detected), the software then launches a batch script which inserts a timestamp record into MySQL database. It will do this everytime the disk makes one full spin.

I set to work and mounted the camera, configured the motion detection software, setup MySQL, cooked up a VBscript to log the spins and finally created some sort of a dashboard to monitor the statistics in VB6.

I got everything online last week and I'm now able to monitor my elecric consumption to my great delight :)

I still get some false positives from time to time though - especially with sudden changes in image lighting which the motion detection software interprets as motion. I'm still trying to find a way to remedy this...

I know, I know, my setup is far from ideal and what I would give to be able to setup a photo diode sensor with the 1-wire thingy but this wil have to do for the time being :)

Attached is the dashboard (work in progress) I created which indicates the KwHr consumption per hour and the rate (in pesos) which is based on the same convoluted computation our local electic company uses. It also gives you an actual picture of the spinning disk refreshed every second.

It also features a real time graph and some bar charts for hourly, daily and monthly trending.

Well I hope I've been able to share my own mediocre way of doing the monitoring and who knows, this might be a good example on how NOT to do this. But it sure was a LOT OF FUN to do it :)

Best regards,
Aris

[img]uploaded/aris_coronel/20071171045_dashboard.jpg][/img]
John Downe
Starting Member
Starting Member
Posts: 13
Joined: Sun Sep 10, 2006 3:17 pm
Location: United Kingdom

Electricity monitoring with a twist...

Post by John Downe »

Aris, an interesting approach...

Out of interest, what did you use to code / build your dashboard - that looks neat.

John Downe
aris_coronel
Starting Member
Starting Member
Posts: 4
Joined: Mon Jan 01, 2007 6:37 am
Location: Philippines

Electricity monitoring with a twist...

Post by aris_coronel »

Hi John,

I used Visual Basic 6 to code/build the dashboard using some ActiveX components for the real time and historical graphs (MS Graph). Others such as the led-like digits are native Visual Basic code thats freely downloadable. The rest is coming up with the right combinaton of colors. I settled for black.

I'm still thinking of what addt'l info I can add into the dashboard to fill up the space.

Also, I'm planning to port the dashboard to web-based when I find the time again, since its back to work tomorrow after the long holidays.

Regards,

Aris
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Electricity monitoring with a twist...

Post by Bwired »

Hi Aris,
Agree with John... a very interesting approach! Which program do you use to control the web cam and motion detecting, also self created with VB6. For the light problem you could shield of the cam and build a small led in it for the right amount of light for the Webcam to see the changes... or?
Can you also tell which additional active control set you use for the graph en dashboard. The graphs looks like they are created with Chartdirector. I also have my Bwired Home Control system created with VB6, still want to switch to VB.NET but a lot of work!
Hope to see your Home automation, Domotica monitoring en results online in the near future. Please list your site then at http://www.domoticaforum.eu/topic.asp?TOPIC_ID=194
Keep us posted
Regards Pieter
aris_coronel
Starting Member
Starting Member
Posts: 4
Joined: Mon Jan 01, 2007 6:37 am
Location: Philippines

Electricity monitoring with a twist...

Post by aris_coronel »

Hi Pieter

For the webcam control, I use Active Webcam which does a good job of masking the image and allowing only selective areas to watch motion. It also allows executing a batch script once motion is detected.

There are two problems connected with the lighting issues:

1. External light - Since the meter is encased in glass, external light (daylight, flourescent lamp at nighttime) can shine through. Day and night lighting have different effect on the sensitivity of the motion detection software.

I tried shielding the meter with a cardboard once but decided against it in the end lest the meter man get paranoid. Meter tampering is quite rampant here in Manila and the electric company might go ballistic on me.

2. Light from the camera - my camera has a built-in infra-red which projects its light on the disk. The led's intensity also has a direct effect on the motion sensitivity.

I tried to disable the led in the camera and only made it worse - the disk appeared pitch black when I completely turned off the garage light at night. I installed the led back in.

So far, I'm still in the process of determining the best balance of light for optimum motion sensitivity. This also involves tweaking Active Webcam's motion sensivity parameter.

I'm using the fllowing Active Controls:

MSChart (for hourly, daily, monthly trending chart) - comes with Microsoft Windows Common Controls 6.0 - SP4
eTree eChart (for real time chart) - freely downloadable from the net

I'm looking forward to putting up my site online in the near future -- and having tons of fun in the process :)

Thanks a lot Peter. Your Bwired site is a site to behold and truly informational and inspirational!


Best regards,

Aris
simplemind
Starting Member
Starting Member
Posts: 27
Joined: Wed Aug 16, 2006 8:31 pm
Location: Netherlands
Contact:

Electricity monitoring with a twist...

Post by simplemind »

Hi Aris,

For chart software take a look at http://www.rmchart.com/

What kind of webcam do you use? Connected to your pc with USB or by a network cable with tcp/ip into a router, or wireless?

Regards,

Marcel
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

Electricity monitoring with a twist...

Post by Snelvuur »

A friend of mine uses a webcam and uses "motion" under linux to check for changes (when the led blinks) which works nice too.

// Erik (binkey.nl)
Post Reply

Return to “Home Automation Projects”