{"id":25042448,"url":"https://github.com/michael-sulyak/micropython-mlx90640","last_synced_at":"2025-07-25T16:10:48.816Z","repository":{"id":233872549,"uuid":"787953949","full_name":"michael-sulyak/micropython-mlx90640","owner":"michael-sulyak","description":"This repository contains a MicroPython driver for the MLX90640 thermal camera sensor.","archived":false,"fork":false,"pushed_at":"2024-04-18T16:21:30.000Z","size":423,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-05T20:05:54.005Z","etag":null,"topics":["micropython","micropython-driver","micropython-lib","micropython-rpi-pico","mlx90640"],"latest_commit_sha":null,"homepage":"","language":"Python","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/michael-sulyak.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-17T13:54:28.000Z","updated_at":"2025-05-01T10:17:29.000Z","dependencies_parsed_at":"2024-05-02T01:34:50.245Z","dependency_job_id":null,"html_url":"https://github.com/michael-sulyak/micropython-mlx90640","commit_stats":null,"previous_names":["expert-m/micropython-mlx90640","michael-sulyak/micropython-mlx90640"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michael-sulyak/micropython-mlx90640","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-sulyak%2Fmicropython-mlx90640","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-sulyak%2Fmicropython-mlx90640/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-sulyak%2Fmicropython-mlx90640/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-sulyak%2Fmicropython-mlx90640/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michael-sulyak","download_url":"https://codeload.github.com/michael-sulyak/micropython-mlx90640/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-sulyak%2Fmicropython-mlx90640/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267029422,"owners_count":24024202,"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-07-25T02:00:09.625Z","response_time":70,"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":["micropython","micropython-driver","micropython-lib","micropython-rpi-pico","mlx90640"],"created_at":"2025-02-06T04:46:20.021Z","updated_at":"2025-07-25T16:10:48.740Z","avatar_url":"https://github.com/michael-sulyak.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MicroPython Driver for MLX90640 IR Camera\n\n![](example.png)\n\n## Introduction\n\nThis repository contains a MicroPython driver for the MLX90640 thermal camera sensor. This driver is a small refactored and small optimized version based on the original [Adafruit CircuitPython MLX90640 driver](https://github.com/adafruit/Adafruit_CircuitPython_MLX90640), but for MicroPython.\n\n(There are still things to refactor and optimize here, but the current version is enough to get you started.)\n\nThis driver was tested on:\n\n* Raspberry Pi Pico W\n\n## Basic Usage\n\nTo use the MLX90640 driver with MicroPyServer, follow these steps:\n\n1. Initialize and configure the I2C connection:\n    ```python\n    import machine\n    i2c = machine.I2C(1, sda=machine.Pin(6), scl=machine.Pin(7), freq=400000)\n    ```\n\n2. Set up the MLX90640 sensor with the desired refresh rate:\n    ```python\n    from drivers.mlx90640 import MLX90640, RefreshRate\n    mlx = MLX90640(i2c)\n    mlx.refresh_rate = RefreshRate.REFRESH_2_HZ\n    ```\n3. Continuously capture:\n    ```python\n    frame = init_float_array(768)\n    while True:\n        mlx.get_frame(frame)\n        print(frame)\n    ```\n\n## Example Integration with MicroPyServer\n\nHere is a simple example of how the MLX90640 driver can be integrated with MicroPyServer to serve thermal imaging data over a network. It will be helpful if you don't have appropriate screen to show the image.\n\n```python\nimport machine\nfrom micropyserver import MicroPyServer\nfrom drivers.mlx90640 import MLX90640, RefreshRate, init_float_array\n\nclass IrCameraServer:\n    def __init__(self):\n        i2c = machine.I2C(1, sda=machine.Pin(6), scl=machine.Pin(7), freq=400000)\n        self.mlx = MLX90640(i2c)\n        self.mlx.refresh_rate = RefreshRate.REFRESH_2_HZ\n        self.frame = init_float_array(768)\n\n        self.server = MicroPyServer()\n        self.server.add_route('/', self.show_index)\n        self.server.add_route('/result.bytes', self.show_result)\n\n    def show_index(self, request):\n        # Serve HTML content\n        \n        self.server.send('HTTP/1.0 200 OK\\r\\n')\n        self.server.send('Content-Type: text/html; charset=utf-8\\r\\n\\r\\n')\n\n        with open('renderer.html', 'r') as file:\n            self.server.send(file.read())\n\n    def show_result(self, request):\n        # Serve thermal image data\n        \n        self.server.send('HTTP/1.0 200 OK\\r\\n')\n        self.server.send('Content-Type: application/octet-stream\\r\\n\\r\\n')\n        self.mlx.get_frame(self.frame)\n        self.server.send_bytes(bytes(self.frame))\n\n    def run(self):\n        # Need to connect to WiFi before running the server\n        self.server.start()\n\n# Usage:\ncamera_server = IrCameraServer()\ncamera_server.run()\n```\n\nImplementation of `MicroPyServer.send_bytes`:\n```python    \n    def send_bytes(self, data):\n        \"\"\" Send data to client \"\"\"\n        if self._connect is None:\n            raise Exception(\"Can't send response, no connection instance\")\n        self._connect.sendall(data)\n```\n\nNOTE: You can find file `renderer.html` in this repository.\n\n## Contributing\n\nContributions to enhance or extend the functionality of this MLX90640 driver are welcome.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-sulyak%2Fmicropython-mlx90640","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichael-sulyak%2Fmicropython-mlx90640","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-sulyak%2Fmicropython-mlx90640/lists"}