Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHTC3 digital humidity sensor #5092

Open
ilsicca opened this issue Jul 29, 2024 · 19 comments · May be fixed by #5114
Open

SHTC3 digital humidity sensor #5092

ilsicca opened this issue Jul 29, 2024 · 19 comments · May be fixed by #5114

Comments

@ilsicca
Copy link

ilsicca commented Jul 29, 2024

Hi!
I need to add a SHTC3 I2C sensor on ESP32 C6. ESPEasy dont' have a plugin for this sensor.
DFRobot SHTC3 Sensor
How I can add it?

I2C address: 0x70
Board: FireBeetle 2 ESP32-C6
Build: ESP_Easy_mega_20240729_normal_ESP32c6_4M316k_LittleFS_CDC Jul 29 2024 with ENVIRONMENT SENSORS

@tonhuisman
Copy link
Contributor

tonhuisman commented Jul 30, 2024

It might work with the SHT40 plugin we already have (P153) but it will require you to create a Custom build using VSCode as the development tooling, as we don't have a Climate or Collection F build for the ESP32-C6 available.

Edit: Ah, I missed the differences in I2C addresses, so that's not going to work (or you could temporarily change that in the code...)

@uzi18
Copy link
Contributor

uzi18 commented Jul 30, 2024

i2c address is different, commands are not bytes but words :
https://github.com/cdjq/DFRobot_SHTC3/blob/master/DFRobot_SHTC3.h
https://github.com/cdjq/DFRobot_SHTC3/blob/master/DFRobot_SHTC3.cpp

@tonhuisman
Copy link
Contributor

tonhuisman commented Jul 30, 2024

I've reserved Plugin ID P173 for this plugin.
Probably won't need the library, as it's quite straightforward and can use already available I2C and CRC functions, provided in ESPEasy core.

@ilsicca
Copy link
Author

ilsicca commented Aug 1, 2024

@tonhuisman tranks!

@ilsicca ilsicca closed this as completed Aug 1, 2024
@tonhuisman
Copy link
Contributor

Well, it still has to be implemented, usually we keep issues open and close them automatically when the feature/fix is merged, so you will be notified 😸

@TD-er TD-er reopened this Aug 2, 2024
@tonhuisman tonhuisman linked a pull request Aug 27, 2024 that will close this issue
2 tasks
@tonhuisman
Copy link
Contributor

@ilsicca I've created a PR to support this SHTC3 sensor, are you available to test?

Builds are available from this GH Actions run

@ilsicca
Copy link
Author

ilsicca commented Aug 27, 2024 via email

@ilsicca
Copy link
Author

ilsicca commented Aug 27, 2024

@tonhuisman , Can you add P173 in a ESP_Easy_mega_20240827_normal_ESP32c6_4M_316k_LittleFS_CDC_ETH.factory.bin release? because I'm using a FireBeetle 2 ESP32-C6 and it has only 4MB.
Thanks!

@tonhuisman
Copy link
Contributor

tonhuisman commented Aug 28, 2024

Changing the NORMAL build configuration isn't in the plans, but the next best thing is a Custom build with this plugin included.

Edit: Updated with I2C scanner to recognize the sensor-address.
ESP_Easy_mega_20240828_custom_ESP32c6_4M316k_LittleFS_CDC_ETH-1.zip
(Both the OTA-update .bin and the .factory.bin file are included, .zip file renamed)

If there is anything from NORMAL that you need but is not in this build, please reply, and I'll add it.

@ilsicca
Copy link
Author

ilsicca commented Aug 29, 2024

@tonhuisman perfect!!
I2C Scanner --> OK 0x70
image
Temperature and Humidity values --> OK
image

@tonhuisman
Copy link
Contributor

@ilsicca I've added the documentation for the plugin, and also added it to the default Custom build for ESP32-C6, so you can download the latest once this GH Actions run is completed.

@ilsicca
Copy link
Author

ilsicca commented Aug 30, 2024

Hi @tonhuisman , I did other tests and when I unpluged the power supply of FireBeetle 2 ESP32-C6 and plug again (not reboot), the device set disabled automatically. When I reboot manually or web IU, this issue not present. Only when unpluged the power supply.
image

When I enabled, work fine.

@tonhuisman
Copy link
Contributor

tonhuisman commented Aug 30, 2024

There are 2 possible causes here:

  • The plugin doesn't respond immediately after power-on to the I2C check, done by ESPEasy for (nearly) all I2C plugins when starting the plugin
  • The plugin doesn't reply with the correct Device ID during initialization of the plugin, as that's checked by the code.

The first cause can be verified by disabling the Tools/Advanced setting Check I2C devices when enabled, and replaying your scenario.
The second cause is not much I can do about, I think, adding delays 'somewhere' doesn't seem like a solid solution.

@ilsicca Can you try by un-checking that setting and replay your scenario? (The initial I2C check can also be disabled on a per-plugin basis, but that's a code-change)

@ilsicca
Copy link
Author

ilsicca commented Aug 30, 2024

@tonhuisman I disabled the option: Check I2C devices when enabled but the problem continue.
image

@TD-er
Copy link
Member

TD-er commented Aug 30, 2024

How do you enable the task?
If you just enable it using the command taskenable, then the settings are not saved with this checkbox set to enabled.
So after a reboot the settings you load from flash then still have this task set to disabled.

If you change it via the task settings page and then 'submit', then it will be saved (or giving the command save will also save anything changed in memory)

@tonhuisman
Copy link
Contributor

@ilsicca Any update on this?

@ilsicca
Copy link
Author

ilsicca commented Sep 7, 2024

@tonhuisman This is my task configuration for the sensor, I enable it with task settings:
image
I disable the option: "Check I2C devices when enabled" but the problem continue.
I enable the option: "Check I2C devices when enabled" but the problem continue.

@tonhuisman
Copy link
Contributor

tonhuisman commented Sep 7, 2024

I received a SHTC3 this week, and wired it to an ESP32-C6 (4MB), installed a fresh Custom build of this PR (only difference it that it's using a somewhat newer version of the platform), and tested your scenario: SDA on GPIO19, SCL on GPIO20, default sensor pull-up resistors (10k), enabled task, Interval 5 sec, I2C device-check enabled (Tools/Advanced), let it run for some time (~10 minutes), unplug the ESP, wait a few seconds, re-plug the ESP, and watch the logging. It's starting just fine, right at boot, and keeps running fine, so far, even after multiple power off/on tests.

This is my setup (sensor-cable is ca. 1 m):
C6-Custom-SHTc3 002

I assume you're running your sensor from 3.3V and not 5V? AFAICS, it's not really 5V tolerant (data sheet: VDD max 4.0V), and the GPIO pins of the ESP also don't work well/long when being pulled to 5V.

The actual build I'm running is this one:
ESP_Easy_mega_20240907_custom_ESP32c6_4M316k_LittleFS_CDC_ETH.zip

can you please verify if this makes any difference?

Edit/update:
After running for over 75 minutes, I left the ESP disconnected for more than 5 minutes, then reconnected. Still started the sensor as intended. NB: I'm running the default I2C clock of 400 kHz.
You may have received a (somewhat) broken sensor, maybe test with another? And also check the wiring, poor connections/wires can cause issues like you are experiencing.

@ilsicca
Copy link
Author

ilsicca commented Sep 18, 2024

hi @tonhuisman I tried with your build and it works fine!! Thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants