SHT31 humidity read test not functioning
-
- 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
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 75 times
-
- Valued Contributor
- Posts: 760
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
Re: SHT31 humidity read test not functioning
Hi canary_wharfe
Try with a delay so the screen doesn't clear very fast
regards
Stefan
Add delay:
Try with a delay so the screen doesn't clear very fast
regards
Stefan
Add delay:
-
- Valued Contributor
- Posts: 760
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
Re: SHT31 humidity read test not functioning
Hi canary_wharfe
Two more improvements. Put the init sensor before the while loop and use integer instead of float
regards
Stefan
mod version:
Two more improvements. Put the init sensor before the while loop and use integer instead of float
regards
Stefan
mod version:
-
- 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
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?
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?
-
- Matrix Staff
- Posts: 1463
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 514 times
- Been thanked: 473 times
Re: SHT31 humidity read test not functioning
Hello.
This is how I would use the sensor with FC8 and FC9
This is how I would use the sensor with FC8 and FC9
- Attachments
-
- Test_SHT31sensor FC8.fcfx
- (10.6 KiB) Downloaded 73 times
-
- Test_SHT31sensor FC9.fcfx
- (11.04 KiB) Downloaded 77 times
Martin
-
- 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
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?
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 (96.39 KiB) Viewed 2231 times
-
- 50 per cent humidity.png (96.32 KiB) Viewed 2231 times
-
- 100 per cent humidity.png (96.57 KiB) Viewed 2231 times
-
- Valued Contributor
- Posts: 760
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
Re: SHT31 humidity read test not functioning
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: But the another program (from you) has no display and an another SMT31 component.
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: But the another program (from you) has no display and an another SMT31 component.
-
- Valued Contributor
- Posts: 760
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
Re: SHT31 humidity read test not functioning
and Martins FC8 program on FC9 is working but green.....
-
- Matrix Staff
- Posts: 1463
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 514 times
- Been thanked: 473 times
Re: SHT31 humidity read test not functioning
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.
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
-
- 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
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.
The simulation does work perfectly in Flowcode 9 here.
Thanks for the support.