A detection device includes a light source which emits light, a lens, a light transmissive protecting plate, a length between the light source and the light transmissive protecting plate being larger than a length between the lens and the light transmissive protecting plate, and a light receiving element which receives the light. An angle formed by an optical axis of the lens and the light transmissive protecting plate is smaller than an angle formed by an optical axis of the light source and the transmissive protecting plate.