Skip to main content
Associate
March 14, 2025
Question

DHT22 Sensor with LoraWan stack

  • March 14, 2025
  • 4 replies
  • 1978 views

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.

4 replies

dvidAuthor
Associate
March 13, 2025

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.

mƎALLEm
Technical Moderator
March 14, 2025

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?

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
dvidAuthor
Associate
March 14, 2025

Hi, that's right, there's a conflict when I combine the two. Each one works correctly separately.

mƎALLEm
Technical Moderator
March 14, 2025

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? ...

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
Andrew Neil
Super User
March 14, 2025

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 that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
dvidAuthor
Associate
March 14, 2025

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.

mƎALLEm
Technical Moderator
March 14, 2025

@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.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."