{"id":23094144,"url":"https://github.com/leivosepp/lesson-temperture-mpl115a2","last_synced_at":"2026-05-11T03:02:38.420Z","repository":{"id":132646867,"uuid":"80169008","full_name":"LeivoSepp/Lesson-Temperture-MPL115A2","owner":"LeivoSepp","description":"Raspberry PI and Windows 10 IoT Core. Using Adafruit digital I2C temperature sensor MPL115A2.","archived":false,"fork":false,"pushed_at":"2018-09-19T09:30:55.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T12:53:23.494Z","etag":null,"topics":["adafruit","barometer","mpl115a2","pressure","raspberry-pi","sensor","temperature","temperature-sensor","uwp","windows-10"],"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/LeivoSepp.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":"2017-01-27T00:25:05.000Z","updated_at":"2018-09-19T09:30:56.000Z","dependencies_parsed_at":"2023-06-09T00:45:31.958Z","dependency_job_id":null,"html_url":"https://github.com/LeivoSepp/Lesson-Temperture-MPL115A2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeivoSepp%2FLesson-Temperture-MPL115A2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeivoSepp%2FLesson-Temperture-MPL115A2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeivoSepp%2FLesson-Temperture-MPL115A2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeivoSepp%2FLesson-Temperture-MPL115A2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeivoSepp","download_url":"https://codeload.github.com/LeivoSepp/Lesson-Temperture-MPL115A2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247061882,"owners_count":20877176,"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","barometer","mpl115a2","pressure","raspberry-pi","sensor","temperature","temperature-sensor","uwp","windows-10"],"created_at":"2024-12-16T21:57:11.715Z","updated_at":"2026-05-11T03:02:33.375Z","avatar_url":"https://github.com/LeivoSepp.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Temperature and Pressure Sensor Adafruit MPL115A2\nThis project is an example on how to use the Adafruit MPL115A2 Barometric Pressure + Temperature Sensor in Raspberry PI and Windows 10 IoT Core.\n\n## What is this sensor?\nThis sensor is great for all sorts of weather/environmental sensing.\nThis pressure sensor is a great low-cost sensing solution for measuring barometric pressure with 1.5 hPa resolution.\n\nhttps://www.adafruit.com/products/992\n\n![image](https://cloud.githubusercontent.com/assets/13704023/22854130/d067997c-f06f-11e6-801f-9c36eb7833a7.png)\n\nTemperature is calculated in degrees C, you can convert this to F by using the classic F = C * 9/5 + 32 equation.\n\nPressure is returned in the SI units of Pascals. 100 Pascals = 1 hPa = 1 millibar.\nAs thi is not very precise sensor, it is not recommended to use for altimeter.\n\n## How to connect this sensor into Raspberry PI?\nTo connect this sensor to Raspberry PI you need 4 wires. Two of the wires used for voltage VDD (+3V from Raspberry) and ground GND and remaining two are used for data. \nAs this is digital sensor, it uses I2C protocol to communicate with the Raspberry. For I2C we need two wires, Data (SDA) and Clock (SCL).\nConnect sensor SDA and SCL pins accordingly to Raspberry SDA and SCL pins. \n\n![image](https://cloud.githubusercontent.com/assets/13704023/22856431/e6cee556-f099-11e6-8d96-7d2e1baf3985.png)\n\n## How do I write the code?\nI made it very simple for you. You just need to add NuGet package RobootikaCOM.MPL115A2 to your project and you are almost done :)\n\nAfter adding these NuGet packages, you just need to write 3 lines of code.\n\n1. Add reference to this module\n````C#\nusing RobootikaCOM.MPL115A2;\n````\n\n2. Create an object for sensor: \n````C#\n        private MPL115A2 MPL115A2Sensor = new MPL115A2();\n````\n\n3. Write a while-loop, to read data from the sensor every 1 sec.\n````C#\n            while (true)\n            {\n                double pressure = MPL115A2Sensor.getPressure(); //kPa\n                double temperature = MPL115A2Sensor.getTemperature();\n                Task.Delay(1000).Wait();\n            }\n````\nFinal code looks like this. \n\nIf you run it, you do not see anything, because it just reads the data, but it doesnt show it anywhere.\nYou need to integrate this project with my other example, where I teach how to send this data into Azure.\n\n````C#\nusing System;\nusing Windows.ApplicationModel.Background;\nusing System.Threading.Tasks;\nusing RobootikaCOM.MPL115A2;\n\nnamespace LessonTempertureMPL115A2\n{\n    public sealed class StartupTask : IBackgroundTask\n    {\n        // MPL115A2 Sensor\n        private MPL115A2 MPL115A2Sensor = new MPL115A2();\n\n        public void Run(IBackgroundTaskInstance taskInstance)\n        {\n            while (true)\n            {\n                double pressure = MPL115A2Sensor.getPressure(); //kPa\n                double temperature = MPL115A2Sensor.getTemperature();\n                Task.Delay(1000).Wait();\n            }\n        }\n    }\n}\n\n````\n\n## Can I change I2C address?\nI2C address is used to communicate with the sensor. Many sensors have I2C address hardcoded, and this sensor exactly this. \n**You cannot change I2C address, it is fixed to 0x60.**\n\n## Technical Details\n\n* PCB weight: 0.61g\n* Vin: 2.4 to 5.5 VDC\n* Logic: 3 to 5V compliant\n* Pressure sensing range: 500-1150 hPa (up to 10Km altitude)\n* 1.5 hPa / 50 m altitude resolution\n* This board/chip uses I2C 7-bit address 0x60\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleivosepp%2Flesson-temperture-mpl115a2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleivosepp%2Flesson-temperture-mpl115a2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleivosepp%2Flesson-temperture-mpl115a2/lists"}