2026-05-05 11:17 AM - last edited on 2026-05-07 1:49 AM by Andrew Neil
Split from Sensor TileBox Pro - orientation of X,Y,Z axes ? - this is a new question.
Ok, so I will go with what I measured.
I have the output from MEMS Studio for temperature. It says the temperature is 32.18C, which is 0x0c90
There is no such hex value in the entire file and so I am wondering how mems studio got the value file attached
2026-05-06 7:54 PM - edited 2026-05-06 7:57 PM
private static int ReadTemperatureDataFiles(string[] files, double Delta, ref double Temperature, StreamWriter sw)
{
Console.WriteLine("\n\r Reading the Temperature data files from the ST Sensor Tile Box..." +
"\n\r\n\r Byte Offset Number Time Byte Value Temperature" +
"\n\r [16] Seconds [2] C \n\r");
byte[] fileBytes = File.ReadAllBytes(files[2]);
byte[] byteArray1A = new byte[16];
var len = (int)fileBytes.Length;
int num = fileBytes.Length / 16;
for (int it = 1; it < len; it += 16)
{
byte[] byteT = [fileBytes[it + 3], fileBytes[it + 4], fileBytes[it + 5], fileBytes[it + 6]]; // Example byte array
float resultT = BitConverter.ToSingle(byteT); // Converts 4 bytes starting at index 0
double timeValue = Convert.ToDouble(resultT); // Convert to seconds
}
return 0;
}A long time ago in another life, I once spent a week sorting out one line of AutoLISP Code. I can remember the joy at cracking the problem. AutoLISP made my team a lot of money.
This temperature dat problem from the Sensor TileBox Pro has been as hard. I finally cracked the problem when I was annoyed and playing with the Hex Editor and found that if I clicked on float the blasted answer of 32.18 appeared, three hours later I worked out how to code it in C#.
So someone else does not die on the cross of programming, here is the code.
I was missing Line 15, I had it as int with a value in the millions but not a single. Fortran is easier.
Anyway time for the end of the day.
(I just noticed the error and I will fix it tomorrow.)
2026-05-07 6:45 AM
Dear St
Now that I can read the data correctly,
private static double ReadTemperatureDataFiles(string[] files, double Delta, StreamWriter sw)
{
double timeValue = 0;
Console.WriteLine("\n\r Reading the Temperature data files from the ST Sensor Tile Box..." +
"\n\r\n\r Byte Offset Byte Value Temperature" +
"\n\r [16] [4] C \n\r");
byte[] fileBytes = File.ReadAllBytes(files[2]);
byte[] byteArray1A = new byte[16];
var len = (int)fileBytes.Length;
int num = fileBytes.Length / 16;
for (int it = 0; it < len; it += 16)
{
byte[] byteT = [fileBytes[it + 4], fileBytes[it + 5], fileBytes[it + 6], fileBytes[it + 7]]; // Example byte array
float resultT = BitConverter.ToSingle(byteT); // Converts 4 bytes starting at index 0
timeValue = Convert.ToDouble(resultT); // Convert to seconds
Console.WriteLine(" " + it.ToString("000") + " " + byteT[0].ToString("000") + " " + byteT[1].ToString("000") + " " + byteT[2].ToString("000") + " " + byteT[3].ToString("000") + " " + timeValue.ToString("0.00"));
}
return timeValue;
}Clearly the JSON file tells me what to do, but my education is clearly lacking in translating decimal to floats, I know I should have known that, the tyranny of knowledge is a bad thing.
It still does not tell my why a NIST calibrated unit is off by about 10 C.
I understand that I will not get an answer, but that is ok, I will get the other units one day and test them.
2026-05-15 12:35 AM
Hi @Smithson ,
I think he understood how to decode it now. The problem is that the temperature is different from what he expects because the device heats itself up.
2026-05-15 8:04 PM
Hello Federica:
I understand how to decode all of your data files from the Sensor Tile Box Pro. But the problem is the temperature may be because the device is heating up or it my be defective. My old physics professor would expect me to work out how to determine the correct temperature allowing for the instrument.
So why is the temperature important in structural engineering. If we have a block, this could be any block, so it could be from the Medici building, that Professor Benedetti asked for help on in Firenze. It was a temperature constant day in July, it was hot and the floors were X Hz and the walls Y Hz. Professor Benedetti, who is a great guy to work with and drink with expected those answers.
He wanted an instantaneous answer, the building was old and the decay rate was slow.
Your temperature gauge, so I take a brick a cheap brick that is poorly made from a hardware company, there are no hardware companies that I found in the old city in Bologna, but just off the side of the big square that is in front of the church is the absolute best cafe in the world. Across the square over the old Roman road is a good place to have dinner. So you put the brick in a controlled environment with no noise, reasonably constant temperature and little human traffic, I had the choice of a noisy lab or a study. Always pick the study. So this picture is a very bad FE model of the brick, but it is the start. The brick is held constant at the four corners of the red support material and the Sensor Tile Box Pro sits on the top of the overhang, you are looking at the bottom.
End of Chapter One.
2026-05-15 8:45 PM
Chapter 2
You start the CLI_EXAMPLE Program, which has been adjusted so it loops at 19.1 seconds, yielding two 16384 time signals with a throw away bit.
NB: If this was a mission critical use the throw away bit is not permitted, but it is a calibration and evaluation run.
So this is the modified first screen, it tells me all I need to know in a glance. I also removed about 200 redundant lines. I would upload it to github but that is beyond me limited skill set or I am too lazy. My friends would assume two.
I have limited the run time to 5000, which is about a day, it has been running since 2 Instant, so on three days it has finished, the rest of the runs threw an error in your locked DLL's. I would ask again for the DLL's but that is a waste of time.
Your data could be analyzed using MEMS Studio, and then you have to write a program to use the MEMs Studio out put, so it is simpler to use a C# Program and just tear your data files apart. I would much prefer to use the method for the earlier devices and just have one C# program that gets the data, throws up a thread and does the analysis. The only problem with this program from your early devices is that it will run unattended for a year, a NUC that the program is running on will not run unattended for a year.
The data files start to grow so the CSV and the data files after thirteen days are 195 GB from one device on one brick to calibrate the temperature.
The real core of the results are uploaded to a MySQL data base, it would be nice in the cloud as happens for all the other devices, but this one is just local.
One gets a line of data every 8 seconds or thereabouts.
So then you need a program to do multiple linear regression on the database, one uses the temperature and the frequency because for structures the frequency may or may not be temperature dependent and we are looking for changes in the frequency of 15 or so microHz per day.
Unfortunately most engineers think that that FFT is a fixed quantity, it is not, it is a statistical representation of the stiffness matrix, and like all statistical things you need enough data, which is not put the accelerometer on the bridge for a hour and report the results.
And the FFT contains a Gaussian data set and a non-Gaussian data set, and pulling them apart is interesting mathematics, but wait, the Sensor Box Tile has the flattest thermal response I have ever seen. It makes the G to NG search easier,
So you get the program called Harald, and you do a MLR. Here we need the temperature, accurate temperature.
End of Chapter Two
2026-05-15 9:10 PM
Chapter Three
So a single FFT
tells you nothing, from this select the two critical peaks.
If you add the peaks to a data base eventually you will get this, this shows 8192 frequency steps across about 977 Hz. From this one notices, that the usual structural frequency range of less than 50 Hz is pretty devoid and even. The minor blip at about 16 Hz is likely the slab vibration. The brick is above 200 Hz. We cate nothing for the slab, it is just a slab.
This is the XYZ axes, because an engineer will tell you from his limited education that the first mode is probably up and down and that is simply not true, it is true-ish but not true true.
Then you take the FE Model and match the frequencies, which is the large dotted lines. The match is pretty good.
But the FFT is highly scattered on the count. Is it a temperature variation or something else?
Actually it is both, so one needs accurate temperature. At the moment as I evaluate the devices, I am assuming that there is a constant added to the temperature.
End of Chapter Three
2026-05-15 10:11 PM
Chapter 4
So the end of the short story.
The final analysis looks at the change in frequency with time and temperature assuming, as we know it is, that it is linear or close enough. We have about ten years of continuous data from a superb machine, sadly not made by ST. Nor could I use an ST device as it is not evaluation.
So for 232.4 Hz average in the vertical direction looking at a band width of 1 Hz, the loss rate is -11.5 milli Hz per day. Now the critical feature I have been watching for days is the t Stat essentially it has to be greater than abs(2), it had not been up until now, it was trending but not there. t Stat is the most important number in civil engineering.
The change in the brick properties is large from temperature but temp has a limited numerical range, so once one gets to about 90 days the time is always dominant, the brick is degrading quite quickly because it was poorly made and sold in mass. It might last 20 years if we are lucky. The math to do that analysis is much more challenging and interesting. And not something we share.
An acceptable number below 30 Hz is 15 micro Hz per day, there is a thousand fold difference.
There are 111 bricks per cubic meter at 3 USD each so 333 USD per cubic meter, wet concrete at normal strength is 200 USD per cubic metre, so to make money we take out the cement. The poor buying public have no idea it looks good and we are a throw away society,
So Federica the temperature is important and I still have to check that the device is accurate even if it has an offset.
Warm regards
John
PS Bologna is the best city in the world and the University is good. Aside from the 1930's buildings.
2026-05-15 10:15 PM
I wrote this for HUANG2, who has steep learning curve if this kind person who created a great little device has not done this before.
I need the closed C DLL's so I can fix your program.