{"id":15674829,"url":"https://github.com/victornpb/evc_pt2257","last_synced_at":"2025-08-02T08:36:34.487Z","repository":{"id":28972586,"uuid":"32498986","full_name":"victornpb/Evc_pt2257","owner":"victornpb","description":"Arduino C++ Library for using PT2257 - Electronic Volume Controller IC","archived":false,"fork":false,"pushed_at":"2019-06-04T03:17:39.000Z","size":501,"stargazers_count":14,"open_issues_count":1,"forks_count":9,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-06T23:33:02.237Z","etag":null,"topics":["arduino","arduino-library","cpp","digital-potentiometer","i2c"],"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/victornpb.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}},"created_at":"2015-03-19T03:35:46.000Z","updated_at":"2023-06-15T08:49:46.000Z","dependencies_parsed_at":"2022-09-18T10:20:25.865Z","dependency_job_id":null,"html_url":"https://github.com/victornpb/Evc_pt2257","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/victornpb/Evc_pt2257","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2FEvc_pt2257","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2FEvc_pt2257/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2FEvc_pt2257/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2FEvc_pt2257/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victornpb","download_url":"https://codeload.github.com/victornpb/Evc_pt2257/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2FEvc_pt2257/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268355794,"owners_count":24237369,"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-02T02:00:12.353Z","response_time":74,"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":["arduino","arduino-library","cpp","digital-potentiometer","i2c"],"created_at":"2024-10-03T15:51:24.142Z","updated_at":"2025-08-02T08:36:34.461Z","avatar_url":"https://github.com/victornpb.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Evc_pt2257\nArduino Library for using PT2257 - Electronic Volume Controller IC (a.k.a Digital Potentiometer)\n\nConnect the IC to the following pins, you can change it in the .c file.  \nPull-up resistors are required on both pins (4K7 or 10K should be fine).  \n\u003e `SCL =\u003e A0`   \n\u003e `SDA =\u003e A1`   \n \n Datasheet - http://www.princeton.com.tw/Portals/0/Product/PT2257.pdf\n\n```\nPinout\n\n   |----._.----|\n1 -| Lin   Rin |- 8\n2 -| Lout Rout |- 7\n3 -| Gnd    V+ |- 6\n4 -| SDA   SCL |- 5\n   |-----------|\n```\n\n## API\n\nVolume Attenuation are expressed as **unsigned** integers  \ne.g. : to set the attenuation to -21dB express it as `21`\n\n- `void evc_init();`  \n  Start the I2C communication  \n  *Call this on setup(); to ensure a reliable initialization, this will delay for 200ms.*\n\n- `void evc_setVolume(uint8_t dB);`  \n  Set the attenuation on both channels (between 0dB and -79dB)\n\n- `void evc_setVolumeLeft(uint8_t dB);`  \n  Set the attenuation on the Left channel (between 0dB and -79dB)  \n  Use this for implementing left/right balance offset.\n\n- `void evc_setVolumeRight(uint8_t dB);`  \n  Set the attenuation on the right channel (between 0dB and -79dB)  \n  Use this for implementing left/right balance offset.\n\n- `void evc_mute(bool toggle);`  \n  **toggle**:\n    - *true*: Mute both channels.  \n      This mode have an effective attenuation of -95dB (+5/-2dB) \n    - *false*: Unmute both channels.\n    \n  **Note:** It will preserve the set Volume when mute is toggled \n  (This behavior is not documented on the datasheet).  \n\n- `void evc_off();`  \n  Function OFF (-79dB)  \n  *The exact purpose of this instruction is not clear on the datasheet.*\n\n----\n\n## Initialization\n\nThe datasheet does not mention anything about it being volatile or not, but it seems to hold state after power cycle, I'm not sure about about if it's just an artifact, but I recommend setting it to a known state just after initialization, so you will not be in a situation that you are changing volume but nothing happens because you have mute on, after a power cycle. So does not expect it to be in a known state just after power on, handle it yourself.\n\n```\nvoid setup(){\n    evc_init();\n    \n    //ensure power on consistency\n    evc_setVolume(79);\n    evc_mute(false);\n\t...\n    /* recover state from arduino eeeprom if desired */\n\t//set the volume to stored state.\n}\n```\n\n\n----\n\n## Suggestions / Questions\n\nFile a [issue](https://github.com/victornpb/Evc_pt2257/issues) on this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictornpb%2Fevc_pt2257","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictornpb%2Fevc_pt2257","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictornpb%2Fevc_pt2257/lists"}