sharkduino / Arduino_Animal_Tag

The main code that runs on the Sharkduinos
0 stars 0 forks source link

recored if tag stops recoding due to no sd or dead battery #10

Open WLaney opened 8 years ago

WLaney commented 8 years ago

I don't know if this is possible and I don't any good ideas on how to do this. Keep in mind that both of these could happen, and we want to know which one happened first. Is is possible to write that the sd is not available to system memory in a way we can easily access once power is restored to the tag?

TheBen27 commented 8 years ago

The "System memory" you're thinking of is EEPROM, and it's perfectly suited to this task. I don't know how to detect when we're almost out of power, but the pseudocode for the SD stuff is something like this:

On update: Do short-term reads until buffer full If SD card accessible: Long-term SD writes else: Save "we can't access the SD" to EEPROM If the RTC is accessible, save the current time in EEPROM

We can then write diagnostic code (either a separate sketch or the main code) that reports these errors to the user. I'll get on that at some point in the future...

Is there a hardware method for determining how much battery we have left?

On Aug 2, 2016 3:50 PM, "William Laney" notifications@github.com wrote:

I don't know if this is possible and I don't any good ideas on how to do this. Keep in mind that both of these could happen, and we want to know which one happened first. Is is possible to write that the sd is not available to system memory in a way we can easily access once power is restored to the tag?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/WLaney/Arduino_Animal_Tag/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AI_0JV4HtTy8I7fnYgGAuZ5ic3ZjUKxqks5qb5-LgaJpZM4Ja-2t .

WLaney commented 8 years ago

For the battery level we could try to do something with measuring the battery voltage relative to the system voltage and determining the battery percentage from that. The problem is we can't do that with the battery just connected to GND and RAW, we need to connect to an analogue pin. I can do some tests when I am back at WM and make sure it would work though.

Alternatively there have only been two ways that the system has failed that give us data, but not as much as expected. We could just recored the SD status and make the assumption that if it's not the SD it's the battery. I think that's fairly safe.

TheBen27 commented 8 years ago

Mm. And we could get the time from the file in the case of power loss... makes sense.

On Aug 2, 2016 6:12 PM, "William Laney" notifications@github.com wrote:

For the battery level we could try to do something with measuring the battery voltage relative to the system voltage and determining the battery percentage from that. The problem is we can't do that with the battery just connected to GND and RAW, we need to connect to an analogue pin. I can do some tests when I am back at WM and make sure it would work though.

Alternatively there have only been two ways that the system has failed that give us data, but not as much as expected. We could just recored the SD status and make the assumption that if it's not the SD it's the battery. I think that's fairly safe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WLaney/Arduino_Animal_Tag/issues/10#issuecomment-237062155, or mute the thread https://github.com/notifications/unsubscribe-auth/AI_0Jb7-A-kblExcHJtFyWqzdBRPISuYks5qb8DfgaJpZM4Ja-2t .