{"id":48955938,"url":"https://github.com/danny-baker/esp32-dac-calibrated","last_synced_at":"2026-04-18T00:02:49.155Z","repository":{"id":310144059,"uuid":"1038846209","full_name":"danny-baker/esp32-dac-calibrated","owner":"danny-baker","description":"For Micropython applications, here are the measured voltages for the 0-255 range of the ESP32-WROOM-32D 8bit DAC.","archived":false,"fork":false,"pushed_at":"2025-08-17T00:43:17.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-28T20:45:52.891Z","etag":null,"topics":["dac","esp32","micropython","micropython-esp32"],"latest_commit_sha":null,"homepage":"","language":"Python","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/danny-baker.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,"zenodo":null}},"created_at":"2025-08-15T23:43:07.000Z","updated_at":"2025-08-17T00:43:21.000Z","dependencies_parsed_at":"2025-08-16T03:47:09.949Z","dependency_job_id":"8de958f8-81cf-4241-b4f1-996f2345c73e","html_url":"https://github.com/danny-baker/esp32-dac-calibrated","commit_stats":null,"previous_names":["danny-baker/esp32-dac-calibrated"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danny-baker/esp32-dac-calibrated","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-baker%2Fesp32-dac-calibrated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-baker%2Fesp32-dac-calibrated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-baker%2Fesp32-dac-calibrated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-baker%2Fesp32-dac-calibrated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danny-baker","download_url":"https://codeload.github.com/danny-baker/esp32-dac-calibrated/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-baker%2Fesp32-dac-calibrated/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31950891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dac","esp32","micropython","micropython-esp32"],"created_at":"2026-04-18T00:02:48.627Z","updated_at":"2026-04-18T00:02:49.149Z","avatar_url":"https://github.com/danny-baker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp32-dac-calibrated\nFor Micropython applications, here are the measured voltages for the 0-255 range of the ESP32-WROOM-32D 8bit DAC. \n\n## Background\n* The two onboard 8bit DACs are not true linear, especially at the extreme ranges.\n* This (known problem) presents a challenge if you want to target an accurate voltage\n* The onboard DACs use the 3.3V regulated supply voltage as a ref so in theory you should get 0-3.3V step 0-255\n* In reality, it's quite different. \n* I haven't been able to find a datasheet with the actual values so I've painstakingly measured the voltage at each and every step.\n* I'm sure there's variation between models and devices, but this is much better than assuming equal voltage steps of 0.012941 throughout the range (i.e. 3.3 volts / 255 steps)\n* Measured on an ESP32-WROOM-32D with a Digitech QM1321 Multimeter \n\n## Usage\nWipe the tears of pain away and use these values in your code rather than assuming a linear relationship between 0-3.3V across the step range.\n\n## Run\n* Assume firmware installed on device and interfacing with it via `mpremote` on Ubuntu PC \n* Ref: https://docs.micropython.org/en/latest/reference/mpremote.html\n* Copy file to device `mpremote fs cp esp32_dac.py :esp32_dac.py`\n* Run example script from ESP32 memory `mpremote run example.py`\n\n## `esp32_dac.csv`\n* A simple comma-separated-values file for general purpose use, language agnostic of type `step,voltage`\n\n## `esp32_dac.py`\n* A Python dictionary containing the measured DAC values of type `{step:voltage}` \n* This can easily be imported into your Micropython project, as demonstrated in the example.\n* Or of course you could just cut-paste it directly into your code.\n\n## `example.py`\n* A simple Micropython script demonstrating usage of the onboard DAC with a few helper operations\n\n## `machine.DAC` class is incomplete (Aug 2025)\n* If you're using the onboard DAC on an ESP32 using Micropython, you'll need to use the `machine.DAC` class that ships on the firmware for your device\n* Take special note that this is barebones and nowhere near as built out as the `machine.ADC` class\n* In fact it's not even listed in the official docs, but it does work, see https://docs.micropython.org/en/v1.10/library/machine.html#module-machine\n* Basically you only have the `write()` method and there is no `deinit()` as there is for the ADC class.\n* Once the DAC is initialised it will throw an OS error next time you run your code (because internally the DAC channel apparently remains in that state)\n* The only way to avoid this is to power cycle the device or do a `machine.reset()`\n\nYou're welcome :)\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanny-baker%2Fesp32-dac-calibrated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanny-baker%2Fesp32-dac-calibrated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanny-baker%2Fesp32-dac-calibrated/lists"}