{"id":16930576,"url":"https://github.com/gandro/micropython-m5stamp-c3u","last_synced_at":"2025-08-04T16:33:49.295Z","repository":{"id":42644691,"uuid":"509750073","full_name":"gandro/micropython-m5stamp-c3u","owner":"gandro","description":"Micropython modules for the M5Stamp C3U","archived":false,"fork":false,"pushed_at":"2023-03-19T07:46:28.000Z","size":40,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-20T10:55:32.100Z","etag":null,"topics":["bh1750fvi","esp32-c3","m5stack","m5stamp-c3u","micropython","qmp6988","sgp30","sht30"],"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/gandro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2022-07-02T12:30:17.000Z","updated_at":"2024-11-11T16:01:42.000Z","dependencies_parsed_at":"2024-10-13T20:42:04.106Z","dependency_job_id":"4874f894-0ab9-4fec-bac0-43c58bf31089","html_url":"https://github.com/gandro/micropython-m5stamp-c3u","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gandro/micropython-m5stamp-c3u","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gandro%2Fmicropython-m5stamp-c3u","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gandro%2Fmicropython-m5stamp-c3u/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gandro%2Fmicropython-m5stamp-c3u/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gandro%2Fmicropython-m5stamp-c3u/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gandro","download_url":"https://codeload.github.com/gandro/micropython-m5stamp-c3u/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gandro%2Fmicropython-m5stamp-c3u/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268723073,"owners_count":24296544,"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-08-04T02:00:09.867Z","response_time":79,"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":["bh1750fvi","esp32-c3","m5stack","m5stamp-c3u","micropython","qmp6988","sgp30","sht30"],"created_at":"2024-10-13T20:42:00.790Z","updated_at":"2025-08-04T16:33:49.220Z","avatar_url":"https://github.com/gandro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# micropython-m5stamp-c3u\n\nThis repository contains examples for the\n[M5Stamp C3U](https://docs.m5stack.com/en/core/stamp_c3u) development board.\n\nAll drivers are written in pure [Micropython](https://micropython.org/) and are\nintended to be used with the generic Micropython build for ESP32-C3-USB-based\nboards.\n\nSome of the modules in this repository make use of [`micropython.const`][const]\nto optimize memory usage when deployed in [pre-compiled bytecode][mpy] form.\n\n[const]: http://docs.micropython.org/en/latest/library/micropython.html#micropython.const\n[mpy]: http://docs.micropython.org/en/latest/reference/mpyfiles.html\n\n## Getting Started with Micropython\n\nThis section guides you through the steps to flash Micropython to the M5Stamp\nC3U board.\n\n### Enter Download Mode\n\nTo enter the download mode, press and hold the center button (G9) under a\npower failure condition. To achieve this, *either* hold the center\nbutton while pressing reset and then release the center button,\n*or* disconnect the USB cable and then hold the center button while\nconnecting the USB cable, and then release the center button.\n\nIf successful, the M5Stamp will present a USB CDC ACM device on your host.\n\n### Flash Micropython Firmware\n\nDownload the [ESP32-C3 with USB](https://micropython.org/download/esp32c3-usb/)\nMicropython port for the M5Stamp C3U.\n\nWhile the device is in download mode, flash Micropython to the M5Stamp C3U\nas follows:\n\n```\nesptool.py --chip esp32c3 --port /dev/ttyACM0 --baud 460800 \\\n    write_flash -z 0x0 esp32c3-usb-20221216-unstable-v1.19.1-774-ged58d6e4c.bin\n```\n\nReset the device and you will be able to use the Micropython console via the\nUSB CDC serial device.\n\n## Examples\n\n### LED and Button\n\nThis example changes the LED color each time the center button is pressed.\n\n```python\nimport machine, neopixel, random, time\n\nbutton = machine.Pin(9, machine.Pin.IN, machine.Pin.PULL_UP)\nled = neopixel.NeoPixel(machine.Pin(2, machine.Pin.OUT), 1)\n\nled.fill((0, 255, 200))\nled.write()\n\nwhile True:\n  if button.value() == 0:\n    r = random.randint(0, 255)\n    g = random.randint(0, 255)\n    b = random.randint(0, 255)\n    led.fill((r, g, b))\n    led.write()\n  time.sleep_ms(50)\n```\n\n### Grove Peripherals\n\nThe following example assumes a Grove connector is soldered to the board on\nPort A (pins G0/G1/5V/GND). It assumes the following units are all connected\nto the same I2C bus via the Grove Hub:\n\n - [CO2 Unit](https://docs.m5stack.com/en/unit/co2):\n   `SCD40` (co2, temperature and humidity, I2C `0x62`)\n - [ENV III Unit](https://docs.m5stack.com/en/unit/envIII):\n   `SHT30` (temperature and humidity, I2C `0x44`), `QMP6988` (absolute air pressure, I2C `0x70`)\n - [DLight Unit](https://docs.m5stack.com/en/unit/dlight):\n   `BH1750FVI` (ambient light, I2C `0x23`)\n\nEarlier versions of this project used a cheaper eCO2 sensor, but it is no\nlonger in use:\n\n - [TVOC/eCO2 Unit](https://docs.m5stack.com/en/unit/tvoc):\n   `SGP30` (indoor air quality, I2C `0x58`)\n\n```python\nimport machine\nimport uasyncio\n\nimport bh1750fvi\nimport sht30\nimport scd40\nimport qmp6988\n\ni2c = machine.I2C(0, sda=machine.Pin(1), scl=machine.Pin(0), freq=400000)\n\nasync def main():\n  dlx = bh1750fvi.BH1750FVI(i2c)\n  rht = sht30.SHT30(i2c)\n  scd = scd40.SCD40(i2c)\n  prt = qmp6988.QMP6988(i2c)\n\n  print(\"Initializing sensors...\")\n  await scd.start()\n\n  while True:\n    light = dlx.measure()\n    print(\"Ambient Light: {}lx\".format(light))\n\n    temp, humidity = rht.measure()\n    print(\"Temp/Humidity: {}°C/{}%\".format(temp, humidity))\n\n    temp, pressure = prt.measure()\n    print(\"Temp/Pressure: {}°C/{}Pa\".format(temp, pressure))\n\n    scd.set_ambient_pressure(pressure)\n    co2, temp, humidity = scd.measure()\n    print(\"CO2/Temp/Humidity: {}ppm/{}°C/{}%\".format(co2, temp, humidity))\n\n    await uasyncio.sleep(1)\n\nuasyncio.run(main())\n```\n\n*Note:* To install the required Micropython drivers using\n[`mpremote`](https://pypi.org/project/mpremote/), copy the `lib/` folder to your\ndevice as follows:\n\n```console\n$ mpremote a0 cp -r lib :\n```\n\n## Requirements\n\n  - `lib/homeassist` requires polling support on SSL sockets when `use_ssl=True`\n    ([micropython/micropython#9871](https://github.com/micropython/micropython/pull/9871))\n\n## Contributing\n\nContributions are welcome! Please read and follow the\n[Code of Conduct](CODE_OF_CONDUCT.md) and make sure to acknowledge the\n[Developer Certificate of Origin](https://developercertificate.org/) when\ncontributing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgandro%2Fmicropython-m5stamp-c3u","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgandro%2Fmicropython-m5stamp-c3u","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgandro%2Fmicropython-m5stamp-c3u/lists"}