{"id":21009702,"url":"https://github.com/lily-osp/smart-sensor","last_synced_at":"2026-04-17T15:01:43.514Z","repository":{"id":112728813,"uuid":"606134135","full_name":"lily-osp/smart-sensor","owner":"lily-osp","description":"Read temp, humidity \u0026 light data. Easy WiFi config. MQTT integration. Monitor remotely","archived":false,"fork":false,"pushed_at":"2023-07-18T17:24:55.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-20T11:11:53.120Z","etag":null,"topics":["adafruit","automation","esp8266","iot","iot-platform"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lily-osp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-24T17:15:58.000Z","updated_at":"2024-08-21T11:00:33.000Z","dependencies_parsed_at":"2023-07-20T09:31:26.062Z","dependency_job_id":null,"html_url":"https://github.com/lily-osp/smart-sensor","commit_stats":null,"previous_names":["lily-osp/smart-sensor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fsmart-sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fsmart-sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fsmart-sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fsmart-sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lily-osp","download_url":"https://codeload.github.com/lily-osp/smart-sensor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243431443,"owners_count":20289892,"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","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":["adafruit","automation","esp8266","iot","iot-platform"],"created_at":"2024-11-19T09:17:38.944Z","updated_at":"2026-04-17T15:01:43.448Z","avatar_url":"https://github.com/lily-osp.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IoT Sensor Data Publisher with ESP8266\n\nThis project is an example of how to read temperature, humidity, and light intensity data from sensors using an ESP8266 microcontroller and publish the data to the Adafruit IO MQTT broker. The code is designed to be simple and straightforward, allowing you to quickly set up an IoT sensor data publishing system.\n\n## Dependencies\n\nMake sure to install the following libraries before using this code:\n\n- ESP8266WiFi.h\n- Adafruit_MQTT.h\n- Adafruit_MQTT_Client.h\n- DHT.h\n- WiFiClient.h\n- ESP8266WebServer.h\n\n## Configuration\n\nBefore using the code, update the following configuration parameters to match your setup:\n\n- `MQTT_SERVER:` The MQTT broker server (e.g., Adafruit IO MQTT broker).\n- `MQTT_PORT:` The MQTT broker port (usually 1883).\n- `MQTT_USERNAME:` Your Adafruit IO username.\n- `MQTT_KEY:` Your Adafruit IO secret key.\n- `TEMP_HUMIDITY_PIN:` The pin to which the temperature and humidity sensor is connected.\n- `LIGHT_INTENSITY_PIN:` The pin to which the light intensity sensor is connected.\n- `DHTTYPE:` The type of DHT sensor, which can be DHT11, DHT21, or DHT22.\n\n## Usage\n\n1. **Setup:**\n\n   - Modify the configuration parameters as explained above.\n   - Upload the code to your ESP8266 board using the Arduino IDE or any other compatible IDE.\n\n2. **Hardware Connections:**\n\n   - Connect the temperature, humidity, and light intensity sensors to the appropriate pins on the ESP8266 board.\n\n3. **Wi-Fi Configuration:**\n\n   - When the board starts up, it creates a Wi-Fi access point.\n   - Connect your smartphone or computer to the access point.\n   - Access the web server hosted on the board to enter your Wi-Fi network credentials `(on v2)`.\n   - This step allows the board to connect to your Wi-Fi network.\n\n4. **Start Publishing:**\n\n   - Once connected to Wi-Fi, the board will connect to the MQTT broker (Adafruit IO).\n   - The board will start publishing sensor data (temperature, humidity, and light intensity) every 10 seconds to the following MQTT topics:\n     - `your_username/feeds/temperature`\n     - `your_username/feeds/humidity`\n     - `your_username/feeds/light-intensity`\n\n5. **Data Visualization:**\n\n   - You can view the published data on the Adafruit IO dashboard or use it for other purposes.\n\n## flowchart\n\n```mermaid\nflowchart TD\n    start[Start] --\u003e setup[Setup]\n    setup --\u003e wifi[Wifi Configuration]\n    wifi --\u003e ap[Start Access Point]\n    ap --\u003e server[Start Web Server]\n    server --\u003e |HTTP GET| handleRoot[Handle Root Request]\n    server --\u003e |HTTP POST| handlePost[Handle Post Request]\n    handleRoot --\u003e |Display Form| html[WiFi Credentials Form]\n    handlePost --\u003e |Process Credentials| ssid[Credential: SSID]\n    handlePost --\u003e |Process Credentials| password[Credential: Password]\n    ssid --\u003e |Connect to WiFi| connect[Connect to WiFi]\n    connect --\u003e |Connected| mqtt[MQTT Connection]\n    mqtt --\u003e loop[Loop]\n    loop --\u003e readSensors[Read Sensors]\n    readSensors --\u003e temperature[Temperature Reading]\n    readSensors --\u003e humidity[Humidity Reading]\n    readSensors --\u003e lightIntensity[Light Intensity Reading]\n    temperature --\u003e publishTemp[Publish Temperature]\n    humidity --\u003e publishHumidity[Publish Humidity]\n    lightIntensity --\u003e publishLight[Publish Light Intensity]\n    publishTemp --\u003e printTemp[Print Temperature]\n    publishHumidity --\u003e printHumidity[Print Humidity]\n    publishLight --\u003e printLight[Print Light Intensity]\n    printTemp --\u003e A[End]\n    printHumidity --\u003e A\n    printLight --\u003e A\n    A --\u003e loop\n\nstyle start fill:#8BC34A,stroke:#4CAF50\nstyle A fill:#FF5722,stroke:#F44336\nstyle setup, wifi, ap, server, handleRoot, handlePost, mqtt, loop, readSensors, temperature, humidity, lightIntensity, publishTemp, publishHumidity, publishLight, printTemp, printHumidity, printLight, A stroke:#333,stroke-width:2px\n```\n\n## Note\n\n- Ensure that you have a stable internet connection and access to the Adafruit IO server for the MQTT communication to work properly.\n- Take precautions while handling electronic components and connections to avoid any damage to the hardware.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Fsmart-sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flily-osp%2Fsmart-sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Fsmart-sensor/lists"}