Provided is a swallowable capsule for providing phototherapy to a patient's gastrointestinal (GI) tract, the capsule including a power supply, one or more phototherapeutic light sources, a speed determination unit for calculating speed of movement of the capsule in the GI tract, and a controller unit for activating one or more of the one or more light sources for delivering a therapeutic illumination dose to a target site in the GI tract, based, at least in part, on a determined speed. Related apparatus and methods are also described.