PDA

View Full Version : real time logger?



karenhornby
- 19th June 2008, 15:29
Anyone got any ideas how to implement "powered on/run time" in a 1 wire network? All I need is the amount of hours and minutes it's running, in fact it can be just one device that I time as it's going in a car and if powered off the car battery it wouldn't be active anyway when the circuit is off
I did find a DS1904 which LOOKS like it might be able to do the job even if I just turn it's clock on when I want the time measurment to start, and off when finished, but it's a 1 button device and cant see it availabe in the uk as of yet
Any other ideas or suggestions?

Acetronics2
- 19th June 2008, 15:52
Have a look at DS 2405, or 2406 at first ...

it can tell you if there's power or not somewhere ... or act as a switch ( yessss ! both ! )

then you just have to check for the changes and log time ... !

I'd also suggest you to have a look to DS1616 ... you can Log 3 voltages ... plus temp !!!

Alain

mackrackit
- 19th June 2008, 16:12
May not be of help, but a software timer on the PIC might do what you need.
Here are some examples.
http://www.picbasic.co.uk/forum/showthread.php?t=190
http://www.picbasic.co.uk/forum/showthread.php?t=632&highlight=olympic+timer
http://www.picbasic.co.uk/forum/showthread.php?t=2129

karenhornby
- 19th June 2008, 19:41
I'm actually going to be using 2 X ds2405's as switches to work relays along with 2 ds18b20's as temp sensors
What I'd like to do is log the total amount of time the ds2405's are activated and display it on an lcd screen at the start of the program once power is supplied to the circuit (after a second or so warm up time)
I've looked at Darrels include and it looks pretty interesting, however I dont know how i'd implement it to be honest.
I'm guessing I'd have to have the pic powered all the time or it's going to lose the information once power is removed.
I could attach an eeprom I guess but I'm trying to keep the board size as small as possible using normal sized components, so unless there's any way to attach a 1 wire eeprom start it counting once it's told to, then when the circuit starts each time it reads the stored value and displays it as a hours, minutes and seconds display on an LCD then goes back to counting where it left off
hope that actually made sense to someone
basically I dont want to have a battery backup it would only work once power is applied.

karenhornby
- 19th June 2008, 21:44
how about using the eeprom inside the pic?
I'm going to be suing the 16F88 pic it has 256 bytes of eeprom and 20000 hours counted once a second only comes to 33 bytes if I'm starting to understand this right?

What I'd need is some way of telling the pic to start counting once a second but when told it stops counting and puts the result into eeprom, THEN when it's told to start counting again it reads the value from eeprom, displays it on the lcd for a few minutes and then carries on couting FROM that count.

Does this seem possible? I know to most experienced people here it's probably old stuff but to me it's new

mackrackit
- 20th June 2008, 01:59
Yep, it is possible, The reason I pointed out the above links :)
If I remember correctly all three of the examples have a way to start and stop. They are basically running off an interrupt. Enable/ Disable ?

Write value to EEPROM at the same place the LCD is updated.

One of the pitfalls, maybe, you only have a certain amount of time between clock updates to work on something else. (look at Paul's example) Could maybe split routines up...Odd seconds do this...Even seconds do that...?

All kinds of possibilities.

karenhornby
- 20th June 2008, 02:12
I'm starting to like this idea :)
SO for IF I wanted to use this (Clicky) (http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=190) example
DO you reckon I could use that, but still have enough time to poll 4 1 wire devices and keep the clock running? All I need to do with the timer really is make it read from the eeprom on startup display the hours minutes and seconds on the lcd display, start counting then get on with the rest of the program with the timer counting in the background.
All I'd need to do with the timer is write to the eeprom anywhere upto every 10 seconds or so, that way if the program loses power at any time, then the current timer data will be in the eeprom, when it is powered up next it reads from the eeprom and carries on counting from where it left off
Hopefully that made sense as I'm pretty hopeless at expressing how I see things in my mind even though they make sense to me lol

mackrackit
- 20th June 2008, 03:04
As I mentioned before, I do not use one wire stuff so I do not know how long it takes. But I would think a 10 second resolution on the timer will buy you enough time.