{"id":22267908,"url":"https://github.com/cfmvcarlos/ohmcalculators","last_synced_at":"2026-07-10T08:31:52.180Z","repository":{"id":264327258,"uuid":"893055226","full_name":"CFMVCarlos/OhmCalculators","owner":"CFMVCarlos","description":"This repository provides a set of functions for working with resistor values and performing calculations related to voltage dividers, parallel resistances, and shorthand notation for resistor values. It utilizes the standard E24 resistor series to find the best resistor combinations for various electrical applications.","archived":false,"fork":false,"pushed_at":"2024-11-23T16:17:02.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T10:45:21.647Z","etag":null,"topics":["electronics","python3","resistor","resistor-calculator","voltage","voltage-divider","voltage-reference"],"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/CFMVCarlos.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-11-23T12:18:19.000Z","updated_at":"2024-11-23T16:17:05.000Z","dependencies_parsed_at":"2024-11-23T13:22:56.013Z","dependency_job_id":"c4a3ca9e-da85-4da1-a7db-0f6fc500c4e5","html_url":"https://github.com/CFMVCarlos/OhmCalculators","commit_stats":null,"previous_names":["cfmvcarlos/ohmcalculators"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CFMVCarlos/OhmCalculators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFMVCarlos%2FOhmCalculators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFMVCarlos%2FOhmCalculators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFMVCarlos%2FOhmCalculators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFMVCarlos%2FOhmCalculators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CFMVCarlos","download_url":"https://codeload.github.com/CFMVCarlos/OhmCalculators/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CFMVCarlos%2FOhmCalculators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35326962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"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":["electronics","python3","resistor","resistor-calculator","voltage","voltage-divider","voltage-reference"],"created_at":"2024-12-03T11:09:33.476Z","updated_at":"2026-07-10T08:31:52.160Z","avatar_url":"https://github.com/CFMVCarlos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Resistor Value Calculator\n\nThis repository provides a set of functions for working with resistor values and performing calculations related to voltage dividers, parallel resistances, and shorthand notation for resistor values. It utilizes the standard E24 resistor series to find the best resistor combinations for various electrical applications.\n\n## Features\n\nThis project includes the following functionalities:\n- **Voltage Divider Calculations**: Calculate various parameters of a voltage divider circuit, such as input voltage, output voltage, or resistor values.\n- **E24 Resistor Values**: Utilize a predefined set of resistor values based on the E24 series.\n- **Resistor Shorthand Conversion**: Convert resistor values to shorthand notation (e.g., 10k, 1M).\n- **Closest Parallel Resistor**: Find the best combination of two resistors in parallel to achieve a target resistance.\n- **Voltage Divider Resistances Calculator**: Calculate the resistor values required in a voltage divider circuit based on the input and output voltages.\n\n## Installation\n\nTo install and use the Resistor Value Calculator:\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/CFMVCarlos/OhmCalculators.git\n    cd OhmCalculators\n    ```\n\n## Usage\n\n### 1. Voltage Divider Calculations\n\nThe `voltage_divider_calculations` function allows you to calculate various parameters in a voltage divider circuit, such as the input voltage (`vin`) or output voltage (`vout`), given two resistors.\n\n**Example**:\n\n```python\nfrom lib.voltage_divider_calculations import voltage_divider_calculations\n\nvout = 5.0  # Output voltage in volts\nr1 = 18e3  # Resistor R1 in ohms\nr2 = 13e3  # Resistor R2 in ohms\n\nresult = voltage_divider_calculations(vout=vout, r1=r1, r2=r2)  # Calculate Vin\nprint(f\"Calculated Vin: {result} V\")  # Output: 11.92 V\n```\n\n### 2. Resistor Value Lookup\n\nThe `all_resistor_values` function generates all standard resistor values based on the E24 series, ranging from 1.0Ω to 9.1MΩ.\n\n**Example**:\n\n```python\nfrom lib.e24_resistor_values import all_resistor_values\n\nfor value in all_resistor_values():\n    print(value)\n```\n\n### 3. Converting Resistor Values to Shorthand\n\nThe `convert_to_shorthand` function converts resistor values to shorthand notation, making it easier to display resistor values in a more compact form.\n\n**Example**:\n\n```python\nfrom lib.common import convert_to_shorthand\n\nresistor_value = 10000.0  # Resistor value in ohms\nshorthand = convert_to_shorthand(resistor_value)\nprint(f\"Shorthand notation: {shorthand}\")  # Output: 10k\n```\n\n### 4. Closest Parallel Resistor\n\nThe `find_best_parallel_combination` function helps you find the best pair of resistors from the E24 series that, when connected in parallel, yield the closest possible resistance to a target value. It iterates through all available resistor values in the E24 series, calculates the equivalent resistance for each pair, and compares the result to the target resistance, selecting the combination with the least error.\n\n**Example**:\n\n```python\nfrom lib import find_best_parallel_combination\nfrom lib.common import convert_resistor_value, convert_to_shorthand\n\ntarget_resistance_str = \"4k7\"  # Target resistance in shorthand notation (e.g., '4k7')\ntarget_resistance = convert_resistor_value(target_resistance_str)\n\nr1, r2, error = find_best_parallel_combination(target_resistance)\nprint(f\"Best R1: {convert_to_shorthand(r1)}, Best R2: {convert_to_shorthand(r2)} with error: {error:.4f}\")\n```\n\n### 5. Finding the Best Resistor Combination for a Voltage Divider\n\nThe `find_resistor_values` function helps you find the best combination of two resistors from the E24 series to achieve a target output voltage in a voltage divider circuit. It ensures that the current through the circuit does not exceed the maximum allowable current (provided by the user). The function iterates through all possible resistor combinations, calculates the output voltage for each pair, and selects the combination that minimizes the error between the calculated and target output voltage.\n\n**Example**:\n\n```python\nfrom lib import find_resistor_values\nfrom lib.common import convert_to_shorthand\n\nvin = 12.0  # Input voltage in volts\nvout = 5.0  # Desired output voltage in volts\nmaximum_current = 10.0  # Maximum allowable current in milliamps\n\nr1, r2, error, current = find_resistor_values(vin=vin, vout=vout, maximum_current=maximum_current)\nprint(f\"Best R1: {convert_to_shorthand(r1)}, Best R2: {convert_to_shorthand(r2)} with error: {error:.4f} and current: {current*1e3:.4f} mA\")\n```\n\n## Project Structure\n\nThe project follows a modular structure:\n\n```\nOhmCalculators/\n│\n├── lib/\n│   ├── common.py                   # Utility functions for converting resistor values and shorthand notations.\n│   ├── e24_resistor_values.py      # Functions to generate E24 series resistor values.\n│   └── voltage_divider.py          # Voltage divider calculation functions.\n│\n├── closest_parallel_resistor.py    # Functions for finding the best parallel resistor combination.\n├── voltage_divider_resistances.py  # Functions for calculating the resistance values in a voltage divider circuit.\n└── README.md                       # Project overview and documentation.\n```\n\n## Author\n\n- [Carlos Valente](https://github.com/CFMVCarlos)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfmvcarlos%2Fohmcalculators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfmvcarlos%2Fohmcalculators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfmvcarlos%2Fohmcalculators/lists"}