Skip to content

efosmark/voltage-divider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Voltage Divider Calculation

Often times it's desired to find resistor values that will provide a given output voltage for a given input voltage. This Python package allows that calculation to be done easily.

It also allows you to find R1 and R2 values for a given EIA value set. The current options being E3, E6, E12, E24 (default), E48, and E96.

Usage

The package can either be used as a Python resource, or can be used directly on the command-line for quick calculations.

As a Python resource:

>>> import voltagedivider
>>> from voltagedivider import divider
>>> from voltagedivider import divider, eia
>>> divider.calc_voltage_divider_resistance_values(3, 5)
(1.0, 1.5)
>>> divider.calc_voltage_divider_resistance_values(3, 5, value_set=eia.E48)
(1.33, 1.96)

From the command line:

$ python3 voltagedivider/divider.py 3 5
Closest match (using E24 value set):
  R1 decade:   1.0
  R2 decade:   1.5
  V out:       3.0 volts

$ python3 voltagedivider/divider.py 3 5 --value_set=E48
Closest match (using E48 value set):
  R1 decade:   1.33
  R2 decade:   1.96
  V out:       2.98 volts

Author

Evan Fosmark evan.fosmark@gmail.com

About

Tool for calculating the optimal R1 and R2 values for a given V-in and V-out for a voltage divider.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages