{"id":20678334,"url":"https://github.com/codecentric/esp32-lora-temperature-sensor","last_synced_at":"2025-09-08T11:08:19.223Z","repository":{"id":49869306,"uuid":"374044152","full_name":"codecentric/esp32-lora-temperature-sensor","owner":"codecentric","description":"ESP32 based LoRa transmitter that uses a DHT22 sensor to measure temperature and transmit the measurement via LoRa.","archived":false,"fork":false,"pushed_at":"2021-06-09T13:09:37.000Z","size":643,"stargazers_count":9,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-09T17:05:47.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codecentric.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-05T06:59:56.000Z","updated_at":"2025-05-13T06:57:58.000Z","dependencies_parsed_at":"2022-09-17T15:01:29.840Z","dependency_job_id":null,"html_url":"https://github.com/codecentric/esp32-lora-temperature-sensor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codecentric/esp32-lora-temperature-sensor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Fesp32-lora-temperature-sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Fesp32-lora-temperature-sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Fesp32-lora-temperature-sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Fesp32-lora-temperature-sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecentric","download_url":"https://codeload.github.com/codecentric/esp32-lora-temperature-sensor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Fesp32-lora-temperature-sensor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274174271,"owners_count":25235203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T21:19:45.418Z","updated_at":"2025-09-08T11:08:19.164Z","avatar_url":"https://github.com/codecentric.png","language":"C++","readme":"= TTGO LoRa Temperature Sensor\n\nThis example uses a TTGO LoRa32 V1 board with a Semtech SX1276 LoRa transceiver\nand an onboard OLED display to demonstrate how to connect a DHT22 temperature\nand relative humidity sensor to a LoRaWAN network (The Things Network, for example).\n\nimage::./doc/setup_overview.jpg[Setup overwview]\n\n== Setup\n\n=== DHT22 and LoRa antenna\n\n* The signal pin of the DHT22 must be connect to pin 13. \n    This pin can be changed by adjusting the value of the macro `DHTPIN`.\n* The VDD pin of the DHT22 must be connected to 3.3V power supply (the pin named \"3.3\").\n* The GND pin of the DHT22 must be connected to the GND on the board.\n\nWARNING: Make sure that the LoRa antenna is connected to the board before powering it on.\nThe board can be damaged if the antenna is not connected when powered on!\n\n=== PlatformIO and Visual Studio Code\n\nThis project uses https://platformio.org/[PlatformIO] as development environment. It is available\nas a https://platformio.org/platformio-ide[extension for Visual Studio Code].\n\nOpen the project folder in Visual Studio Code with an activated PlatformIO extension\nand you should be able to build and flash the project onto a connected TTGO LoRa32 board.\n\n=== Configuration\n\nCopy the file `include/config_template.h` to `include/config.h`.\nAdjust the values for APPEUI, DEVEUI, and APPKEY according to the settings required for your \nLoRaWAN network (e.g. the values provided by The Things Network). Note that the order/endianess of the\nbytes is important (little and big endian).\n\n== Display\n\nThe display shows status information about the current state of the LoRa stack.\n\nOn the left, it shows the current state (transmitting, idling, ...) below the heading.\nBelow that, the current temperature and humidity are shown.\n\nOn the right, different statsu information about the current LoRa connection are shown. For details\nrefere to the following table.\n\n.Status information on display\n|====\n| T: | Temperature in degree Celsius\n| H: | Relative humidity in %\n| ADR | If on, the _adaptive data rate_ (ADR) is switched on, else off\n| DR | _Data rate_, between 0 (slowest, most reliable) and 6 (fastest, least reliable); valid for EU868\n| SF | _Spread factor_, between 7 (least spread, faster transmission) and 12 (widest spread, slower transmission)\n| BW | _Band width_ in kHz, either 125kHz or 250 kHz\n| TC | _Transmit counter_, number of messages transmitted\n| RC | _Receive counter_, number of messages received\n| R | _Received signal strength indicator_ (RSSI), indicates the signal strength of a received messages; the higher the better\n| S | _Signal to noise ratio_ (SNR) in dB, the higher the value, the better the signal can be differentiated from the noise\n\n|====\n\n== Integration with the Workshop Cloud Stack\n\nTo utilise/process the data the sensor sends we want to integrate it with processing chain of services. \nThe chain described here uses The Things Network (TTN) as a LoRa stack for managing the LoRaWAN devices and applications with an outgoing datastream via MQTT for the sensor data. A Node-RED instance, running in an AWS ECS cluster, is subscribing to this sensor data and forwarding it to an InfluxDB instance running in the same cluster for timeseries storage. The last step is visualizing the data, which is done by Grafana that fetches the from InfluxDB and allows you to build dynamic dashboards.\n\n=== TTN Setup\n\nThe APPEUI, DEVEUI and APPKEY used in the configuration of `include/config.h` can be accquired through creating a device in the Things Network console.\nTo create an The Things Network account for free you can click https://account.thethingsnetwork.org/register[here].\n\n=== MQTT Setup\n\nWe use the free tier of https://www.hivemq.com/mqtt-cloud-broker/[HiveMQ Cloud] for which you can register on their website.\n\n=== AWS ECS Setup\n\nThe AWS ECS cluster containing Node-RED, InfluxDB and Grafana is set up by the help of docker and a docker-compose.yml. For that Docker 19.03 or later is required.\n\nIMPORTANT: The resources created in this workshop use services/resources that produce costs in AWS!\n\nThe included docker-compose.yml in this repository describes all three services. To deploy those in a ECS cluster you need to have AWS credentials ready either as environment variables or an existing profile. The quickstart is described in the codeblock below:\n\n[source,text]\n----\ndocker compose context create ecs lpwan-workshop\ndocker compose context use lpwan-workshop\n\ndocker compose up\n----\n\nFirst we create a docker context that connects to AWS and offers special commands or translates docker-compose files for ECS. Next up you specify that you want to use this context and then can start the compose stack through docker-compose up. The deployment step takes some time sinc it creates multiple ressources in the background, like an Load Balancer, EFS volumes, the cluster, roles and security groups.\n\nNOTE: The initial deployment should have failed because of the Node-RED container failing to start since he can't find its config file in the associated EFS volume. This needs to be uploaded now\n\nTo upload config files to an EFS there are multiple ways to do that. One way would be to temporarily use AWS Transfer Family to create an SFTP endpoint for a specific EFS volume. How to upload the Node-RED config to an example Transfer endpoint is shown below.\n\nNOTE: In the docker-compose volume for Node-RED it is described that it should be accessed with UID/GID 0 aka the root user. Node-RED doesn't use the root user, so if you get permission errors you need to adjust the UID/GID to 1000 aka the Node-RED user.\n\n[source,text]\n----\n# Upload config file for Node-RED\nsftp -i rsa lpwan@s-bd4cb04f842b4370a.server.transfer.eu-west-1.amazonaws.com\n\n\u003e\u003e\u003e put resources/settings.js\n----\n\n==== Accessing the services\n\nInside `EC2 \u003e Load Balancer` you can find a load balancer that was created through the deployment which has an DNS name associated with it that can be used to access the services inside the cluster, e.g. `lpwan-loadb-zn25zuton15n-f9a5448cb4a021e3.elb.eu-west-1.amazonaws.com`\nBy appending the port of the corresponding service to the URL you can e.g. access Node-RED: `https://lpwan-loadb-zn25zuton15n-f9a5448cb4a021e3.elb.eu-west-1.amazonaws.com:1880/`\n\n.Service Credentials\n|====\n| **Service**  | **Username** | **Password**\n| node-red | admin | `lpwan-handson` (See below how to change the password)\n| influxdb | admin | `lpwan-handson` (Can be changed in `docker-compose.yml`)\n| grafana  | admin | `admin` (Needs to be changed on first login)\n\n|====\n\nThe password for Node-RED can be changed by executing the following commands in the directory of the project:\n\n[source,text]\n----\ndocker run --rm --name nodered -v $(pwd)/resources:/data -d nodered/node-red\ndocker exec -it nodered node_modules/node-red/bin/node-red-pi admin hash-pw\n----\n\n\n== Links\n\n* https://learn.adafruit.com/the-things-network-for-feather/arduino-setup[Tutorial by Adafruit]\n* https://randomnerdtutorials.com/ttgo-lora32-sx1276-arduino-ide/[Tutorial by randomnerdtutorials]\n\n* https://github.com/mcci-catena/arduino-lmic[Github repository Arduino LMIC]\n* https://github.com/mcci-catena/arduino-lmic/tree/master/doc[Documentation for Arduino LMIC (with LoRa general docs)]\n* https://docs.docker.com/cloud/ecs-integration/[Deploying Docker containers on ECS]\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecentric%2Fesp32-lora-temperature-sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecentric%2Fesp32-lora-temperature-sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecentric%2Fesp32-lora-temperature-sensor/lists"}