Adding on a DHT11

Morning All.
I am just dipping my toes into the TTN world and so far have put together an arduino uno with a Lora shield to send packets to a local gateway. That appears to work fine, now moving on I wish to add a DHT11 sensor, can anyone recommend the best way to do this and where to look for relevant information. Thanks.

That depends. To be able to advise you we need some relevant information first. What lora shield are you using? Which LoRaWAN stack are you using? What does your sketch look like?


  • Find a library for the sensor (google should provide plenty of examples) and start with an example sketch for the sensor to check it works as expected.
  • Go to your TTN sketch, add the library and add any initialization code to the appropriate part of the sketch. The example should provide what is required. Add code to the loop to read the DHT11 values and encode them in bytes (don’t send ASCII) for transmission. Transmit and wait some time. Please keep the fair access policy (max 30 seconds airtime and 10 downlinks) in mind. Even when developing.

As I stated, generic because details depend on what hardware and software you are using…

You may find as you start adding the sensor and making the LoRaWAN functionality more robust that your run out of space in the Uno.

While there are ways to make things fit, if you run into difficulty the more future-proof path will be to upgrade the “Arduino” to something more capable (even remaining in that ecosystem) rather than desperately try to shoe-horn things into an undersized chip - eg the “feather” board is one of the better supported targets to which you could wire your existing radio shield.

But if you’re not already too close to the limits, then with care you can probably get the DHT11 added, so that’s more a thought for subsequent work.

To go further, given the nature of the Arduino LMIC stacks, you don’t need to transmit, just send your. payload to the serial port for inspection - then you can take the output to the Application console to test your decoder (in the first instance, don’t rely on it mid to long term).

Sure, once you have a stable payload, turn on transmissions, but if you are cycling through design by coding :face_vomiting: then this is actually more efficient than a transmission and bouncing around different web pages.


Jumping to conclusions?

There are other LoRaWAN boards for Arduino with ‘smart’ modules like the RN2483 available. That is why I asked which hardware is being used.

But my suggestion / strategy still stands!

Hi All,
Thanks for the input.
The Lora shield is a Draguino V1.4 (non GPS) with a LMIC stack.
I have ordered a new DHT22 because I am not sure of the compatability of my original RHT03 sensor . I will report any finding in a few days.


I have also used the DHT11 on Arduino, with mixed results. However, to help you, adafruit have done a library that you can use.

Hope this helps.

Afternoon All,
OK, My DHT22 sensor arrived so now I am equipped with an Arduino UNO, with a Seeed Dragino V1.4 Lora shield with the DHT22 connected ( all presently connected)

So far I have uploaded a DHT22 sketch to the above and when viewing the serial monitor within the IDE I do see the temperature and humidity being displayed ( so far so good)

Next , I take the Node sketch from here

This is supposed to display “Hello World” as you can see in the sketch.
But what I see in my serial monitor window is …
Packet queued
31284432: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
142864: EV_TXCOMPLETE (includes waiting for RX windows)

Where is my "Hello World " ?
Once I have that figured out I want to see that “Payload” displayed on the TTN .
Hope someone can shed some light on this part before I move onto the subject of payload decoders , then advance to sending the DHT22 data as a payload.

Thanks for any help.

"Where is my “Hello World " ?”

I am not even sure what you are asking, the device log says its has sent a msg and that the next one is queued - have you not looked in the console for the data arriving? at no point in your code does it print you data to the log so it will never show up there. Your sending a msg via lorawan and hoping a TTN gateway receives it, if t does you will see the data arrive in the TTN console under the app and the devices too.

As you say your not sending plain text, the idea is to encode your data/values/bits and send as bytes (smallest number possible) that are then decoded the TTN backed - plain text in not the approach here. There are loads of threads on there re data encoding.

Have you set up both and application and device in the TTN console? I am thinking yes, just noticed the device is ABP, look at the console for data arriving.

Also you shared you keys etc, not advised.

Thanks for the reply,
Eventually my goal is send temperature and humidity data from my node to TTN.
In the Application Data tab in my Console I see Nothing ,
If I go to my devices I can see when the last packet was sent and Total packets TTN has recieved from this node .

It’s not meant to display Hello World in the serial console. It transmits a byte array that happens to say Hello World - so on the application/device console you should see the ASCII bytes that are Hello World.

Your next task is to put your readings in to the mydata array, which will then get transmitted and you can then see the hex/numbers on the console.

Hi Nick, thanks for the reply , and it does make sense to me.
I am not a programming guru and never will be. My electronics skills are fair to good but coding is something I am just venturing into. I will now look at getting the data into the array you mentioned. Once I see that data moving then it will be time to add the DHT22 sensor and delve deeper. Thanks again .
I did look in my console for application data and there is nothing there ?..

You need to use the get the ABP example working first so you know the radio & LoRaWAN elements are working - ie, you should see something in the application or device data tab.

Nick, Having read the sketch I used from the Dragino wiki there is a portion of text which reads:

This example sends a valid LoRaWAN packet with payload “Hello, world!”, using frequency and encryption settings matching those of the (early prototype version of) The Things Network

I am wondering if the encryption method of my node is still supported ?
Maybe that is the problem ?

If you’re saying that you did not change the values for NWKSKEY and APPSKEY (along with DEVADDR) then: indeed, that won’t work as those won’t match the values for your device in TTN Console. You’ll need to change 3 values in the code to match the values in TTN Console; see Format of Keys and ID's for Arduino LMIC library [HowTo].

Also, that old code is for EU868, but is missing the settings for RX2 to support downlinks, but you’re not using downlinks right now.

(Please see also How do I format my forum post? [HowTo] — your last post didn’t really invite people to pay any attention to it, I’d say.)

I’d suggest you use what @bluejedi calls the Classic LMIC, paying attention to setting the PIN numbers and you setting it up with YOUR keys / ids etc:

This works for me, and if you search the forum, other people as well. It has just been deprecated and I am going to test the other library shortly, but for now, this will suffice.

Your first goal is to get something on to the Application / Device console using ABP only.

It may be helpful to review the help docs:
The devices section of:
The gateways section of:
The network section of:
The applications and API sections of:

To flesh out your understanding of all the moving parts.

Thanks Guys,
That has given me something to work on,
I have changed my keys etc to match those on TTN for my device and looking at the device on TTN, I can see it is sending out a packet every minute along with how many packets since last reset.
I will look into it this evening , Thanks again.

Please reduce the frequency of transmissions or turn it off - you may well be breaching the fair use policy.

Now Looking for comfirmation that the Limic is configured correctly and operational…
Hi Folks, I have read more into the setup etc regarding previous posts,
Can someone confirm, that if the limic config file is set correctly, and within the Arduino sketch the the Device address along with the two passkeys (Network and App) which are (in my case ) MSB, which I understand to be correct when using a limic, and also making the observation on TTN that the Node/Device status shows the time of last packet received and a valid Frames up count.
Bearing all above , that I should be able to see something within the Aplication Data window for that device OR do I need to configure something within TTN to enable data to show in the Data window.
If anyone could confirm the above I would be gratefull.