Closed-loop control systems for precise control of therapeutic gene expression are promising candidates for personalized treatment of chronic ailments such as diabetes. Pancreatic iβ-cells are engineered with blue-light-inducible melanopsin to drive rapid insulin release by vesicular secretion from intracellular stores. In this work, a glucose-operated widget (GLOW) is designed as a component of a closed-loop control system for diabetes treatment by employing a probe that emits blue fluorescence in a glucose-concentration-dependent manner as a real-time glucose sensor to precisely control insulin release from these iβ-cells. As proof-of-concept of the complete control system, the probe is encapsulated together with iβ-cells in alginate-poly-(L-lysine) hydrogel-microbeads(400µm in diameter and containing about 500 cells) called GLOWiβ (GLOW with iβ-cells), are subcutaneously implanted into type-1-diabetic (T1D) mice. Illumination by UV-A light at 390nm results in glucose-concentration-dependent blue-light emission from the probe at 445nm that in turn induces glucose-concentration-dependent insulin release from the iβ-cells in a fully reversible manner. Activation of the injected GLOWiβ at 390nm for 15 min effectively restores normoglycemia within 60-120 min in a closed-loop manner in these diabetic mice. The system is robust, as normoglycemia is well maintained by daily activation for at least 7 days.