{"id":13802417,"url":"https://github.com/aleppax/micropython-SNGCJA5","last_synced_at":"2025-05-13T13:30:58.131Z","repository":{"id":179548167,"uuid":"583866035","full_name":"aleppax/micropython-SNGCJA5","owner":"aleppax","description":"micropython port of the python driver for Panasonic SN-GCJA5 particulate matter (PM) sensor. Tested on Raspberry Pico W","archived":false,"fork":true,"pushed_at":"2023-01-13T23:32:31.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-08-04T00:07:11.612Z","etag":null,"topics":["air-quality","micropython","pm-sensor","raspberry-pi-pico"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dvsu/PanasonicSNGCJA5","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aleppax.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}},"created_at":"2022-12-31T08:13:32.000Z","updated_at":"2024-03-01T10:50:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aleppax/micropython-SNGCJA5","commit_stats":{"total_commits":31,"total_committers":3,"mean_commits":"10.333333333333334","dds":"0.32258064516129037","last_synced_commit":"ff9f97e6bfca9eef1d8d63d4795a9d837cebdb2f"},"previous_names":["aleppax/panasonicsngcja5","aleppax/micropython-sngcja5"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleppax%2Fmicropython-SNGCJA5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleppax%2Fmicropython-SNGCJA5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleppax%2Fmicropython-SNGCJA5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleppax%2Fmicropython-SNGCJA5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleppax","download_url":"https://codeload.github.com/aleppax/micropython-SNGCJA5/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225218050,"owners_count":17439713,"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":["air-quality","micropython","pm-sensor","raspberry-pi-pico"],"created_at":"2024-08-04T00:01:44.002Z","updated_at":"2024-11-18T17:31:22.887Z","avatar_url":"https://github.com/aleppax.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Sensors"],"readme":"# Panasonic-SN-GCJA5\n\n## **Introduction**\n\nMicropython driver for Panasonic SN-GCJA5 particulate matter (PM) sensor. Tested on Raspberry Pico W\u003cbr\u003e\nPort from [sngcja5](https://github.com/dvsu/PanasonicSNGCJA5)\nThe sensor updates all registers every second.\n\n## **Wiring**\n\nPanasonic SN-GCJA5 uses `JST SM05B-GHS-TB(LF)(SN)` connector and requires 3.3V and 5V for direct wiring. \nFortunately, Raspberry Pi GPIOs are 3.3V by default and also supports dual power supply voltages, 3.3V and 5V. \nPlease refer to sensor specification sheet and table below for wiring guide.  \n\n| Sensor Connector Pin | Symbol | Recommended Voltage | Description | RPico Physical Pin | RPi I/O |\n| :---: | :---: | :---: | :---: | :---: | :---: |\n| Pin 1 | TX | 3.3V | UART TX *(unused if using I2C protocol)* | *not connected* | |\n| Pin 2 | SDA | 3.3V | I2C Data | Pin 1 | GP0 (I2C0 SDA) |\n| Pin 3 | SCL | 3.3V | I2C Clock | Pin 2 | GP1 (I2C0 SCL) |\n| Pin 4 | GND | 0V | Ground | Pin 38 | Ground |\n| Pin 5 | VDD | 5V | Power supply | Pin 40 | 5v Power |\n\nMore details about [Raspberry Pico pinout](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html)\n  \n## **Status register**\n\nThe Panasonic SN-GCJA5 has a proprietary logic capable of monitoring the status of critical parts and compensating with software correction in order to maintain a certain level of performance during the lifetime (expected lifetime of 5 years at 25°C, 60%RH on continuous current). \n\n```micropython\npm_sensor.get_status_data()\n{'status_register': '00000000'} \n```\n\n### Particle Detect status [bit5][bit4]\n0. Normal status\n1. Normal status (within -80% against initial value), with S/W correction\n2. Abnormal (below -90% against initial value), loss of function\n3. Abnormal (below -80% against initial value), with S/W correction\n\n### LED operational status [bit3][bit2]\n0. Normal status\n1. Normal status (within -70% against initial LOP), with S/W correction\n2. Abnormal (below -90% against initial LOP) or no LOP, loss of function\n3. Abnormal (below -70% against initial LOP), with S/W correction\n\n### PWM Fan operational status [bit1][bit0]\n0. Normal status\n1. Normal status (1,000rpm or more), with S/W correction\n2. In initial calibration\n3. Abnormal (below 1,000rpm), out of control\n\n### Overall sensor status [bit7][bit6]\n0. everything is fine, thanks, I appreciate your interest\n1. Abnormal status for any one of Particle detect, LED, PWM statuses\n2. Abnormal status for any two of Particle detect, LED, PWM statuses\n3. Abnormal status for any three of Particle detect, LED, PWM statuses\n\n## **Examples**\n\n```micropython\nfrom machine import Pin, I2C\nfrom picosngcja5 import SNGCJA5\n\n\n# If SDA and SCL are connected to I2C bus 0, then:\ni2c = I2C(0, sda=Pin(0), scl=Pin(1))\npm_sensor = SNGCJA5(i2c)\n\n\n\n# The get_measurement method returns a dictionary of all measurement value \nresult = pm_sensor.measure()\n\nprint(result)\n'''\n    Structure of result\n    {\n    'mass_density': {\n        'pm10': \u003cfloat\u003e,\n        'pm2.5': \u003cfloat\u003e,\n        'pm1.0': \u003cfloat\u003e\n        }, \n    'particle_count': {\n        'pm1.0': \u003cfloat\u003e, \n        'pm10': \u003cfloat\u003e, \n        'pm7.5': \u003cfloat\u003e, \n        'pm2.5': \u003cfloat\u003e, \n        'pm5.0': \u003cfloat\u003e, \n        'pm0.5': \u003cfloat\u003e\n        }\n    }\n'''\n\n```\n\n## **Dependencies and Installation Instructions**\n\ncopy the library in your project and import it\n\n## **Limitation**\n\nCurrently, this driver only supports **I2C** protocol\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleppax%2Fmicropython-SNGCJA5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleppax%2Fmicropython-SNGCJA5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleppax%2Fmicropython-SNGCJA5/lists"}