TryCompare Your GPIO Max Current (mA) at 25 with Relay Coil Current (mA) at 70, then move either slider.
ObserveAt 25 mA versus 70 mA, Safety Check reads UNSAFE and Safety Margin is 0.36×.
ExplainThe check divides Your GPIO Max Current (mA) by Relay Coil Current (mA) and accepts a current limit at least as large as the coil demand.
Technical boundaries. This comparison assumes the entered current ratings are sufficient to judge the result; voltage and switching transients are not calculated. The recommendation uses a margin threshold of 1.5 and still recommends a driver above it.
Interactive: Can Your GPIO Drive This Relay?
viewof gpio_max_current = Inputs.range([10,50], {value:25,step:1,label:"Your GPIO Max Current (mA)"})viewof relay_coil_current = Inputs.range([30,150], {value:70,step:5,label:"Relay Coil Current (mA)"})
html`<div style="background: var(--bs-light, #f8f9fa); padding: 1rem; border-radius: 8px; border-left: 4px solid ${gpio_safe ?'#28a745':'#dc3545'}; margin-top: 0.5rem;"><p><strong>Safety Check:</strong> ${gpio_safe ?'✓ SAFE':'✗ UNSAFE'}</p><p><strong>Safety Margin:</strong> ${safety_margin.toFixed(2)}× ${safety_margin <1?'(GPIO will be damaged!)': safety_margin <1.5?'(Too close - use transistor driver!)':'(Technically safe but driver still recommended)'}</p><p><strong>Recommendation:</strong> ${gpio_safe && safety_margin >=1.5?'GPIO can drive this relay, but best practice is to always use a transistor driver for reliability.':'You MUST use a transistor or MOSFET driver circuit.'}</p></div>`