Hello,
I have a pressure sensor DVLR-L60D with an arduino pro mini.
How do I time stamp the pressure sensor data. ?
Hello,
I have a pressure sensor DVLR-L60D with an arduino pro mini.
How do I time stamp the pressure sensor data. ?
With a clock.
If Arduino is connected to a PC, you can send the data to a proper terminal programme, like RealTerm, and record the PC clock time along with the data. If not, you get a realtime clock module and record the data and time to an on-board SD card.
You can also hook it up to a Real Time Clock like the DS1307.
Where are you saving the data that you want to add a timestamp? If you are saving to an SD card on the Arduino, then as others have noted, you need to add a RTC to your hardware (otherwise the Arduino has no idea what time it is). If you are saving to a web page or something like that with a MySQL database, then the php (or whatever you are using to process the passed information) can also add a timestamp to the data as it saves it. You could do it to an SD card for example without a RTC, but that would be simply saving the timestamp from millis from the last time the Arduino booted. That may work for some cases where you wanted relative time for pressure things, but didn't need to know the actual time. YMMV and you have to define what the requirements are for your project.
Hello,
I want to save the data on an SD card. I want to know when each reading from the pressure sensor is taken. Time of day is not important, but I want to know when each reading is taken in time so that I can integrate over time .
So the exact time can be either according to the clock (day/time) or with respect to the starting taking data for a session.
Can anyone explain how to do this?
Take a look at the millis() function. Use an unsigned long for the value from it. It rolls over every 48 days or so if I remember correctly but it does give you milliseconds from when the system started which is what I was talking about in #3 where it gives you a relative time but not time of day.
See this link for more information:
Millis explained
Hello,
I have gone through the link above. It says " the function returns the number of milliseconds since the program started".
I have one doubt regarding this. If there are multiple readings from the pressure sensor, will it be able to return the time each time a pressure is recorded and read by the Arduino.
Or will this return the time when the program first starts and then ends. (like the time of the first reading and the last reading).
Every time you call millis() you get a new bigger #, right up to when it reaches (2^32)-1 or 0xffffffff when it goes back to 0, after 49.71 days, and starts counting back up. You can do this: elapsedTime = currentTime - earlierTime and see much time has passed and decide if an action needs to be taken, or not if elapsedTime is not big enough yet.
the easy way is to get both an UNO and an SD shield with an SD slot and an on-board RTC and also some space to put your other electronical bits.
recently the DS3231 came out and it has temperature compensation on the chip so it is much more accurate than the old DS1307, but , the suppliers have not come out with a new shield with the better chip. it has an internal crystal so is easier to use and should have replaced the DS1307 on those shields.....
I will offer that if you run your program and re-set at any point, you have not logged data as to when that was.
if could be a thursday in September or a friday in June.....
with an RTC, you will get the date from the RTC in day/month/year/hour/minute/second ( you pick the format and order when saving data.
WARNING : STAY AWAY from this POC, I got a few and found they lost about a minute a day.

I have a pro mini 3.3 V and a SD breakout board at 5 V.
I started a new topic regarding this :