Data Logger Project

Hi, I wish to do a data logger circuit which can measure voltage of a circuit every 5 minutes. The data (voltage and time) will be save in a SD card. When a pc sends a command character to the circuit, the circuit will send back whatever data stored in the circuit (in other words "download"). The communication part of the system and pc is through Radio Frequency.
I am using 2 arduino uno, 2 sets 433Mhz RF module and RTC3231. As a start, i am able to detect the voltage the circuit. Then, when pc sends a command character to the circuit, the circuit will send back the voltages stored.
Now, i am facing problem when combining the RTC3231. I cannot get the time data when combining with the interrupt process.
My idea is:
ISR-> Read voltage and time, then store into SD card. (Every 5min)
Main Loop -> Waiting to receive command.
I am new to arduino. Can i get some advise in order to proceed? Please correct me if i'm wrong. Thank you.

You mentioned using an ISR to take the reading and store it.

Using interrupts in your code introduces considerable design complexity and should only be done when necessary. It's certainly not necessary in this case.

All you need to do is write a sketch that does nothing until it is time to take a sample, then writes the sample to the file together with the current time. I'd suggest writing it to the file in the same format you need to supply it during the download, and if that's under your control then use an ASCII textual format such as CSV.

Thanks for the suggestion. By the way, i am just able to transmit data using VirtualWire.h library. The constraint is to convert whatever data type into char* form. May i know is there any way to transmit CSV file through RF module?

The file content is just a sequence of bytes, and you can simply read them from the file into a buffer (char array) and transmit them over the wire from the buffer.

Is the remote sensor (IE not the PC) battery based? Do you have power considerations? If you don't, it should be pretty easy for it to not do anything for 5 minutes then make the measurement.

CSVs are text documents, which is a series of characters, with many commas involved. That being said, if you can only transmit characters and character arrays (AKA char *) which are basically strings without the end character, then you are probably okay. It might just take a little while to transmit depending on the baud rate of your wireless and size of the file.

Oh one other note is the question of the required accuracy of the timer. Depending on the crystal, maintaining an actually accurate time with a high speed crystal can be difficult, as it always has some error. However, this error can be something along the lines of being roughly 1 second off every 6 hours. If this is acceptable to you, then there is no need to worry, but it is something to consider.

PeterH:
The file content is just a sequence of bytes, and you can simply read them from the file into a buffer (char array) and transmit them over the wire from the buffer.

Thanks for your ideas and i will try out that later on. :smiley:

mirith:
Is the remote sensor (IE not the PC) battery based? Do you have power considerations? If you don't, it should be pretty easy for it to not do anything for 5 minutes then make the measurement.

First of all, thanks for the explanation regarding RTC. My circuit is battery based and for current state, i don't have any power consideration. I am trying to receive a character from pc and then the circuit will transmit all the data to the pc (2 way communication). Thus, i have to to standby the circuit for receiving in the main loop. Does my idea make sense? Please correct my mistake. Thank you.