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 toolInteractive calculation is unavailable until JavaScript loads. The formulas, worked examples and references below remain available.
Calculate comparator switching thresholds and hysteresis from feedback resistors and output levels, or the resistors for a target window.
Choose the topology: the signal on the non-inverting (+) input, or on the inverting (−) input.
Choose Thresholds from resistors, or Resistors for a window.
Enter the comparator's real output high and low levels; for an open-collector output, V_OH is the pull-up voltage it reaches.
Enter the reference voltage and both resistors, or the two thresholds and your chosen R2. The R1 slider shows how R1 sets the width.
Read the thresholds, hysteresis and loop. Copy result copies the labeled values. Reset restores the starting example.
A comparator without hysteresis switches every time the input crosses the reference, so noise on a slow signal makes the output chatter. Positive feedback from the output to the non-inverting input moves the switching point after each change, which creates two thresholds.
In the non-inverting topology the signal reaches the + input through R1 and the output feeds back through R2. The input must rise above V_TH to switch the output high, then fall below V_TL to switch it low. The width is (V_OH − V_OL) × R1 ÷ R2.
In the inverting topology the signal drives the − input, and the + input is set by V_ref through R1 and the output through R2. The output goes low above V_TH and high again below V_TL. The width is (V_OH − V_OL) × R1 ÷ (R1 + R2), so it can never exceed the output swing.
Here R1 is always the resistor into the + input from the signal or the reference, and R2 is always the feedback resistor from the output. TI's application notes name the same two resistors differently, so match them by position, not by name. The thresholds depend on the output levels actually reached, and the window is generally not centered on V_ref.
Limitations: the comparator and the reference source are ideal, and the output levels are the values you enter; open-collector pull-up loading is not modelled. Input offset, propagation delay, built-in hysteresis, source resistance and resistor tolerance shift the thresholds. The tool suggests no standard resistor values.
Non-inverting thresholds: V_TH = V_ref × (1 + R1 ÷ R2) − V_OL × R1 ÷ R2; V_TL = V_ref × (1 + R1 ÷ R2) − V_OH × R1 ÷ R2.
Inverting thresholds: V_TH = (V_ref × R2 + V_OH × R1) ÷ (R1 + R2); V_TL = (V_ref × R2 + V_OL × R1) ÷ (R1 + R2).
Hysteresis: Non-inverting ΔV = (V_OH − V_OL) × R1 ÷ R2; inverting ΔV = (V_OH − V_OL) × R1 ÷ (R1 + R2).
Design, non-inverting: R1 ÷ R2 = (V_TH − V_TL) ÷ (V_OH − V_OL); V_ref = (V_TH + V_OL × R1 ÷ R2) ÷ (1 + R1 ÷ R2).
Design, inverting: m = (V_TH − V_TL) ÷ (V_OH − V_OL); R1 = m × R2 ÷ (1 − m); V_ref = (V_TH − V_OH × m) ÷ (1 − m).
Non-inverting, V_ref 2.5 V, R1 10 kΩ, R2 100 kΩ, output 0 V to 5 V: V_TH = 2.75 V, V_TL = 2.25 V, hysteresis 500 mV. Rising above 2.75 V switches the output high; it stays high until the input falls below 2.25 V.
Inverting, thresholds 3 V and 2 V, output 0 V to 5 V, R2 100 kΩ: R1 = 25 kΩ, V_ref = 2.5 V. m = 1 V ÷ 5 V = 0.2, so R1 = 0.2 × 100 kΩ ÷ 0.8.
Inverting, V_ref 1.65 V, R1 4.7 kΩ, R2 47 kΩ, output 0.2 V to 3.3 V: V_TH = 1.8 V, V_TL = 1.518 V, center 1.659 V. A nonzero low level and the inverting divider move the window off V_ref; entering 0 V for V_OL would give 1.5 V for V_TL.
Inverting, thresholds 5 V and 0 V, output 0 V to 5 V: No resistor pair fits. The inverting window is always narrower than the output swing; a 5 V window needs the non-inverting topology.
Texas Instruments: Comparator with Hysteresis Reference Design (TIDU020)
Texas Instruments: Non-Inverting Comparator with Hysteresis Circuit (SBOA313)
Texas Instruments: Inverting Comparator with Hysteresis Circuit (SNOA997)
Available now
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 tool →Available now
Add up to 20 resistors in series using Ω, kΩ or MΩ for circuit analysis and electricity calculations, with a diagram and running total.
Open tool →Available now
Convert absolute temperatures between Celsius, Fahrenheit and kelvin.
Open tool →Nice audio board working as expected.
Given the fact that this was my first purchase and I made it thinking I was buying genuine Yihua products, this has been a setback. I received a lesser known OEM brand called MYTO and while both the products seem to be similar from appearance, my real contention is the quality and quantity of the brass wool. On top of that not informing the customer about the unavailability of the Yihua product and instead sending a product from a different brand is also antagonising. Henceforth, I might just have to think twice before ordering from ThinkRobotics.
TOF MINIF Range Sensor - UART TOF Time-of-Flight Laser Range Sensor
We are disappointed with our recent order experience. We clearly communicated our requirement for 433 MHz antennas on WhatsApp, but the issue remains unresolved. We have been following up for more than 10 days and are still waiting for a proper refund resolution.
As a regular B2B customer, we expected better support. This experience has affected our trust in ThinkRobotics, and we may have to consider other suppliers for future purchases. We request a fair and prompt refund.
Anodised Aluminium Cup Head Washers (Pack of 10)