Events

30.01.2022: TTN Ubidots Integration

06.02.2022: Einfacher LC-Oszillator

Eletronik | Funk | Software

Der Technik-Blog

  • Social Media

    Werbung:


    New Posts


    The Tech-Blog

    LHT65 TTN V3 Webhook PHP Webapp

    LHT65 TTN V3 Webapp

    Alex @ AEQ-WEB

    This article is an update to the project From TTN to your own website, which was developed under TTN V2. With the new TTN Stack V3 the existing project is no longer compatible, because the JSON formatting has changed. In addition, with TTN V3 the layout of the console has changed a lot compared to Stack V2. For this reason, a new, completely updated article has been written.

    Why a webapp?

    Basically, a LoRaWAN network only takes care of the data transfer, but not the storage of this data. The user has to take care of storing the data himself and tell the LoRaWAN network an interface to which the data can be sent. For this purpose, there are many ready-made services, some of them free of charge, which store these data and display them graphically. Alternatively, you can send the data from TTN to your own web space using a webhook (formerly HTTP integration). The project presented on this page is a small PHP application that stores and displays the measurement data from the Dragino LHT65 in a small MySQL database. This is a working example project, which should be adapted to your own needs or further developed.

    Webserver/Webspace

    Everybody who owns a homepage already has a webspace. But there are also free webspace providers like bplaced.net. There are no special requirements for the webserver. Only the PHP script should have write permissions in the main directory, so that a logfile can be created. Additionally a database (ideally MySQL) is needed to store the data.

    Werbung:

    Configuration & Webapp Upload

    In the ZIP-Archive there are four files in total. First open the file [config.php] with a text editor and adjust the parameters for the database server. You get the access data as well as the server address from the respective provider. The configuration could look like this:

    Neuer Text

    After the login data has been modified, the file can be saved. The following files to be uploaded to the web space via an FTP-Client (for example FileZilla):

  • config.php
  • index.php
  • ttn.php

  • Afterwards the database template (sql_template.sql) must be imported at the database server. Usually this is done via phpMyAdmin. The access data is again obtained from the respective provider.

    Open the Webapp

    If the PHP files have been uploaded to the web space and the database server has been configured correctly, the following error message should appear when calling the URL:

    Werbung:

    Webhook Setup

    Webhooks (integrations) are HTTP/HTTPS interfaces between the LoRaWAN network or application and the Internet. To get the data from TTN to your own website, you have to set up a webhook with the URL to your webspace. In the Application under Integrations -> Webhooks -> Add Webhook a "Custom webhook" must be created. The following parameters must be specified:

  • Webhook ID (can be chosen freely)
  • Webhook format: JSON
  • Base URL (Url to your Webserver/Webspace)
  • Uplink message: /ttn.php

  • The following screenshot shows an example configuration:

    Use your webapp

    After successful setup, TTN automatically forwards new measurement data from the LHT65 to the webapp. If everything has been set up correctly, the measurement data can be viewed on the website just a few seconds after transmission:


    Info: This page was automatically translated and may contain errors
    122X122

    About the Author

    Alex, the founder of AEQ-WEB. He works for more of 10 years with different computers, microcontroller and semiconductors. In addition to hardware projects, he also develops websites, apps and software for computers.

    Top articles in this category:

    Vaisala RS41 Radiosonde Firmware Flash

    Radiosonde RS41 Firmware Flash

    • Video
    • DE/EN

    Every day hundreds of meteorological radiosondes fall from the sky. In this article we convert a radiosonde into a GPS tracker for APRS, RTTY & CW

    read more
    LoRaWAN GPS MAP Viewer AEQ-WEB

    LoRaWAN GPS Tracker Webapp

    • Video
    • DE/EN

    The last part of the LoRaWAN GPS Tracker is about forwarding data records from TTS to your own web server and visualizing it on a map.

    read more

    Social Media

    Werbung:


    New Posts