Dragino LoRa gateway: connecting to ThingSpeak


In this blog post, I will make further progress with the Dragino LG01-S Lora Gateway and LoRa Shield, and I will show you the steps required to publish data on ThingSpeak.

Warning: Use of undefined constant ICL_LANGUAGE_CODE - assumed 'ICL_LANGUAGE_CODE' (this will throw an Error in a future version of PHP) in /home/teodorc8/public_html/wp-content/plugins/insert-php/includes/class.execute.snippet.php(456) : eval()'d code on line 19

Warning: Use of undefined constant ICL_LANGUAGE_CODE - assumed 'ICL_LANGUAGE_CODE' (this will throw an Error in a future version of PHP) in /home/teodorc8/public_html/wp-content/plugins/insert-php/includes/class.execute.snippet.php(456) : eval()'d code on line 22

Developed by Mathworks (best known as the creators of MATLAB®), ThingSpeak is “an Internet of Things (IoT) platform that lets you collect and store sensor data in the cloud and develop IoT applications.” A lot of IoT devices can push data to Thingspeak (including but not limited to Arduino, Raspberry Pi). The gathered data can be analyzed online, using MATLAB®.

Unfortunately, this doesn’t come free. There’s the option of a free account for testing and small non-commercial projects. A student license starts from 55 EUR. Home use licenses start from 75 EUR. Academic and commercial licenses are also available.

In this blog post, I will use a free license, as for the given moment I have no further plans to use ThingSpeak.

If you already own a MathWorks account, you can use it to connect also to ThingSpeak. Otherwise, create an account first.

Login to ThingSpeak

Login to ThingSpeak

Once you log in, you can check your account settings. Mine is a free account.

ThingSpeak account setings

ThingSpeak account settings

To publish data to ThingSpeak, one must create a channel. To do so, go to ChannelsMy channels and create a new channel.

The new channel is named Dragino_LoRa and has two fields, for temperature and humidity. I didn’t fill any additional data (position and such) as this is for testing purposes only. I’ve left the channel private, for the given moment.

Once the new channel is created, we have to look at the API keys:

ThingSpeak API settings

ThingSpeak API settings

Write down the Channel ID and the Write API Key. You will need it later when you configure the gateway.

1 2 3


  1. Avatar


    I think I’ve done exactly like what you did, uploaded the source code for both client and server without any problem. The DHT11 collected data just fine when I checked with the Serial Monitor, however I can’t get any data for my Thingspeak channel. Do you know where i might’ve done wrong? I’ve checked the API, etc.

    • Teodor


      Is your node permanently connected to the serial monitor? Otherwise it might just wait for serial to be availlable.

      • Avatar

        i’ve figured out that there are problem with transmitted data, it says “No reply, is rf95_server running?” . Any idea why is that?

        • Teodor


          it looks there’s no communication over the LoRa between the gateway and the node.

          I can try to replicate this issue Monday when I will be back to work.

          • Avatar

            Hi, I think one of the reason is because my global led isn’t lighting up. Do you have any idea why? I tried both DHCP and Static IP. No change.

          • Teodor


            I did check today, and my Dragino gateway is set up as follows:
            – Network – Internet access menu
            – Access Internet Via = WiFi Client
            – Way to Get IP = Static IP
            – WiFi settings to match my WiFi access point
            – IP, Gateway and Netmask set accordingly to my local network configuration
            – DNS is (Google’s DNS)

            Power led is ON (green), WiFi led is blinking (green). All other LEDs are off.

            If everything is set correctly you should be able to access the configuration interface of the Dragino gateway from any PC on your local network, by typing the IP address you have assigned in your web browser.

  2. Avatar

    I having problem, in thingspeak it just update temperature data(field1) only. But It not update the data of humadity(field2).

    Do you know where I might done wrong?

    Can u email to me ur coding for gateway : gercmonitoring@gmail.com

    • Avatar

      did you manage to figure the issue out? I am having same problem only 1 field is being updated in Thingspeak even though can see both readings in the serial console.

      • Teodor Costachioiu
        Teodor Costachioiu on


        For the given moment I have my Dragino gateway configured to work with The Things Network.

        I hope next week to have some time to reconfigure it for Thingspeak.

    • Teodor

      I tried it only with the example code, with temperature and humidity only. In the mean time I have got some other Arduino nodes and I have plans to make an air quality monitoring station.
      Unfortunately, that project has to wait until spring, now it’s too cold to work outside.

  3. Avatar
    Hayden Lewis on

    I have this up and running fine and the graphs are appearing in thingspeak with the temp and humidity. But the problem im having is that when I disconnect the uno with the lorar and dht11 and connect it to another power source other than my pc’s usb cable….the data only sends the same values of 20c and 40% humidity regardless how hot i try to make it. If i connect it back up to my pc on com7 and do the same thing….the data starts to reflect the extra heat as you would expect.
    Why does it not work when disconnected from the pc with arduino on it?? Im guess im missing something here? I thought the whole idea of the lora was to be able to communicate to the gateway from a remote lora client??

    • Teodor Costachioiu
      Teodor Costachioiu on

      Two ideas come into my mind:

      – Please comment out anything that deals with PC communication – Serial.begin(), Serial.print(), etc.
      – Use a good power supply. Put a 1000uF/16V capacitor between Vcc and GND pins.

    • Avatar

      I think that the problem is that when the node is disconnected the lora node continue sending the last detected value which is wrong, actually to fix that in a way that when the node is disconnected dont send wrong data i modified this part of the code :

  4. Avatar
    Muhammad Rakeh Saleem on

    I have this problem while uploading the blink code for dragino kit.

    processing.app.debug.runnerexception at cc.arduino.packages.uploaders.ssh uploader.uploadusingpreferences(sshuploader.java:145) at cc.arduino.uploaderutils.upload(uploaderutils.java:78) at processing.app.sketchcontroller.upload(sketchcontroller.java:732) at processing.app.sketchcontroller.exportapplet(sketchcontroller.java:703) at processing.app.editor$defaultexporthandler.run(editor.java:2030) at java.lang.thread.run(thread.java:748) caused by: com.jcraft.jsch.jschexception: java.net.connectexception: connection timed out: connect at com.jcraft.jsch.util.createsocket(util.java:389) at com.jcraft.jsch.session.connect(session.java:215) at cc.arduino.packages.uploaders.sshuploader.uploadusingpreferences(sshuploader.java:117)

    Please someone help me how to fix this issue. as i have been trying for the past 4 hours and nothing is working properly and everytime I upload it messed up.
    Nd now the IP is also not working. either config problm or some other ??
    Any help will be much appreciated

  5. Avatar
    Muhammad Rakeh Saleem on

    I think I have messed up with my wifi settings during the configuration of LS O1, and now I am not able to see the dragino wifi network in wifi search box. And cant connect to this dragino site to again re configure it, anyone here can help me how to solve this problem as It keep frustrated me for the past 6-7 hours. I have checkedd on the internet too but have no possible solution to cope with my problem.

    Anyone help me please. how to get back the wifi status and to configure properly the dragino device as wifi client.

    Thank you.

    • Teodor Costachioiu
      Teodor Costachioiu on


      It looks that you have a newer version of the library, where the API keys are missing. You can try to use

      Unfortunately, I have abandoned the LG01-S and the whole LoRa thing.

        • Teodor Costachioiu
          Teodor Costachioiu on

          I’m using now ESP8266 modules, with connection to my local WiFi network.
          The problem with LoRa is that there are too many perturbations in the 868MHz band in the area where I live, and I was never able to achieve a range of more than 60m. So, for the given moment, no more LoRa projects.