Electrical Energy Calculator
Calculate electricity use from power and duration, or constant DC voltage and current. Compare energy use over different operating times in watt-hours, kilowatt-hours and joules.
Open toolCheck whether a driver's logic levels suit a receiver's input thresholds and maximum voltage, and whether a pull-up or pull-down resistor gives a valid idle level.
Choose the driver output type: push-pull for a normal output pin, open-drain for an output that only pulls low, such as I²C, interrupt and alert lines.
Enter the driver's guaranteed levels from its data sheet: its supply, VOH minimum and VOL maximum at your load current.
Enter the receiver's VIH minimum, VIL maximum and the highest voltage its input may see. For an input that is not 5 V-tolerant this is usually its supply plus 0.3 to 0.5 V. Use the recommended operating maximum if the data sheet gives one; absolute-maximum ratings are stress limits, not a design target.
Choose a pull-up, a pull-down or none. For a pull resistor, enter its value, the pull-up rail, the receiver's input leakage and the driver current: the sink current (IOL) at which the data sheet gives VOL (pull-up), or the source current (IOH) at which it gives VOH (pull-down) — not the absolute-maximum rating. You can also drag the resistor slider.
Read the verdict, the two noise margins and the resistor limits, and compare the bands in the chart. Copy result copies the inputs and the verdict. Reset restores the starting example.
A logic input reads any voltage above VIH as high and any voltage below VIL as low; between the two its state is undefined. A data sheet guarantees that a driver's high output stays above VOH and its low output below VOL at a stated current. The connection works when VOH is at least VIH and VOL is at most VIL.
The differences are the noise margins: NMH = VOH − VIH and NML = VIL − VOL. They are how much noise, ground shift or voltage drop the line can take before a level is misread. A negative margin means the receiver may read the wrong level even with no noise at all. A margin of zero or just above leaves no room for noise.
A second rule protects the receiver: no input may exceed its maximum voltage. Many 3.3 V parts allow only their supply plus about 0.5 V, so a 5 V output can damage them through the input clamp diodes even when the logic levels look fine. An open-drain output with a pull-up to the receiver's own supply is the simplest level shifter: the driver only pulls low, and the resistor sets the high level. The open-drain driver pin must itself tolerate the pull-up rail; the tool does not check it.
A push-pull output that is always driven needs no pull resistor; a resistor only holds the level while the driver is off (reset, boot) and draws current whenever the line is driven the other way. The input's leakage current flows through the resistor, so a large value moves the idle level towards the threshold, while a small value wastes current and can exceed what the driver can sink or source.
Assumptions: one driver and one receiver share a ground; the entered levels are the data sheet's guaranteed values at the actual supply, temperature and load current; input leakage is a constant current in the worst direction, taken as the data-sheet maximum; add the driver's off-state leakage and any other inputs on the line; the idle level is limited to 0 V and to the receiver's maximum input voltage.
Limitations: the tool does not model rise time or line capacitance (use the I2C pull-up calculator for buses), several receivers on one line, ground offset, ESD or transients, input hysteresis, or bidirectional level-shifter ICs and MOSFET shifters. Supply tolerance, temperature, and VIH/VIL that scale with the supply are not modelled; enter worst-case values and re-enter thresholds when the supply changes. The open-drain driver pin must itself tolerate the pull-up rail; the tool does not check it. It is a first-pass check; confirm with the data sheets and a bench measurement.
Can I connect a 3.3 V output straight to a 5 V Arduino input? Often not reliably: a 5 V ATmega328P needs at least 0.6 × 5 V = 3 V for a high, and a 3.3 V output guarantees only about 2.4 V under load. Use a level shifter, a buffer with TTL-level inputs, or a part whose VIH suits 3.3 V.
What pull-up value should I start with? For a slow GPIO line, 4.7 kΩ to 100 kΩ is common. Stay above the smallest value the driver can sink and below the largest value the leakage allows; the tool shows both limits.
Is an internal pull-up enough? Microcontroller internal pull-ups are weak, 20 kΩ to 50 kΩ on an ATmega328P, which suits a button or a slow signal but not a fast or long line.
Related tools: I2C pull-up resistor and bus-rise-time calculator (081), Basic Voltage-Divider Calculator (018).
High-level noise margin: NMH = V_high − VIH; V_high = VOH for push-pull, or the pulled-up idle level for open-drain.
Low-level noise margin: NML = VIL − VOL.
Over-voltage check: V_peak ≤ V_max; V_peak = the driver supply (or the pull-up rail if higher) for push-pull, the pull-up rail for open-drain.
Idle level: Pull-up: V_idle = V_pull − I_leak × R. Pull-down: V_idle = I_leak × R.
Pull current (worst case, at the driver supply): Pull-up, line low: I = (V_pull − VOL) ÷ R. Pull-down, line high: I = V_supply ÷ R. Keep I ≤ I_drive.
Resistor limits: R_min = (V_pull − VOL) ÷ I_drive (pull-down: V_supply ÷ I_drive); R_max = (V_pull − VIH) ÷ I_leak (pull-down: VIL ÷ I_leak).
3.3 V push-pull output (VOH 2.4 V, VOL 0.4 V) into a 3.3 V input (VIH 2 V, VIL 0.8 V, maximum 3.6 V), 10 kΩ pull-up to 3.3 V, 1 µA leakage, 4 mA driver: Compatible: smallest margin 400 mV. Both margins are 0.4 V. The idle level is 3.29 V, the pull-up draws 290 µA while the line is low, and any resistor from 725 Ω to 1.3 MΩ meets the DC limits; choose well inside the range, such as 10 kΩ, and check rise time separately.
The same 3.3 V output into an ATmega328P at 5 V (VIH 3 V, VIL 1.5 V, maximum 5.5 V), no pull resistor: Not compatible: driver high 2.4 V is below receiver VIH 3 V. The high-level margin is −0.6 V; the low level still works with 1.1 V to spare.
A 5 V output (VOH 4.1 V, VOL 0.8 V) into a 3.3 V input that is not 5 V-tolerant (VIH 2 V, VIL 0.8 V, maximum 3.8 V): Not compatible: the input can see 5 V, above the receiver maximum 3.8 V. The levels would be read, but 5 V is above the 3.3 V + 0.5 V limit and can damage the input.
Open-drain output (VOL 0.4 V) with a 4.7 kΩ pull-up to 5 V into the ATmega328P at 5 V: Compatible: smallest margin 1.1 V. The pull-up sets the high level to 4.995 V and draws 978.7 µA while the line is low. The open-drain pin itself must tolerate 5 V.
Example 1 with a 470 Ω pull-up: Pull resistor too small: 6.17 mA exceeds the driver's 4 mA at VOL. The driver is specified for 4 mA at VOL; use at least 725 Ω.
Example 1 with a 2 MΩ pull-up: Pull resistor too large: idle level 1.3 V is below VIH 2 V. 1 µA of leakage drops 2 V across 2 MΩ; stay below 1.3 MΩ.
Texas Instruments: Understanding and Interpreting Standard-Logic Data Sheets (SZZA036B)
Texas Instruments: Selecting the Right Level-Translation Solution (SCEA035A)
Texas Instruments: I2C Bus Pullup Resistor Calculation (SLVA689A)
Microchip: ATmega328P data sheet, electrical characteristics (7810D)