cancel
Showing results for 
Search instead for 
Did you mean: 

DHT22 Sensor with LoraWan stack

dvid
Associate II

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.

15 REPLIES 15
dvid
Associate II

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
ST Employee

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.
dvid
Associate II

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

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.

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.

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.


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

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

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/706966/highlight/true#M49

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.

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