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

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.

 


@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 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.
  • Im getting the right thing - but it's not getting through to LoRa

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

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

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