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 configured to accommodate a first driving coil, a second driving coil, and a third driving coil (130a, 130b) respectively; a first moving frame, movably supported with respect to the fixed frame in the optical axis direction, having a first magnet attached thereto, the first magnet configured to be moved by the first driving coil to move the first moving frame along the optical axis direction; a plurality of first balls disposed between the fixed frame and the first moving frame, wherein guide grooves that are configured to guide the plurality of first balls in the optical axis direction are formed in at least one of the fixed frame and the first moving frame; a second moving frame, movably supported with respect to 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 configured to be moved by the second driving coil to move the lens barrel along a first direction perpendicular to the optical axis direction, and a third magnet (241a, 241b) attached thereto, the third magnet configured to be moved by the third driving coil to move the lens barrel along a second direction perpendicular to the optical axis direction; a plurality of second balls disposed between the first moving frame and the second moving frame wherein guide grooves that are configured to guide the plurality of second balls in the first direction or the second direction are 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 configured to accommodate a first driving coil, a second driving coil, and a third driving coil (130a, 130b) respectively; a first moving frame, movably supported with respect to the fixed frame in the optical axis direction, having a first magnet attached thereto, the first magnet configured to be moved by the first driving coil to move the first moving frame along the optical axis direction; a plurality of first balls disposed between the fixed frame and the first moving frame, wherein guide grooves that are configured to guide the plurality of first balls in the optical axis direction are formed in at least one of the fixed frame and the first moving frame; a second moving frame, movably supported with respect to 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 configured to be moved by the second driving coil to move the lens barrel along a first direction perpendicular to the optical axis direction, and a third magnet (241a, 241b) attached thereto, the third magnet configured to be moved by the third driving coil to move the lens barrel along a second direction perpendicular to the optical axis direction; a plurality of second balls disposed between the first moving frame and the second moving frame wherein guide grooves that are configured to guide the plurality of second balls in the first direction or the second direction are 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.