A lens module including a guide rod set, a first lens barrel movably
disposed on the guide rod set, at least one first lens disposed inside
the first lens barrel, a first optical grating connected to the first
lens barrel, a first position sensor, and a first voice coil motor is
provided. The first position sensor and the first voice coil motor are
disposed near the first lens barrel. The first position sensor has a
first light-emitting device and a first photosensor opposite to each
other, and the first grating is disposed between the first light-emitting
device and the first photosensor. Further, a first coil unit of the first
voice coil motor is connected to the first lens barrel. When a current is
provided into the first coil unit, the first lens barrel is driven to
move alone the guide rod set by the first coil unit.