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-13 4:53 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 1:40 AM
Hello,
You need to check first: is there a conflict in the software and in the hardware when the Lora Stack and the DHT22 management are combined?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 1:42 AM
Hi, that's right, there's a conflict when I combine the two. Each one works correctly separately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 1:44 AM
Welcome to the forum.
"Don't work" really tells us nothing:
- Do you get wrong readings?
- Do you get no readings?
- Do you get correct readings on the device, but wrong data over LoRaWAN?
- Does it burst into flames?
Think about:
- What have you tried?
- What, exactly, were you expecting to happen?
- What, exactly, is actually happening?
- What investigation/testing/debugging have you done to find out why they differ?
See: How to write your question to maximize your chances to find a solution.
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 1:46 AM
You need to debug it. That's not obvious for us to tell what happens in your application.
1- So check you schematics.
2- Check the part of code especially the hardware init.
Possible idea to change the DHT22 GPIO pin.
It could be something related to the resources shared between the stack and DHT22 management: systick? timer? ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 1:49 AM
Hi, I'm using the LoraWAN End Node example and I'm able to send data via LoraWAN without any issues. Now I'm trying to add a DHT22 sensor to the stack. If I comment out the MX_LoraWAN_process line in the main file and work solely with the main.c file, I'm able to read data from the DHT22 probe. 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. I don't know if it's because a peripheral needs to be started or if it's due to timer issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 1:54 AM
@dvid wrote:
I don't know if it's because a peripheral needs to be started or if it's due to timer issues.
Need to know what HW resources DHT22 is using (GPIOs, timers etc ..). This is your starting point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-03-14 1:54 AM
@dvid wrote:Hi, that's right, there's a conflict when I combine the two. Each one works correctly separately.
So dig into that!
Look at what differs between the "working" and "not working" cases.
Instrument your code to see what's going on.
Again, just saying "it doesn't work" gets you nowhere - you need to dig in and find what, exactly, is not performing as required, and why that is happening.
Debugging is a key skill in development. here are some debugging tips:
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 1:57 AM
@dvid wrote:I don't know if it's because a peripheral needs to be started or if it's due to timer issues.
So dig into that, then!
nobody else has any knowledge of your system - let alone any access to to it - so nobody else can do that for you.
A complex system designed from scratch never works and cannot be patched up to make it work.
