Author Topic: AMP hour logger and sample rate  (Read 8692 times)

0 Members and 1 Guest are viewing this topic.

Rover

  • Hero Member
  • *****
  • Posts: 788
AMP hour logger and sample rate
« on: September 26, 2010, 01:22:52 PM »
For the DIY controller/monitor crowd

What are others using for a sample rate and calculation for amp/hr measurement?

I'm curerntly using an old 16 bit stamp as a monitor, with a sample frequency of 2 secs (yeah I know, low) which fine for solar monitoring, but pretty lousy for wind turbine, where fluctuations within a 2 sec period can be large. In addition I'm averaging the readings to get an amp/minute  , then create my amp hour from that. Not terribly accurte

I'm in the stages of building my new one , around a fairly fast 32 bit microprocessor.






Rover
<Where did I bury that microcontroller?>

JeffD

  • Jr. Member
  • **
  • Posts: 50
Re: AMP hour logger and sample rate
« Reply #1 on: September 26, 2010, 02:59:43 PM »
I'm sampling turbine current 10 times a second but its mainly for control of the buck converter for mppt.  Every 500ms I update the watt hour stats for the wind turbine, solar, and loads using an average of the samples taken since the last stats update.

For the micro-controller I used an Atmel AVR ATMEGA328 running at 16Mhz. 

Rover

  • Hero Member
  • *****
  • Posts: 788
Re: AMP hour logger and sample rate
« Reply #2 on: September 26, 2010, 03:19:43 PM »
Thankss for responding

Your Stats update is every 1/2 sec (used fo W/H) are you taking  5 readiings per update?

What is your average across time, how many reading per unit time, are you discarding data 0 and less in the averaging , averaging over > 0 and number of + .. etc, or including all data points?)

I've done numerous searches on the subject (not just here ) ... not yet faound an absolute answer (probably because no one can measure all points in a time duration)

Rover
<Where did I bury that microcontroller?>

BrianSmith

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #3 on: September 26, 2010, 07:00:15 PM »
I am in process of trying to build one too. 

I would say if you sample at 2x the highest frequency you will get out of your mill, you will be able to average it out (the AC part).  You can also put an RC filter on it as well.

I am planning on oversampling and averaging.

Here is a picture, just starting turning it up this weekend.

[img][img]

I'm using a little PIC18F processor with no divide which will make it a bit challenging.... :'(

JeffD

  • Jr. Member
  • **
  • Posts: 50
Re: AMP hour logger and sample rate
« Reply #4 on: September 27, 2010, 12:44:24 AM »
Rover: The turbine current is sampled every 100ms. I use a ring buffer to keep the last 5 samples ie the last 500ms of data samples.  Several tasks use the data samples for different purposes.   In hardware the current is measured through a shunt on the low side.  Each side of the shunt goes to an op amp set up in a Sallen-Key low pass active filter configuration before it is sampled by the ADC of the micro-controller.

  I use the watthour bucket system to keep track of the watts produced over the last minute, the last 24 hours, and last 7 days.  Every 500ms the watthour stat function gets executed and uses the average of those 5 samples (which were taken during the last 500ms) to calculate the wattminute for the last half second (watts/120: 120 samples per minute) which is then added to the wattminute bucket.  So basically the watts being produced each half second are summed over a minute period (simple integration).

  At the end of each minute the value that has accumulated in the wattminute bucket is converted to a watthour by dividing by 60 and adding the result to the current watthour bucket.  The wattminute bucket is then set to zero so that it can get the sum for the next minute.

  There are 24 watthour buckets set up in a ring buffer so each hour the index is incremented by one to access the next watthour bucket and its contents are set to zero.  So on the LCD display you can view the hourly production rate over the last 24 hours.

  The are 7 day buckets set up in a ring buffer.  At the end of each 24 hour period the day index is incremented and the previous day bucket is set to the sum of the 24 watthour buckets.  You can view the 24 hour power production for the previous 7 days on the LCD.

  The micro-controller has no FPU and trying to do floating point operations in code is too expensive and consumes to much of the program space so I am using 16 bit fixed point number representation for all real data.  Because I am using fixed point representation its very easy to lose resolution with large number divides.  That is why I use the wattminute bucket instead of just calculating the watthour each half second and summing in the current watthour bucket.

  Why did I use the bucket system for keeping track of power production and usage?  I found it an easy way to do the integration of power for different time periods while minimizing storage requirements.  The ATMEGA328 only has 2kilobytes of ram so storing 7 days of data sampled every half second is not going to work.  The current method only uses 66 bytes (including indexes) of ram for each power producer and consumer.  The system monitors a wind turbine, solar panels, and the inverter so a total of 198 bytes is used for power stats.  Some day I will get around to dumping the raw data to an SD card or remotely logged on a netbook but for now it serves what I need.

commanda

  • Hero Member
  • *****
  • Posts: 731
Re: AMP hour logger and sample rate
« Reply #5 on: September 27, 2010, 05:22:48 AM »
I'm using a Picaxe 28X1. I have seperate shunts for charge & discharge, & sample every 1/2 second. I have 2 buckets, one for charge, and one for discharge. Each bucket rolls over at 1/2 AHr, at which point the battery capacity is increased or decreased by 1/2 AHr, and remaining capacity calculated as a percentage of total battery capacity.  All the math constants are neatly arranged so the whole thing runs on integer math.  The rollover number for the charge bucket is increased slightly to allow for less than 100% charge/discharge efficiency.  I'm not doing any averaging. The serial port also allows logging to a PC. Logging time is user adjustable in one minute increments.

Here's a sample from an old log file;
It shows time (PC time), battery voltage, discharge current, charge current, remaining capacity, and status.

07:23:02, 12.82, -0.4, +0.3, 92, DisCharging
07:33:02, 12.84, -0.4, +0.3, 92, DisCharging
07:43:02, 12.84, -0.4, +0.3, 92, DisCharging
07:53:01, 12.86, -0.0, +0.4, 92, Charging
08:03:01, 12.86, -0.0, +0.3, 92, Charging
08:13:01, 12.86, -0.0, +0.4, 92, Charging
08:23:01, 12.88, -0.0, +0.4, 92, Charging
08:33:01, 12.88, -0.0, +0.4, 92, Charging
08:43:01, 12.98, -0.0, +1.7, 92, Charging
08:53:01, 13.16, -0.0, +3.0, 92, Charging
09:03:01, 13.26, -0.0, +3.7, 92, Charging
09:13:01, 13.32, -0.0, +4.0, 92, Charging
09:23:01, 13.34, -0.0, +4.3, 93, Charging

Amanda

Rover

  • Hero Member
  • *****
  • Posts: 788
Re: AMP hour logger and sample rate
« Reply #6 on: September 27, 2010, 04:59:39 PM »
Thanks for the responses.
 Since I  already have a monitoring system http://rovr1.com/wind/windsolardata.html , this latest one has been in garage development for over a year (work on it a little bit, get side tracked , put it all away, etc) .

I figure I will finish between now and December. I was debating whether to go 100ms or 10ms sampling (ADC sample rate is 133kHz , 4 hall effects are  us) . I plan to continue with the Halls. Since the micro is 32bit with 32 bit signed integers , I'm not too worried about the number of readings (within reason)

Its a propeller chip , 8 core, and I'll probably run it at 80-100 MHz, and for now only use 2 cores. First core will have a 1 minute loop where it will  collect variables from the 2nd core, clear the variables,  send data to the LCD (probably a sub loop) and rf to my database in the house (xbee) runing on a laptop, and other things. 2nd core will do the sampling, over 6 of the ADC channels (Max 186). For A/hr W/hr I'll just go additive and transmit the value .

I'll evetualy program the third core for controller functions... since they are async I can keep t out of the main loop








Rover
<Where did I bury that microcontroller?>

frackers

  • Sr. Member
  • ****
  • Posts: 435
  • Country: nz
  • Picard spits "Hello"
Re: AMP hour logger and sample rate
« Reply #7 on: September 27, 2010, 06:59:13 PM »
I'm using a Dallas DS2438 1-wire battery monitor chip that samples current 30 times a second and maintains its own amp/hr registers without CPU intervention. It read using a Linksys router via a DS2480B serial to 1-wire chip.

The details of the project can be found at http://gilks.ath.cx/~g8ecj/Turbine/controller.html

The statistics output can be seen at http://gilks.ath.cx/cacti/graph_view.php?action=tree&tree_id=3 - the totals say it all really, after 18months its seen over 26,000 amp/hrs into the battery bank!!

Robin Down Under (Or Are You Up Over)

Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #8 on: September 27, 2010, 07:11:00 PM »

I figure I will finish between now and December. I was debating whether to go 100ms or 10ms sampling (ADC sample rate is 133kHz , 4 hall effects are  us) . I plan to continue with the Halls. Since the micro is 32bit with 32 bit signed integers , I'm not too worried about the number of readings (within reason)


I guess the big question would be; *Why* would you need to sample 100 times a second ? 10 times a second surely is enough. Technically, you could probably do 2 readings a minute ( per sensor ), average, and still have a fine enough resolution to be fairly accurate.

Just a single consideration here. The harder you work your processor, the more power it will consume. I have not looked at the propeller design specs recently, but I suspect that anything with 8 cores, for its package size is already going to consume a larger amount of power by comparison.

Anyways, I am not trying to start a flame war, or even get you or other to think the way I do.  However, I would like to know why you would want a 10ms resolution, or even a 100ms resolution. Maybe I missed something. However, there is more to the big picture, than even my example consideration above. Much more.

Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #9 on: September 27, 2010, 07:23:40 PM »
I'm using a Dallas DS2438 1-wire battery monitor chip that samples current 30 times a second and maintains its own amp/hr registers without CPU intervention. It read using a Linksys router via a DS2480B serial to 1-wire chip.

Very nice ( Robin is it ? ).

I was just at Maxims page today downloading several app notes for various things, and their 1-wire technology stuff was among them. There is a lot of very interesting stuff in their app notes section. Being an amateur electronics hobbyist, with a fairly good software design background ( also as a hobbyist, but for ~12 years ), I can use all the help I can get. 

Having documented my own various projects, I do know it does take a bit of time, and effort to do so. Thank you very much for taking the time, and sharing this with us.

ghurd

  • Moderator
  • Super Hero Member Plus
  • *****
  • Posts: 8059
Re: AMP hour logger and sample rate
« Reply #10 on: September 27, 2010, 07:56:47 PM »
10 times a second surely is enough. Technically, you could probably do 2 readings a minute ( per sensor ), average, and still have a fine enough resolution to be fairly accurate.

I do not understand much of this thread, but I agree with that in a place with clean wind.
I do not have a decent place with clean wind, but I think 1 per second would get it closer than I could determine what to do with the data.
A margin of error will eventually show a 220AH battery has 440AH available, or a 12V battery dumping for 72 hours at 14.4V is totally drained.

Then again, sometimes the entire purpose of a project is simply to see what CAN be done.
And in that type of project the intent is to do it for the sake of doing it, more than why it is being done.  I do that.

My general modus operandi is a $3 HF volt meter.
The battery is full or empty or somewhere in between.
The voltage is increasing or decreasing, and overall it is being charged or drained.
It tells how much power can be used at that time.
But that ain't no fun for you guys who understand the details in this thread.   ;)
G-
www.ghurd.info<<<-----Information on my Controller

BrianSmith

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #11 on: September 27, 2010, 11:00:20 PM »
My plan is to make a meter that can read RPM, wind speed, amps and volts, calculate power.  Would like to put in some load control for the VAWT guys.  It kinda gives you everything you need to characterize the generator and blades and record whats going on at your site with your generator.  Then add a few alarms based off RPM or wind speed or power output so you might find out its about to blow off the tower before it blows off the tower or lets the smoke out of the stator.   :'(

I don't see how you can figure out your battery capacity watching the current when you have a dump load on it... ???

Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #12 on: September 27, 2010, 11:43:59 PM »
Well, technically speaking. You *can* fire off an interrupt every time your various reading change. . This could however increase code complexity. But it really matters how fine of a resolution you want/need. It could also lead to you taking more samples than you need/want, and could even lead to the processor reaching 100% load. Real time applications is not really my forte, but I do know there is also more to it than what I mentioned here. Maybe based on interrupt events, limit the sample amount per period ? I could see that getting fairly complex in a hurry.

Anyways . . .

I started thinking about this after reading ghurds post. This is something I should have thought about earlier. Basically, my main interest in this post was just to perhaps learn why such a fine time period on the sampling. I have had a long time interest in embedded design where this sort of thing is concerned, and am always willing to learn. Great work by the way people.

Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #13 on: September 28, 2010, 12:34:40 AM »
I don't see how you can figure out your battery capacity watching the current when you have a dump load on it... ???

By knowing your battery voltage capacity. Every decent ( all ? ) battery has bulk, and float battery specifications. Once you reach your max float charge value ( in voltage ). You should be at, or close to your maximum amp hour capacity. Of course, assuming your cells are in good condition. There is at least one commercial data logger type of device that does this. You input the needed battery specifications into the device when you first install it, and then it keeps track of everything for you, displaying the information on an LCD.

At least this is in theory. This method seems as kind of a hack to me. However, I do not know how one could do better than this, while keeping such a device generic enough to work with any brand / type of battery.  Perhaps though, there is a complex mathematical formula that I am unaware of to let you figure out how much a battery's capacity really is in amp hours vs. a set time constant( based on its voltage ) ???

Rover

  • Hero Member
  • *****
  • Posts: 788
Re: AMP hour logger and sample rate
« Reply #14 on: September 28, 2010, 11:50:19 AM »
Yyrkoon,

The sampling rate for current measurement is more important in those sitatuations where you could have short duration charging or outgoing current. An example would be a small high RPM wind turbine ("Screaming Mimi" ) . Let's say it has a 12 volt cut-in at 300 RPM , and in this situation it is almost at cut-in, running just below 12 volts. Then there is strong short-lived wind gust that pushes it over cut-in and the current rises quickly and then dissipates quickly as the gust subgsides. This can easily happen in under 30 seconds even under 10 (probably even less).

This image is a totally fictional real time graph of such an event amps vs seconds, if your sampling rate was 2x a minute, you'd never know about (light blue highlight), and it would never be added to you amp/hr or watt/hr measurements. Let say you had a sampling rate of 2 seconds, and you sampled on the 16 and 18 , you would get ~ 8 amp reading for both, and then use that in your calculations. But that would be inaccurate, because the current did not stay steady at 8, it went up beyond 10 amps, but the samples couldn't pick it up. Increasing the number of slices increases the accuracy.



Ok I couldn'resist the following. Some poor hapless frog manages to short circuit a pair of output lines from the battery, that you are monitoring.  At 6 Seconds, he creates the shortcircuit passing 100 amps, unfortunately for him he has a high enough resistance not to just go up in a bang of smoke but  his fluids boil of and he is converted to charcoal. Current goes down as his resistance increases.  You could enitirely miss the 100 Amp spike




:)
Rover
<Where did I bury that microcontroller?>

ghurd

  • Moderator
  • Super Hero Member Plus
  • *****
  • Posts: 8059
Re: AMP hour logger and sample rate
« Reply #15 on: September 28, 2010, 01:09:13 PM »
"An example would be a small high RPM wind turbine ("Screaming Mimi" ) "
Good point.
My mini-ECM (25", 650RPM cut in) in a bad location in my yard would go 0ma to >300ma to 0ma in under 5 seconds for sure.
A short time duration, but thats about 15~20% of peak power output in my case.

That poor frog.  :'(
G-
www.ghurd.info<<<-----Information on my Controller

Rover

  • Hero Member
  • *****
  • Posts: 788
Re: AMP hour logger and sample rate
« Reply #16 on: September 28, 2010, 01:21:16 PM »
That poor frog.  :'(
G-

No frogs were hurt in the drawing of the graph, the simulation experiment has been postponed until a suitable replacement for a frog can be found  ;D
Rover
<Where did I bury that microcontroller?>

TomW

  • Super Hero Member Plus
  • *******
  • Posts: 5130
  • Country: us
Re: AMP hour logger and sample rate
« Reply #17 on: September 28, 2010, 02:12:56 PM »
Rover;

As much as I dislike agreeing with you IRC guys, I gotta say you are dead on here. No pun.

Poor frog

I often see high amp bursts of short duration and occasionally see short term draws of equal or greater value some for a ferw seconds up to a minute. This could easily occur such that most of the burst would be missed if sampling at 30 seconds or so..

I think for real accuracy and lower resource use one second samples would be a good compromise. More gut feeling than science.

Of course there is also a possible scheme where you take a lot of samples, average and use that value?

Tom

wooferhound

  • SuperHero Member
  • ******
  • Posts: 2288
  • Country: us
  • Huntsville Alabama U.S.A.
    • Woofer Hound Sound & Lighting Rentals
Re: AMP hour logger and sample rate
« Reply #18 on: September 28, 2010, 08:38:36 PM »
You are talking about peaks that you may miss with a longer sample rate but there are also just as many dips, I think that even with an unusually long sample rate like 5 - 10 seconds that all the peaks and dips would average out correctly when it's all over.

Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #19 on: September 28, 2010, 09:58:27 PM »
Yes, I do also agree. one reading every 30 seconds in a lot of cases would not work very well.  That was pretty much an overstatement, but still to some small degree a valid point. I mean, we are still talking about amp hours, where any measurement under an hour is going to have to be averaged over the course of the given hour anyways. Right ? In theory, the data should normalize well enough to be fairly accurate.

With the above said, I still think that 1 reading per sensor every 100ms is too much. Definitely every 10 ms. 2 readings a second, averaged, would be enough for me personally. Key word there *Me*. It was not always this way however. Having had many chats with a friend of mine who has been an EE for 30 + years. I have come to the conclusion that "more" is not always necessary, or even better. That, and we have had this exact same discussion. More than once. But, it really depends on exactly what you plan on doing with that data.

Here, we're just talking about data logging, where technically the data is not so important, as compared to perhaps something like a MPPT controller where action is taken based on that data. Even with a MPPT charge controller though, you will not be reacting on that data even once every 1 second. Otherwise your controller would be oscillating wildly up and down.

Also, I completely understand ghurds point about sometimes we do things because we can, and to see the final result. I do this as well. For me though, this is why sometimes the chats I have with my buddy are a very good thing.

Rover, with everything I have said above here, I have thought of a fairly cool test you could run. Assuming it was not too much of a hassle, and you felt like humoring me. Since, you already have a Propeller setup for data logging , with 8 cores ( cogs ), perhaps you could run simultaneous readings, at different resolutions to see what works for you. In this way, you could at least answer your own question above where I got involved in this post. I would really be very interested in the data as well, if you did so.


commanda

  • Hero Member
  • *****
  • Posts: 731
Re: AMP hour logger and sample rate
« Reply #20 on: September 29, 2010, 04:46:15 AM »
Being Australian, I would like to move that we adopt the Queensland Toad as a suitable replacement for the poor frog.

And, I think, adding up all the responses, my choice of 1/2 second sampling seems pretty good.
Even though I'm only running solar, and not yet wind.

Amanda

frackers

  • Sr. Member
  • ****
  • Posts: 435
  • Country: nz
  • Picard spits "Hello"
Re: AMP hour logger and sample rate
« Reply #21 on: September 29, 2010, 06:26:32 AM »
Being Australian, I would like to move that we adopt the Queensland Toad as a suitable replacement for the poor frog.
Croak croak

Quote
And, I think, adding up all the responses, my choice of 1/2 second sampling seems pretty good.
Even though I'm only running solar, and not yet wind.

Amanda
Thats pretty near where I am - my system gets round all its voltage, current and temperature measurements about twice a second. I don't seem to be missing any big peaks on my 10 footer judging by the ratio of peak power (sometimes over 2kw) to average power (even in a furling wind my average is about 400w).
Robin Down Under (Or Are You Up Over)

Rover

  • Hero Member
  • *****
  • Posts: 788
Re: AMP hour logger and sample rate
« Reply #22 on: September 29, 2010, 07:53:29 AM »
In theory, the data should normalize well enough to be fairly accurate.

The goal for me is not to be fairly accurate, but rather as accurate as reasonably possible. I'm not looking for "good enough" but rather as "as good as I can do".

Quote
Rover, with everything I have said above here, I have thought of a fairly cool test you could run. Assuming it was not too much of a hassle, and you felt like humoring me. Since, you already have a Propeller setup for data logging , with 8 cores ( cogs ), perhaps you could run simultaneous readings, at different resolutions to see what works for you. In this way, you could at least answer your own question above where I got involved in this post. I would really be very interested in the data as well, if you did so.

The propeller is not set up for data logging, it is a work in progress. As I stated earlier, my current system is based around a 16bit micro, sampling 6 channels of an ADC every 2 seconds, which I already find to be innadequate. The 2 second sample rate was used due to RAM limitations and also to keep within the bounds of 16 bit integers. Moving to 32 bit micro, gets me around those issues, so I can increase my accuracy. The system as it stands now wirelessly transmits to my house where the data is stored in a database, and after some software manipulation,  some is uploaded to my web site. This also gives me the capability to data mine.

In my new design, data logging is not the end point, at some point it will also be used as a controller as well as to handle the automation of some of the items powered by the system (Outdoorlights, stream pump, etc). (The automation is currently being handled by other microprocessors that I have built)

As far as a test, I should probably get my hands on a "Watts Up" style meter and compare, although I do not know the sampling frequency of those meters, only their stated accuracy.

Most of my RE is done simply because I want to, and I can.

FYI I am a programmer by trade.








Rover
<Where did I bury that microcontroller?>


DanG

  • Hero Member
  • *****
  • Posts: 1122
  • Country: us
  • 35 miles east of Lake Okeechobee
Re: AMP hour logger and sample rate
« Reply #24 on: September 29, 2010, 05:08:48 PM »
hey, Justoine Knight; welcome. If you read back to page one post Rover explains his choice is an eight-core microprocessor.

The PICs have been tossed around before, yes.




Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #25 on: September 29, 2010, 09:11:30 PM »
The propeller is not set up for data logging, it is a work in progress. As I stated earlier, my current system is based around a 16bit micro, sampling 6 channels of an ADC every 2 seconds, which I already find to be innadequate. The 2 second sample rate was used due to RAM limitations and also to keep within the bounds of 16 bit integers. Moving to 32 bit micro, gets me around those issues, so I can increase my accuracy. The system as it stands now wirelessly transmits to my house where the data is stored in a database, and after some software manipulation,  some is uploaded to my web site. This also gives me the capability to data mine.


As far as a test, I should probably get my hands on a "Watts Up" style meter and compare, although I do not know the sampling frequency of those meters, only their stated accuracy.


Rover,

Bummer, I had read your posts as you were at first using a Basic stamp, and then moved to the prop. The only reason I mentioned a test comparison though was that you could basically do it for "free", and simultaneously on the same chip. At least I think you could from the little bit I do know about the prop chip. Which admittedly is not very much. Just did a bit of light reading on them, before I decided that a Parallax propeller was not for me.

As for what I am going to do . . . Currently I am trying to reverse engineer an XM radio remote receiver head ( that has an on PCB ATMEGA64L, built in  LCD etc ). So I can *hopefully* reprogram it for at least battery monitoring. We'll see how that works out though . . . I am kind of in over my head, but my buddy says "it's easy", and that he will give me a hand when I need it. Hopefully I come away from this project with more than just the knowledge that it can not be done. We'll see.

JeffD

  • Jr. Member
  • **
  • Posts: 50
Re: AMP hour logger and sample rate
« Reply #26 on: September 29, 2010, 09:34:15 PM »
Yyrkoon: The ATMEGA64L has twice the program storage and sram storage as the ATMEGA328 that I use in my controller/monitoring system.  Its a very powerful little microcontroller that can easily handle battery monitoring along with many other things: http://fieldlines.com/board/index.php/topic,143829.msg971679.html#msg971679.

  The L version of ATMEGA64 can only be clocked to 8 MHz but still plenty of processing speed for what you want to do.

Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #27 on: September 29, 2010, 11:05:48 PM »
Yyrkoon: The ATMEGA64L has twice the program storage and sram storage as the ATMEGA328 that I use in my controller/monitoring system.  Its a very powerful little microcontroller that can easily handle battery monitoring along with many other things: http://fieldlines.com/board/index.php/topic,143829.msg971679.html#msg971679.

  The L version of ATMEGA64 can only be clocked to 8 MHz but still plenty of processing speed for what you want to do.

Thanks Jeff. I pretty much knew it was capable. I am more concerned about my electronics skills, or even the ability to re-task this PCB someone was nice enough to make for me ;) Plus, my AVR knowledge is not the greatest, but have been working on it for some time now.

gizmo

  • Sr. Member
  • ****
  • Posts: 370
  • Country: au
    • The Back Shed
Re: AMP hour logger and sample rate
« Reply #28 on: September 30, 2010, 12:16:19 AM »
Hi Rover

Have you seen my own little logger project http://www.thebackshed.com/Windmill/PicLog.asp . Its based on a PicAxe chip and I've recently rewritten the PC software in JUSTBasic, more open source the original VB6 code. It logs the data to a text file and can also log over the internet to a remote server http://www.thebackshed.com/piclog/.

By default the Piaxace chip in this application is sending serial data to the PC every 2 or so seconds. It takes this long as its sampling wind speed and RPM as well as amps and volts. The PC software will accept a much higher data rate if needed, but it does average the results over 1 second. The default logging is 10 seconds. These timer values could be changed easily if you wanted a faster log rate, but you will end up with some large text files.

The software also records Watt hours and can reset the Wh figure to 0 at midnight. There's also a graphing component.

Have a look, it might give you some idea's.

Glenn

commanda

  • Hero Member
  • *****
  • Posts: 731
Re: AMP hour logger and sample rate
« Reply #29 on: September 30, 2010, 03:13:44 AM »
Linux users can do logging with a simple bash script.

#!/bin/bash

stty -F /dev/ttyS0 ispeed 9600 ospeed 9600
stty -F /dev/ttyS0

stty  ispeed 9600 ospeed 9600
stty
   NOWTIME=`date +%H:%M:%S`
   NOWDATE=`date +%Y%m%d`
   echo  $NOWDATE $NOWTIME

while true
do
   read LINE < /dev/ttyS0
   NOWTIME=`date +%H:%M:%S`
   NOWDATE=`date +%Y%m%d`
   echo  $NOWTIME"," $LINE
   echo $NOWTIME"," $LINE >> $NOWDATE".csv"
done

The sample text I posted earlier was created with this.
The log file filename is based on the date, so it starts a new file at midnight.

Have a look, it might give you some idea's.
Glenn


It certainly did. I used Glenn's project as a starting point for my own. Thanks.

Amanda

Rover

  • Hero Member
  • *****
  • Posts: 788
Re: AMP hour logger and sample rate
« Reply #30 on: September 30, 2010, 06:17:30 AM »
Hi Rover

Have you seen my own little logger project http://www.thebackshed.com/Windmill/PicLog.asp . Its based on a PicAxe chip and I've recently rewritten the PC software in JUSTBasic, more open source the original VB6 code. It logs the data to a text file and can also log over the internet to a remote server http://www.thebackshed.com/piclog/.

By default the Piaxace chip in this application is sending serial data to the PC every 2 or so seconds. It takes this long as its sampling wind speed and RPM as well as amps and volts. The PC software will accept a much higher data rate if needed, but it does average the results over 1 second. The default logging is 10 seconds. These timer values could be changed easily if you wanted a faster log rate, but you will end up with some large text files.

The software also records Watt hours and can reset the Wh figure to 0 at midnight. There's also a graphing component.

Have a look, it might give you some idea's.

Glenn

Yep, very similar to what I am doing right now, looks good. I'm just in the processing of improving mine.
http://rovr1.com/wind/windsolardata.html
http://rovr1.com/wind/datagraph.html
Today's output will be ugly, we are under a weather squall.
I'm using .Net on the PC and a SQL Server database  to store.

Rover
<Where did I bury that microcontroller?>

JeffD

  • Jr. Member
  • **
  • Posts: 50
Re: AMP hour logger and sample rate
« Reply #31 on: September 30, 2010, 11:12:02 AM »
Gizmo: It was your well documented piclog project that laid the foundation for the control/monitoring system that I built. Thankyou.  The only change I had made initially was to use an Atmel AVR ATMEGA168 (now using the 328).


Commanda: I've been using a bash script very similar to the one you posted but I couldn't remember where I got it from.  When I want to get performance data after doing modifications to the turbine, I use a netbook running linux hooked up to the monitoring system through usb .  I then import the data into Open Office Calc to do the graphs and analysis.

Yyrkoon

  • Jr. Member
  • **
  • Posts: 94
Re: AMP hour logger and sample rate
« Reply #32 on: September 30, 2010, 05:38:08 PM »
Hi gizmo,

I remember browsing through your site more than a year ago I think, and found your CNC router project particularly interesting. For some reason though, I am remembering that that project was different back then. The table you have on your site now is a beauty. Looks like something you would buy from a distributer. Definitely much better than the ones the DIY books on "how to make your own CNC router" teach us to make. Out of particle board . . .

Keep up the great work, and thanks much for sharing your projects with us.