{"id":21009716,"url":"https://github.com/lily-osp/temperature-control-system","last_synced_at":"2026-05-14T23:06:59.533Z","repository":{"id":169781492,"uuid":"645839797","full_name":"lily-osp/temperature-control-system","owner":"lily-osp","description":"an Arduino sketch for a temperature control system using a thermistor. The code reads the temperature from two thermistors, calculates the average temperature, and adjusts a PWM (Pulse Width Modulation) output based on the desired temperature.","archived":false,"fork":false,"pushed_at":"2023-09-13T14:57:18.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-08T13:56:19.250Z","etag":null,"topics":["arduino","temperature-control","thermistor"],"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-05-26T14:56:16.000Z","updated_at":"2024-08-21T11:15:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"16ba87ad-1f53-4413-b282-bd3b4c63af81","html_url":"https://github.com/lily-osp/temperature-control-system","commit_stats":null,"previous_names":["1999azzar/temperature-control-system","lily-osp/temperature-control-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lily-osp/temperature-control-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Ftemperature-control-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Ftemperature-control-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Ftemperature-control-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Ftemperature-control-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lily-osp","download_url":"https://codeload.github.com/lily-osp/temperature-control-system/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Ftemperature-control-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33046786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":["arduino","temperature-control","thermistor"],"created_at":"2024-11-19T09:17:41.183Z","updated_at":"2026-05-14T23:06:59.518Z","avatar_url":"https://github.com/lily-osp.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Temperature Control System\n\n[![CodeFactor](https://www.codefactor.io/repository/github/1999azzar/temperature-control-system/badge)](https://www.codefactor.io/repository/github/1999azzar/temperature-control-system)\n\nThis code is an Arduino sketch for a temperature control system using a thermistor. It reads the temperature from two thermistors, calculates the average temperature, and adjusts a PWM (Pulse Width Modulation) output based on the desired temperature.\n\n## Requirements\n\nTo run this code, you will need:\n\n- Arduino board\n- Two thermistors\n- Resistors\n- Jumper wires\n- A PWM output device (e.g., fan, heater, LED)\n\n## Circuit Connections\n\nThe thermistors should be connected to analog input pins `A0` and `A1` on the Arduino board. The PWM output pin should be connected to pin `9`. Additionally, ensure that the required resistors are correctly connected.\n\n## Constants\n\nThe following constants are used for temperature calculation:\n\n- `thermistorNominal`: Nominal resistance of the thermistor at 25°C.\n- `temperatureNominal`: Nominal temperature for the thermistor.\n- `betaValue`: Beta value of the thermistor.\n- `desiredTemperature`: The desired temperature in Celsius.\n\n## Functions\n\nThe code contains the following functions:\n\n- `setup()`: Initializes the PWM pin and the Serial Monitor for debugging.\n- `loop()`: Continuously reads the temperature from both thermistors, calculates the average temperature, calculates the PWM ratio, sets the PWM output, and prints the temperature and PWM values to the Serial Monitor. It then waits for one second before taking the next reading.\n- `readTemperature(int pin)`: Reads the analog value from the specified thermistor pin, converts it to resistance, and calculates the temperature in Celsius using the Steinhart-Hart equation.\n\n## Flowchart \n\n```mermaid\ngraph TD\n    A[Start] --\u003e B[Setup]\n    B --\u003e C[Loop]\n    C --\u003e D[Read temperature from thermistors]\n    D --\u003e E[Calculate average temperature]\n    E --\u003e F[Calculate PWM ratio]\n    F --\u003e G[Calculate PWM value]\n    G --\u003e H[Set PWM output]\n    H --\u003e I[Print temperature and PWM values]\n    I --\u003e J[Delay]\n    J --\u003e C\n    C --\u003e K[End]\n\n    subgraph Functions\n        D --\u003e readTemperature\n    end\n```\n\n## Running the Code\n\n1. Connect the thermistors, resistors, and PWM output device according to the circuit connections mentioned above.\n2. Upload the code to your Arduino board.\n3. Open the Serial Monitor in the Arduino IDE (set the baud rate to `9600`) to view the temperature and PWM values.\n\n## Notes\n\n- The code uses the Steinhart-Hart equation to calculate the temperature from the thermistor resistance. Make sure the equation is appropriate for your specific thermistor.\n- Adjust the `thermistorNominal`, `temperatureNominal`, and `betaValue` constants according to the specifications of your thermistor.\n- Modify the `desiredTemperature` to set your desired temperature.\n- The PWM output pin should be connected to a compatible device capable of adjusting its output based on the PWM value (e.g., a fan, heater, or LED).\n\n## Troubleshooting\n\n- If you encounter any issues, ensure that the circuit connections are correct and the components are properly functioning.\n- Double-check the thermistor specifications and adjust the constants accordingly.\n\n## Contributing\n\nContributions to this repository are welcome. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.\n\n## Acknowledgments\n\nThis code was developed based on the requirements of the temperature control system using thermistors.\n\n## Disclaimer\n\nPlease note that this code is provided as-is and without any warranty. Use it at your own risk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Ftemperature-control-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flily-osp%2Ftemperature-control-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Ftemperature-control-system/lists"}