DHT22 Sensor with LoraWan stack
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 1:37 AM
Hi, I'm trying to implement a DHT22 humidity/temperature sensor in the Lorawan stack. The stack works fine, as does the sensor, but separately. When I try to combine them so that each time I send the data, the sensor reads it, they don't work.
- Labels:
-
STM32WL series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 4:07 AM
Hi, before posting, I tried to investigate where the problem might be. Writing here is my last resort after searching for information for days... I'm at a dead end.
I attach my main.c with the sensor working in case it could be of help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 4:21 AM
@dvid wrote:Hi, before posting, I tried to investigate where the problem might be
Remember - we don't know that!
So tell us what you did.
What did you find?
Again:
- Are you getting nothing at all from the sensor?
- Are you getting something - but not the right thing?
- Are you getting the right thing - but it's not getting through to LoRa?
- etc, etc, ...
Do you have teachers/supervisors/colleagues locally to help you?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 4:24 AM
- Im getting the right thing - but it's not getting through to LoRa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 4:37 AM - edited ‎2025-03-14 5:04 AM
@dvid wrote:
- Im getting the right thing - but it's not getting through to LoRa
This is a very basic information. You need to set breakpoints, check the variables content.. compare NOT working to the working scenario. As said before you need to debug that yourself as you have a very specific case. Check your software/HW conflitcs.
Did you develop your DHT22 lib yourself? or you fond it on the internet and integrate it without any content analysis?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 4:46 AM
@dvid wrote:
- Im getting the right thing - but it's not getting through to LoRa
OK - so that's a start.
But it does contradict what you said earlier:
@dvid wrote:However, when I try to pass that programming to the Lora_app.c file to read the sensor solely from the send_data function, the sensor doesn't respond.
So you are now certain that the sensor read is working, and you are getting correct data into your code - yes?
So you need to investigate why it's "not getting through to LoRa".
- Have you tried stepping in the debugger, comparing the working & non-working cases?
- Have you added diagnostic printfs (or similar) so that you can see what's happening in real time ?
And compare the working & non-working cases
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 4:51 AM
@dvid wrote:read the sensor solely from the send_data function
That's probably not a good idea.
It's generally better to keep things isolated - keeping low coupling.
So keep you sensor reading separate for the LoRa sending.
Have your sensor code read into a variable, or "buffer" - and your LoRa code read from that buffer.
A complex system designed from scratch never works and cannot be patched up to make it work.

- « Previous
-
- 1
- 2
- Next »