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

[Question]: Pico gpio/dht_sensor Example not working #439

Open
hasenradball opened this issue Nov 28, 2023 · 11 comments
Open

[Question]: Pico gpio/dht_sensor Example not working #439

hasenradball opened this issue Nov 28, 2023 · 11 comments
Assignees

Comments

@hasenradball
Copy link

Dear Pico Fellows,

the DHT Sensor example does not work.
I get always bad data.
It seems the code is written not robust enough, and also less comments.
Is it fine for you when I provide an improved code on basis on this:
AM2302-sensor

With this approach you will be also possible if the error is caused by a timeout or checksum_error.

@lurch
Copy link
Contributor

lurch commented Nov 29, 2023

It's possible that #423 (comment) also applies here?

@hasenradball
Copy link
Author

hasenradball commented Nov 29, 2023

@lurch thank for you comment.
I have additionally 2 questions (e.g.: for the dht example)

  1. I generally see no usage of classes lets say, all code parts mainly placed in main.c files
    For example providing an dht class via include, create an object and do it object orientated.
    Doe this not work with the pico c SDK?

  2. I saw it mainly in the code of dht -> function read_from_dht()

  • no line of comment in the whole file
    if this occurs and someone searches an error in it, it might be it results in an complete new code, instead of fix this.

No clue whats the intention of this part if you look in lines 67 ... 71.
Also no clue why the check if humidity > 100 and temperature >125 is there (lines 79 ... 87)?
If this occurs the data received is wrong.
The sensor will never send such values.
So if this happens it seems the data query procedure is wrong.

@peterharperuk
Copy link
Contributor

All the examples stick to C because that's just keeps things simple. Yes there seems to be a quite a few issues with this example. I doubt anyone has looked at it for some time. The points you raise are valid. Feel free to improve it and add some comments - or else I'll look at getting one of those sensors and doing it myself.

@peterharperuk peterharperuk self-assigned this Nov 29, 2023
@hasenradball
Copy link
Author

Hi @peterharperuk,

thanks for your feedback I started to have a look at it.
I currently reworked a DHT Class ( see here: AM2302-sensor )

So I know what happens and what should happen.
I will check, but having a reviewer and discussion partner would be great!
:-)

@hasenradball
Copy link
Author

@lurch @peterharperuk

I proposed a PR #440.
This code is adapted to the Pico c files and was mainly taken from here:
AM2302-sensor

@hasenradball
Copy link
Author

@peterharperuk
Hi Peter,
apologies for asking directly.
Do you have an hint for an example for an Pi PicoW how to send an http request?

I want just to send some data to an server.
Nothing complex.

@peterharperuk
Copy link
Contributor

I've used the lwip http client. There's an example here...

#385

I think this depends on the following PR's so it might not compile on its own...
#475
#460

(I will get around to merging your PR's soon)

@hasenradball
Copy link
Author

Thank for fast reply I will have an look on it.

Regarding the PR's,here some nice feedback for the DHT sensor lib which was the basis for the Pico Example update:
Just for you information:
hasenradball/AM2302-Sensor#10

@hasenradball
Copy link
Author

@peterharperuk
Hi Peter,

do you have some hint about my PRs, when to lokk at?
They are discussed a long time ago.

@hasenradball
Copy link
Author

@lurch @peterharperuk,

any interests to merge this?

@lurch
Copy link
Contributor

lurch commented Aug 26, 2024

We've been a bit busy with other things recently 😉

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

No branches or pull requests

3 participants