SHT31 humidity read test not functioning

Use this section to discuss your embedded Flowcode projects.
Post Reply
canary_wharfe
Posts: 78
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

SHT31 humidity read test not functioning

Post by canary_wharfe »

Well I suppose I have missed something from my test flowchart that is preventing the SHT31 sensor component displaying correctly under simulation. I thought being a true 12C component this would be easy to get functioning but the simulation is showing all zeros. Can someone pls put me right. I am reading the humidity into a float, doing a float to string and then trying to print the string on the LCD. I have initialised the sensor and ensured that it is the correct default address and I'm using the C3, C4 I2C lines from the PIC for the data and the clock. Tried changing the baud rate but makes no difference.
Attachments
Test_SHT31sensor.fcfx
(9.53 KiB) Downloaded 72 times

stefan.erni
Valued Contributor
Posts: 757
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: SHT31 humidity read test not functioning

Post by stefan.erni »

Hi canary_wharfe


Try with a delay so the screen doesn't clear very fast

regards

Stefan

Add delay:
delay_2022-07-22_17-03-53.jpg
delay_2022-07-22_17-03-53.jpg (28.15 KiB) Viewed 2214 times

stefan.erni
Valued Contributor
Posts: 757
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: SHT31 humidity read test not functioning

Post by stefan.erni »

Hi canary_wharfe

Two more improvements. Put the init sensor before the while loop and use integer instead of float

regards

Stefan
mod version:
Test_SHT31sensor_mod.fcfx
(10.5 KiB) Downloaded 73 times

canary_wharfe
Posts: 78
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

Re: SHT31 humidity read test not functioning

Post by canary_wharfe »

Thanks Stefan
Quick question .... is the flowcode chart working for you then? You are using Flowcode 9 right? I'm using v8 and I can't get the LCD simulation to show the data from the sensor. If it's working for you then it looks like the sensor and/or the I2C code has been updated. It definitely doesn't work on v8. With your modification the LCD is showing 65530

Edit: Just tried on my v9 latest update and it does not work. Even more mystifying is why the LCD initialises by showing the digits 5530 on a clear screen macro command. This is definitely wrong somewhere. Can someone please load the flowchart and see what it is doing on the LCD sim display?

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 509 times
Been thanked: 472 times

Re: SHT31 humidity read test not functioning

Post by medelec35 »

Hello.
This is how I would use the sensor with FC8 and FC9
Attachments
Test_SHT31sensor FC8.fcfx
(10.6 KiB) Downloaded 70 times
Test_SHT31sensor FC9.fcfx
(11.04 KiB) Downloaded 74 times
Martin

canary_wharfe
Posts: 78
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

Re: SHT31 humidity read test not functioning

Post by canary_wharfe »

Hi Martin
Thanks for the assistance. I confirm the flowcode is putting out values on the LCD but can you please confirm from my attached screen shots if your system is giving the same values on the LCD relative to what is shown on the SHT31 component? The LCD output and values of the SHT31 are offset i.e they don't match on my system. To be specific the LCD is displaying correctly the value held in the float variable 'sense'. Somehow the value of the data coming from the sensor and being read into the variable 'sense' doesn't reflect what is being shown on the SHT31 component. Have also tried the flowcode on a PIC18 device and getting same results. Shouldn't the LCD match the values shown on the sensor? Perhaps the I2C and/or SHT31 have been updated and my system has missed the update? Would be grateful if you could confirm what you're getting on your simulated display.
Thanks in advance

EDIT:
Just substituted the SHT31 component with the 21 and the simulated LCD works perfectly so does that implies there's a problem with the SHT31 model?
Attachments
0 per cent humidity.png
0 per cent humidity.png (96.39 KiB) Viewed 2177 times
50 per cent humidity.png
50 per cent humidity.png (96.32 KiB) Viewed 2177 times
100 per cent humidity.png
100 per cent humidity.png (96.57 KiB) Viewed 2177 times

stefan.erni
Valued Contributor
Posts: 757
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: SHT31 humidity read test not functioning

Post by stefan.erni »

Hi canary_wharfe , Hi Martin

Martins FC9 program is working nice on my computer

I also have a sensor board here from DF robots with a SHT31. I can also do a few measurements on an ESP32 if that helps you

regards

Stefan

Working FC9 Programm:
SHT31_2022-07-26_7-44-56.jpg
SHT31_2022-07-26_7-44-56.jpg (36.75 KiB) Viewed 2133 times
But the another program (from you) has no display and an another SMT31 component.
problem_2022-07-26_7-36-49.jpg
problem_2022-07-26_7-36-49.jpg (60.07 KiB) Viewed 2133 times

stefan.erni
Valued Contributor
Posts: 757
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: SHT31 humidity read test not functioning

Post by stefan.erni »

and Martins FC8 program on FC9 is working but green.....
green_2022-07-26_8-00-46.jpg
green_2022-07-26_8-00-46.jpg (14.58 KiB) Viewed 2132 times

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 509 times
Been thanked: 472 times

Re: SHT31 humidity read test not functioning

Post by medelec35 »

Hello.
The simulation model is a few % out, but the hardware should work accurately.
If using the FC8 project on FC9 then you will need to resize the sensor, but the simulation and hardware % should be correct.
Thank you Stefan for your testing.
Martin

canary_wharfe
Posts: 78
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

Re: SHT31 humidity read test not functioning

Post by canary_wharfe »

Thank you very much Martin and Stefan for the hardware testing. Stefan if you could try the SHT31 on the ESP32 that would be helpful as I am thinking of moving my design from the PIC to an ESP32.

The simulation does work perfectly in Flowcode 9 here.

Thanks for the support.

Post Reply