ESP32 and LSM9DS1 not compiling

For general Flowcode discussion that does not belong in the other sections.
stefan.erni
Valued Contributor
Posts: 1025
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 194 times
Been thanked: 218 times

Re: ESP32 and LSM9DS1 not compiling

Post by stefan.erni »

Hi Ben

Perfect! it's working nice!

The data is from the Accelerometer und Gyro is now ok,

and the program can now dedect, if one or both sensor are connected and save one or both sensor data in a CSV File.

I will still try to read and write the registers but that will take a little more time.

I have noticed two small things, both little things don't bother me:

I think, the text is not correct anymore. The text should now be like this:
return >0 for success and 0 if the device is not responding correctly
2024-05-14_09-27-46.PNG
2024-05-14_09-27-46.PNG (30.14 KiB) Viewed 6025 times
and the channel 1 is not in the display,
but it works fine on channel1 without changing anything.

2024-05-14_08-33-38.PNG
2024-05-14_08-33-38.PNG (29.51 KiB) Viewed 6025 times

stefan.erni
Valued Contributor
Posts: 1025
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 194 times
Been thanked: 218 times

Re: ESP32 and LSM9DS1 not compiling

Post by stefan.erni »

Hi Ben

There is still a small problem on the component with the temperature reading.
The temperature is displayed from -20000 to -5000 but I suspect this has something to do with the the output of the sensor is 0 (typ) at 25 degrees Celsius. Do you have any idea how this works? maybe I can simply convert this, but what exactly does LSB/C mean?

2024-05-15_11-49-05.PNG
2024-05-15_11-49-05.PNG (34.36 KiB) Viewed 6015 times
2024-05-15_11-34-20.PNG
2024-05-15_11-34-20.PNG (111.16 KiB) Viewed 6015 times
2024-05-15_11-33-40.PNG
2024-05-15_11-33-40.PNG (93.45 KiB) Viewed 6015 times

stefan.erni
Valued Contributor
Posts: 1025
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 194 times
Been thanked: 218 times

Re: ESP32 and LSM9DS1 not compiling

Post by stefan.erni »

Hi to All

It's worse than I expected. It's a 11Bit value but out_temp_H register have 5 times Temp11.
is there a way to read the temperature? how can you convert it into degrees Celsius?

Steve-Matrix
Matrix Staff
Posts: 1509
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 211 times
Been thanked: 350 times

Re: ESP32 and LSM9DS1 not compiling

Post by Steve-Matrix »

I'm just going off the datasheet as I'm not familiar with the component or device, so this might be wrong.

LSB/C is the measure of temperature sensitivity. It is 16 least significant bits per degrees C. So 1 degree change with alter the value by 16 bits.

I don't think the 5 values for Temp11 make any problems. Here's the maths:
  • Maximum value of the registers will be 0x7FF = 2047. Divide this by 16 = 127.9. Add to 25 gives 152.9°C.
  • Minimum value of the registers will be 0xF800 = -2048. Divide by 16 = -128. Add to 25 gives -103°C.
  • A register value of 0x0000 is 0. Divide by 16 = 0. Add to 25 gives 25°C.
The divide by 16 is due to the sensitivity. The add 20 is because 0 equals 25°C.

[edit: I've corrected the offset value from 20 to 25]

Xbiotec
Posts: 216
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 35 times
Been thanked: 26 times

Re: ESP32 and LSM9DS1 not compiling

Post by Xbiotec »

Hi stephan,
The graph you show us are made with serial console or by excel?
Screenshot_20240606_055511_com.android.chrome.jpg
Screenshot_20240606_055511_com.android.chrome.jpg (84.45 KiB) Viewed 5706 times
Seb

stefan.erni
Valued Contributor
Posts: 1025
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 194 times
Been thanked: 218 times

Re: ESP32 and LSM9DS1 not compiling

Post by stefan.erni »

Hi Seb

The data is from an ESP32 send by bluetooth or USB, received as array, in the AppDeveloper. So the chart are from the AppDeveloper.
I have a demo for the chart and a practical addition for the charts.
With printscreen (macro) you can automatically save the chart (results) as .png files.
Start the app with F5.
If you want, switch on the printscreen macro and then view the .png file on your computer C:\All_export\.

regards

Stefan

AppDeveloper Program
2024-06-06_10-08-07.PNG
2024-06-06_10-08-07.PNG (141.16 KiB) Viewed 5696 times

stefan.erni
Valued Contributor
Posts: 1025
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 194 times
Been thanked: 218 times

Re: ESP32 and LSM9DS1 not compiling

Post by stefan.erni »

and the App....
Post_chart.fcsx
(30 KiB) Downloaded 353 times

stefan.erni
Valued Contributor
Posts: 1025
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 194 times
Been thanked: 218 times

Re: ESP32 and LSM9DS1 not compiling

Post by stefan.erni »

Hi Steve

Yes you are right, you have divid by 16 and add the temperatur value of 0x0000, for this IC it is 25 degrees.
I saved the temperature values in an Excel file. (Not calculated value)
However, the values were much higher as you wrote. So I used the DEZINHEX() function in Excel.
2024-06-06_14-26-09.PNG
2024-06-06_14-26-09.PNG (2.94 KiB) Viewed 5681 times
Result was suspected that Hbyte and Lbyte are swaped.
Excel:
2024-06-06_14-26-24.PNG
2024-06-06_14-26-24.PNG (8.46 KiB) Viewed 5681 times
So I also swap the Value from the temperatur and made a calculation.
For me it's practical if I use all values as signed integer.
For the temperature I calculate x100 and I have to divide it by 100 again later in excel, but in excel I have decimal numbers with decimal places.
2024-06-06_14-24-11.PNG
2024-06-06_14-24-11.PNG (24.78 KiB) Viewed 5681 times
For me, the only wish would be to swap Hbyte and Lbyte in the component for the temperature.
or you can leave it as it is

Excel with temperatur x 100, for the test heat up the LSM9DS1
2024-06-06_14-22-08.PNG
2024-06-06_14-22-08.PNG (40.63 KiB) Viewed 5681 times
swap is a macro from me:
swap.fcm
(1.22 KiB) Downloaded 374 times
2024-06-06_14-54-04.PNG
2024-06-06_14-54-04.PNG (26.49 KiB) Viewed 5681 times

Steve-Matrix
Matrix Staff
Posts: 1509
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 211 times
Been thanked: 350 times

Re: ESP32 and LSM9DS1 not compiling

Post by Steve-Matrix »

stefan.erni wrote:
Thu Jun 06, 2024 1:59 pm
Yes you are right, you have divid by 16 and add the temperatur value of 0x0000, for this IC it is 25 degrees.

Thanks, Stefan. I have corrected my post to use the offset 25.

And I will ask for the component to be fixed so that the return bytes are the correct way around.

medelec35
Matrix Staff
Posts: 1988
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 630 times
Been thanked: 660 times

Flowcode v10 Re: ESP32 and LSM9DS1 not compiling

Post by medelec35 »

hi Stefan
I hopefully have fixed the component for you.
To try the component.
Browse to this location using file explorer , it's hidden by default so just paste the link into your address bar.

Code: Select all

C:\ProgramData\MatrixTSL\FlowcodeV10\Components
Place the attached component.
If Flowcode is already open, then you will need to reload your project for the new component to work
If you run any component updates, then the component you added will be overwritten, so it will stop working again (unless the component update has been pushed).

Can you let me know if it now works, please?
Attachments
LSM9DS1_AccelGyroMagnet.fcpx
(8.6 KiB) Downloaded 388 times
Martin

Post Reply