An electronic device includes a lens system including four lens elements. the four lens elements are, in order from an outer side to an inner side, a first lens element, a second lens element, a third lens element and a fourth lens element. The second lens element has negative refractive power. The fourth lens element has positive refractive power. At least one surface of the four lens elements has at least one inflection point. A projection device and a detecting module of the electronic device including the lens system are also disclosed.