.calculator-widget-container {
font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
background: #ffffff;
border: 1px solid #e0e0e0;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
padding: 20px;
color: #333;
}
.calc-header {
text-align: center;
margin-bottom: 25px;
border-bottom: 2px solid #0073aa;
padding-bottom: 15px;
}
.calc-header h2 {
margin: 0;
color: #0073aa;
font-size: 24px;
}
.calc-input-row {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 20px;
align-items: flex-end;
}
.calc-input-group {
flex: 1;
min-width: 200px;
display: flex;
flex-direction: column;
}
.calc-input-group label {
font-weight: 600;
margin-bottom: 8px;
font-size: 14px;
color: #555;
}
.calc-input-group input, .calc-input-group select {
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
transition: border-color 0.3s;
}
.calc-input-group input:focus, .calc-input-group select:focus {
border-color: #0073aa;
outline: none;
}
.calc-btn {
width: 100%;
background-color: #0073aa;
color: white;
padding: 15px;
border: none;
border-radius: 4px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: background 0.2s;
margin-top: 10px;
}
.calc-btn:hover {
background-color: #005177;
}
.calc-result-box {
background-color: #f9f9f9;
border: 1px solid #eee;
border-radius: 6px;
padding: 20px;
margin-top: 25px;
display: none;
}
.calc-result-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
padding-bottom: 10px;
border-bottom: 1px solid #e0e0e0;
}
.calc-result-row:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}
.result-label {
font-size: 16px;
color: #666;
}
.result-value {
font-size: 20px;
font-weight: bold;
color: #0073aa;
}
.result-main {
text-align: center;
font-size: 32px;
color: #27ae60;
margin: 15px 0;
}
.error-msg {
color: #e74c3c;
text-align: center;
font-weight: bold;
display: none;
margin-top: 10px;
}
.content-section {
margin-top: 40px;
line-height: 1.6;
color: #444;
}
.content-section h3 {
color: #333;
border-left: 4px solid #0073aa;
padding-left: 10px;
margin-top: 30px;
}
.formula-box {
background: #f0f7fb;
padding: 15px;
border-left: 3px solid #0073aa;
font-family: monospace;
margin: 15px 0;
font-size: 1.1em;
}
@media (max-width: 600px) {
.calc-input-row {
flex-direction: column;
gap: 15px;
}
}
What is Duty Cycle?
Duty cycle is a measure of the fraction of time a signal is "active" or "high" during a single period of operation. It is most commonly used in electronics and telecommunications to describe pulse-width modulation (PWM) signals, which control power to devices like motors, LEDs, and servos.
Duty Cycle Formula
The duty cycle ($D$) is calculated as the ratio of the Pulse Width ($t_{on}$) to the Total Period ($T$) of the signal.
Duty Cycle (%) = ($t_{on}$ / $T$) × 100%
Where:
- $t_{on}$: The duration the signal is active (Pulse Width).
- $T$: The total time for one complete cycle (Period).
Calculating with Frequency
Since frequency ($f$) is the inverse of the period ($T = 1/f$), you can also calculate duty cycle if you know the frequency and the pulse width:
Duty Cycle (%) = $t_{on}$ × $f$ × 100%
Note: Ensure your units for time and frequency are compatible (e.g., seconds and Hertz) before calculating.
Common Examples
- 50% Duty Cycle: The signal is high for half the time and low for half the time (a perfect square wave).
- 10% Duty Cycle: The signal is on for a short burst (10% of the time) and off for the majority (90%) of the cycle.
- 100% Duty Cycle: The signal is continuously on (DC voltage).