Utilization of satellites to meet the needs of various missions requires a reliable Attitude Determination and Control System (ADCS). In this paper, we presents a robust design of the ADCS for the ESTCube-2 nanosatellite. The primary aim of the ADCS is to provide angular momentum to deploy a 300-meter tether used in a plasma brake deorbiting experiment. This is achieved by spinning up the three-unit CubeSat to 360 degrees per second about the short axis, deploying the tether and repeating the spin-up-deployment sequence until the whole tether is deployed. The system also provides accurate pointing for an Earth observation camera and a high-speed communication system. In addition to basic sensors and actuators commonly used on nanosatellites, the design includes a cold-gas propulsion system and a star tracker which will be tested for the future use in deep space. In order to operate the Earth observation and high-speed communication payloads, the satellite will use reaction wheels and the star tracker to achieve pointing the accuracy better than 0.25 degrees and the stability better than 0.125 degrees per second. To achieve the control requirements, a Lyapunov-based stability function and an optimal linear-quadratic regulator control is implemented. The attitude determination is handled by an unscented Kalman filter, which is deployed on a Cortex-M7 microcontroller. The ESTCube-2's plasma brake experiment in low Earth orbit serves as a precursor of ESTCube-3 which will test similar technology - the electric solar wind sail - for interplanetary propulsion in lunar orbit.