An apparatus comprising: a lens barrel including at least one lens group; a base including an image sensor spaced apart from the lens barrel in an optical axis direction; a fixed frame fixed to the base, the fixed frame having four sidewalls (101, 102, 103, 104) including a first sidewall, a second sidewall, and a third sidewall, each having a hole (101a, 103a, 102a, 104a) for accommodating a first driving coil, a second driving coil, and a third driving coil (130a, 130b) respectively; a first moving frame, movably supported by the fixed frame in the optical axis direction, having a first magnet attached thereto, the first magnet moved by the first driving coil to move the first moving frame along the optical axis direction; a plurality of first ball bearings disposed between the fixed frame and the first moving frame, wherein a guide groove that guides the plurality of first ball bearings in the optical axis direction is formed in at least one of the fixed frame and the first moving frame; a second moving frame, movably supported in the first moving frame in a direction perpendicular to the optical axis direction, having the lens barrel mounted thereon, a second magnet attached thereto, the second magnet moved by the second driving coil to move the second moving frame along a first direction perpendicular to the optical axis direction, and a third magnet (241a, 241b) attached thereto, the third magnet moved by the third driving coil to move the second moving frame along a second direction perpendicular to the optical axis direction; a plurality of second ball bearings disposed between the first moving frame and the second moving frame wherein a guide groove that guides the plurality of second ball bearings in the first direction or the second direction is formed in at least one of the first moving frame and the second moving frame; a flexible printed circuit board, the flexible printed circuit board connected to the first driving coil, the second driving coil, and the third driving coil to provide current; a first sensor connected to the flexible printed circuit board and configured to detect a position of the first magnet along the optical axis direction; a second sensor connected to the flexible printed circuit board and configured to detect a position of the second magnet along the first direction; and a third sensor (161, 162) connected to the flexible printed circuit board and configured to detect a position of the third magnet along the second direction. a lens barrel including at least one lens group; a base including an image sensor spaced apart from the lens barrel in an optical axis direction; a fixed frame fixed to the base, the fixed frame having four sidewalls (101, 102, 103, 104) including a first sidewall, a second sidewall, and a third sidewall, each having a hole (101a, 103a, 102a, 104a) for accommodating a first driving coil, a second driving coil, and a third driving coil (130a, 130b) respectively; a first moving frame, movably supported by the fixed frame in the optical axis direction, having a first magnet attached thereto, the first magnet moved by the first driving coil to move the first moving frame along the optical axis direction; a plurality of first ball bearings disposed between the fixed frame and the first moving frame, wherein a guide groove that guides the plurality of first ball bearings in the optical axis direction is formed in at least one of the fixed frame and the first moving frame; a second moving frame, movably supported in the first moving frame in a direction perpendicular to the optical axis direction, having the lens barrel mounted thereon, a second magnet attached thereto, the second magnet moved by the second driving coil to move the second moving frame along a first direction perpendicular to the optical axis direction, and a third magnet (241a, 241b) attached thereto, the third magnet moved by the third driving coil to move the second moving frame along a second direction perpendicular to the optical axis direction; a plurality of second ball bearings disposed between the first moving frame and the second moving frame wherein a guide groove that guides the plurality of second ball bearings in the first direction or the second direction is formed in at least one of the first moving frame and the second moving frame; a flexible printed circuit board, the flexible printed circuit board connected to the first driving coil, the second driving coil, and the third driving coil to provide current; a first sensor connected to the flexible printed circuit board and configured to detect a position of the first magnet along the optical axis direction; a second sensor connected to the flexible printed circuit board and configured to detect a position of the second magnet along the first direction; and a third sensor (161, 162) connected to the flexible printed circuit board and configured to detect a position of the third magnet along the second direction.