EcoRenovator  

Go Back   EcoRenovator > Improvements > Appliances & Gadgets
Advanced Search
 


Blog 60+ Home Energy Saving Tips Recent Posts Search Today's Posts Mark Forums Read


Closed Thread
 
Thread Tools Display Modes
Old 12-19-10, 05:10 PM   #21
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

Well 6 days later everything is still working although I have found a limitation to my current logging technique. Saving a row every minute in a CSV file works just fine. The file is now 323.1kb which works out to about 20 MB a year which is nothing in my mind. It is however 8600 or so rows and open office has started to gak on it. Opening the file now takes 20 seconds and creating a chart takes close to 2 minutes. If I try to do any smoothing of the data it takes over 10 minutes. Simply resizing the chart when it's produced grinds on the new very fast quad core 8 gig's of ram machine.

This isn't shocking there is a reason real databases don't store everything in csv files. Things are really busy here but I may need to start on the link to the google apps DB or a local DB really soon. I want to learn the google apps version and get that data up for everyone to see but local is free, easy and not too difficult.

Another thing I also need to do is take a look at how much space is on the arduino it's self and see if I can get the code to store the data for awhile if the serial port isn't available. I had to reboot once and lost 4 minutes of data, which is far from critical but I like my data to be complete.

strider3700 is offline  
Old 12-26-10, 01:55 PM   #22
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

I got back on the project yesterday after just letting the two temps sensors collect data for a week or so.

During that week I had the serial port "vanish" once and after unplugging the arduino and plugging it back in to the USB port it went back to working just fine. I'll have to see if I can figure out what caused that as it has happened twice. All data being collected is gone when that happens of course.

I've decided at this point I'm going to change my logging to CSV files to be a new file daily. so at midnight the file name being written to will change to datalog-ddmmyyyy.csv This is of course still just a temporary datastorage but I will probably leave it in place long term when I'm done with the online logging as well. The code for that should be easy so maybe tonight I'll knock that out.

Much more interesting then my "issues" however is the progress. Yesterday I had the soldering iron out and decided to attach a chunk of the 2 pair to one of the current sensors. I then took my homemade extension cord for the wood stove which has those screw together plugs apart and ran one of the wires through the hole in the current sensor. Wiring to the arduino was simple, 5v to vcc, gnd to gnd, en to gnd(this could be switched on the arduino but power usage at this scale isn't import enough to use a pin), data to one of the analog in pins on the ardunio(0 in my case)

then in the arduino sketch I added a small section which basically just calls analogread(0); This reads the current voltage at pin 0 between slightly over 0 and slightly below 5V and turns it into an integer between 0 and 1024 with each working out to roughly 0.0049V. It turns out the current sensor returns roughly 509 when no current is flowing through it. So in the arduino code I just subtract 509 from the value returned and just get anything above or below that.

Last night I had a hell of a time getting any good readings and it was making little sense until I graphed it and went to bed to sleep on the issue. I was always getting 506-515 even when I had a 1500 watt heater plugged in that was using in the 1450 range according to my wattmeter. I was taking about 100 readings per second and averaging trying to get rid of noise on the line thinking it was noise....

This just goes to show that I'm a programmer not an electronics guy. AC is a signwave and it will go both positive and negative in one cycle. The current also seems to be going in a wave as far as I can tell and I really really didn't want an average I wanted to know the peak value each second. Realizing this while sleeping last night, this morning I got up and changed my reading code to loop through 1000 times with a delay of 1 ms each loop and take the value each time. I then took the absolute value of it and checked if it was higher then the previously recorded max. if so max became that reading, continue the loop. At the end of the loop print out the max and reset it to zero.

This works great and I'm now able to graph with only minor noise jitters the hater turning on the fan, to high, to med to off to high.... with the values being anywhere from zero to 71 and it to the naked eye appearing pretty linear. It appears to have a "resolution" of about 7 watts. Anything below that vanishes in noise. I also get the occasional spike of noise in the 7 watt range.

If you want really sensitive down to the watt 100 times per second readings my approach isn't the way to go but for having a good idea how much power something large is using this works out great and it cost me $5 for 1 sensor.

Now my next step is to get the values converted to watts for logging since that is what I care about. That should just be some math on the arduino. I also think I may change the datalogging program to handle current sensors a little differently. A minutely average may not be accurate enough.

That is all just a bit of code. The next interesting thing is figuring out how to get a 220V wattage using two of these sensors on each line running into the hotwater heater. That was the real goal of the current readings. For now I'll just wire them up and get the readings back from both sensors so the rest should just be math. Do I just sum the two?

All code for both sections will be available when I get it a bit less hacked together.
strider3700 is offline  
Old 12-26-10, 03:37 PM   #23
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

While researching if summing two 110 legs of a 220 V circuit will give me the value I want I discovered RMS voltage. This is why I love doing projects from scratch myself, I learn a crap load in areas I know very little about.

Anyways when the kids are napping I'm going to give RMS a try and see if I can get that math working out. Right now I have no exact mains voltage reading so I'll have to hardcode based on what the wattmeter reads to calculate my wattage used.
strider3700 is offline  
Old 12-27-10, 02:35 AM   #24
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

well the RMS calculations didn't work out. my base reading from the sensor with no current is 1/2 vcc which gets translated to roughly 507. Hooking up the heater I get up to 570 on high which the kill a watt reports to be 1300 watts. The RMS calculation climbed to 509 maybe 510 doing the math in a spreadsheet using the current sensor datasheets estimate of approximately .023 mV/amp The peak readings was off by about 15% adjusting the math to 0.026 mV/amp I get within 2% for all of my readings done above 500 watts. The values below 500 watts are 12, 17,26,53 and they are off by 47%,75%,47%,18%.

At this point I'm going to go with this method and just the higher adjusted value. The water heater is closer to 5000 watts then 50 watts so hopefully things stay close up there. I'd love to get a real instantaneous reading to know how close I am on the tank but I don't have the equipment to do it.

Another concern I have is the watt meter tells me I have 119 V, when I kick the heater on full the voltage drops to 114 V. I'm assuming the same will happen with the hotwater heater however it won't be running on a close to overloaded circuit like the portable heater was. I'll probably just guess at the voltage on the line as being 230 and live with that. Now that I think about it I suppose I could read it directly using the multimeter one day when the heater is running.
strider3700 is offline  
Old 12-27-10, 07:39 AM   #25
hamsterpower
Apprentice EcoRenovator
 
Join Date: Oct 2009
Posts: 142
Thanks: 0
Thanked 11 Times in 11 Posts
Default

Quote:
Originally Posted by strider3700 View Post

I've decided at this point I'm going to change my logging to CSV files to be a new file daily. so at midnight the file name being written to will change to datalog-ddmmyyyy.csv This is of course still just a temporary datastorage but I will probably leave it in place long term when I'm done with the online logging as well. The code for that should be easy so maybe tonight I'll knock that out.
Just to keep your files in the order they were collected, I would write the file name "datalog-yyyymmdd.csv". Otherwise great project.
hamsterpower is offline  
Old 12-27-10, 08:05 AM   #26
Daox
Administrator
 
Daox's Avatar
 
Join Date: Aug 2008
Location: Germantown, WI
Posts: 5,525
Thanks: 1,162
Thanked 374 Times in 305 Posts
Default

Wooo current data logging, very interesting. What current sensors are you using btw?
__________________
Current project -
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
&
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
Daox is offline  
Old 12-27-10, 12:13 PM   #27
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

good point hamster.


Doax I'm using 1 of these Linear BiPolar Hall Effect Current Sensor +/- 80 Amps. I picked up 4 and with shipping they cost less then $30 total if I remember correctly.

I have 2 more that will be going to the hotwater heater probably tonight. And that leaves me 1 more which I haven't decided what to do with yet. I may pick up a couple of the larger ones with the 1/2" openings to monitor power usage on the heat pump. It's got some thick cables running to it.


Last night I took my test cord back and plugged the woodstove in. It only took a couple of minutes with the kilawatt meter to determine voltage, and watts used by the fan then tweak the code in the arduino so that it matches or very close to If I remember kilawatt readings are 42W low, 74W high and the arduino now reads 43W low 74 high by changing the 0.26mV/amp to 0.40 mV/amp. This gave pretty accurate readings across the board from 16-74W but would be way way too low above 500W.

Since you don't move the sensors around easily and my loads are going to be pretty consistent hardcoding that adjustment into a function used just for the woodstove works just fine for me. If I was making this completely generic I could do a table of voltage-conversion factors.
strider3700 is offline  
Old 12-28-10, 11:23 PM   #28
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

An update - I'm stressed beyond belief which sucks but the good news is I tinker/code to relax so this morning I had my 2 year old measure out two length of 2 cable and I soldered on two more current sensors then hooked them up to the hotwater tank. The run is far from permanent or professional looking(do pro's stick wires to the ceiling with ducttape?) but it is hooked up and "working"

Here is my hotwater usage since a few minutes after noon.



The first big flat usage is my shower then my wifes, both extra long and hot for the sake of scientific discovery. It took almost an hour to recover from what was probably 20 minutes of showering.

The other flat top is from the dish washer. I find the 5 needle point spikes interesting they don't line up with usage in the house that I can identify so I believe that is the tank staying warm. I'll be logging for awhile here looking to see if that is the usage. The reason I put working in quotes is that wattage scale on the left is an approximation. I have no way to verify what the tank is actually using and calibrate the sensor. I think my tank is going to use at least 5000 watts, but as I've asked in another thread I don't understand the label on the side.

Anyways I'm very happy with this progress and look forward to determining the watts used on a monthly basis and from that the $$$. The best way would be to calculate the area under the curve but since most of my readings are on or off I'm thinking just counting the minutes where it's on and working KWH from that is easiest.

I also took the time to get the filename updating each night. I went with YYYYMMDD formating as suggested. That took about 2 minutes when I calmed down and though about it.

So far I'm very happy with this project. I've spent $3 in temp sensors $17 in current sensors, $10 in cable and an arduino that you could find for less then $30 if you look hard enough. I now have temp readings from 2 rooms with each additional sensor being $1.50 and 2 lines of code work, A current reading that tracks when my woodstove fan is running, and continuous current readings from my hotwater tank all being logged to a pc from which getting that data online is commonly dealt.

Next step. will probably be getting the data online. opening the CSV file and generating a new graph each time is getting annoying. Plus I want to see realtime readings on my TV...

Not far down the road will be getting the differential temperature controller aspect of the project working. It should be easy in my mind - read the temps if the conditions are appropriate turn a pin connected to the relay on so the relay is activated. If conditions are bad turn it off. This can all be processed in the main loop every 2 seconds like the data collection.

I also need to start seriously thinking about getting a permanent board with proper connectors to pull all of this wiring together. The breadboard is getting ugly to work on with 22 wires coming to it and a crap load of jumpers to share VCC and ground.

Last edited by strider3700; 12-28-10 at 11:34 PM..
strider3700 is offline  
Old 12-29-10, 11:18 AM   #29
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

I just checked the overnight charts on the hotwater heater and every 3 hours the tank ran for about 3 minutes to maintain it's temperature. So that works out to 24 minutes of operation per day. If it's using 5kw while running then it's using 2 kwh each day. or roughly 15 cents.

<Edit>

I did a bit of thinking on how to calculate total daily usage and came up with a pretty accurate in this case solution. I simply go to my spreadsheet and added a column with =if(wattage>100,1,0) so basically if the wattage being read is above 100 then it's on else it's off. The 100 is used to remove noise from the readings, I get spikes up to 50ish watts which is probably just random noise in the signal. The heater definitely uses more then that when turned on so I'm ignoring them. Anyways this gives me a minute by minute account of if the heater is on or off. From there I just sum the number of minutes it was on and applying the 5kw value calculate the total kwh used during the day.

So yesterday from 12:15 to midnight we used 9.5kwh to heat hotwater which cost roughly 76 cents. This sounds high but our major water usage came in the afternoon so the morning probably wouldn't be much more usage.

This works out to roughly $22.8/month for hotwater or $277/year for hotwater. Assuming I can achieve 70% solar heating which is the commonly thrown around number for my location then my in progress solar hotwater setup will save me $194/year giving me a roughly 5-6 year payback I think. THis is before utility increases and in a house with a baby and a toddler. Long term hotwater usage will go up and the utility has already applied to have a 10% a year increase in costs for the next 3 years.

Last edited by strider3700; 12-29-10 at 12:57 PM.. Reason: added daily total reasoning
strider3700 is offline  
Old 12-30-10, 12:00 PM   #30
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

It was explained to me that I was probably using the wrong value for kw when the heater is running. It's likely that only one of the elements is turned on at any given time so since it's wired for 240V I'm probably using 3800 Watts not 5000. The explanation is good enough that I will recalibrate based on that and redo the math.

Yesterdays numbers are in and the water heater ran for 133 minutes. By far the biggest user was the kids baths and the hotwater load in the washer at the same time. My wife and my quick 4-5 minute each showers made the heater run for about 20 minutes total. THe kids baths and washer had it running for over an hour.

Once again the distinctive every 3 hours temp top up for 3 minutes spike was visible during periods of us not being at home or in bed.

So doing the math based on 133 minutes of 3800 watts means 8.42Kwh costing $0.67 for a monthly total of $20 or a yearly total of $242 This pushes non adjusted rates/usage payback of the solar system out further but it's still worth it.

On the more tech implementation side of the project I'm thinking I need to adjust how I'm handling the readings/data. Averaging on the arduino and dumping the data off every minute rather then every 2 seconds and averaging on the PC should give me the same results but make it easier to store data on the arduino when the PC isn't running. I'm wanting to do a reboot and install some hardware on the PC but don't want to lose data while it's down for 10 minutes.... I'll look into datalogging on the arduino and setting up some sort of system where the PC requests the data from it. That makes a bunch of potential issues go away but adds complexity to get the times synced up.


Last edited by strider3700; 12-30-10 at 12:06 PM..
strider3700 is offline  
Closed Thread


Tags
data, logging

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger
Inactive Reminders By Icora Web Design