Adding timestamp to serial data coming in from arduino

Hey all, I’ve done a few TD projects so far but this is breaking my brain.

Outline - Making a temperature data logger for a diy project.
Sensors via onewire in arduino, outputting via serial, coming into TD (there will be around 10 temp sensors which output data. I’m more familiar with arduino than TD so have formatted my data at that stage, going with CSV this works quite well using a convert DAT into a table

Data example is like this.

'ROM =, 28 61 64 34 89 30 2A 3E,  Chip = DS18B20,  Data = ,1, 16 1 55 0 7F FF C 10 F , CRC=,F,  Temp= ,17.37, Celsius,63.28, Fahrenheit,'

Here’s where I’m stuck.
I’d like to timestamp the data as it comes in. then sort it into individual sensors by their ROM= data

I’ve made a table and have the time showing up using this code I found online and tweaked mod.time.strftime("%d/%m/%Y_%H%M_%S", mod.time.localtime()
but its not cooking unless i manually force it.

after that I need to work out how to split the data by sensor, but getting the data with timestamp is issue 1 which I need to solve.

Anyone able to advise a solution?

Cheers

Hi @Tomcoldkiwi,

The expression will only update when cooked as you have discovered, this can also lead to unwanted results where the time reevaluates at some point while it only should do so when the message is received.

The Serial DAT comes with a callback attached which would give you the opportunity to format the incoming data, calculating the time and output all of this to for example a FIFO DAT or Table DAT. Now the data is saved and can be sorted or further treated.

Hope this helps
cheers
Markus

That’s brilliant! I’ve just made a massive leap in my understanding of TD and am making progress!
I’m now imagining it will all be smooth sailing! (but realistic that it won’t)

Thanks Markus!

1 Like