1 Introduction

CubeSats are considered extraordinary satellites innovation in astronautics field due to their light weight, short advancement cycle, low improvement cost, high functional density, and adaptable outflow attributes. These CubeSats are described as a class of nanosatellites ranging from 10 × 10 × 10 cm and upwards in 10 cm increments of length [1, 2].

Generally, flexibility considered as “a ready capability to adapt to new, different, or changing requirements” [3]. The desires for CubeSats have incessantly improved through new areas of application, as indicating in the reflective of scientific evolution. In the last decade, this tendency has been enhanced through developments in contracted technology, CubeSat constellations and creations emerged to perform scientific and commercial missions. These missions commonly enforce great desires for precise ADCS, as well should consider time to market and economic efficiency. The ADCS comprises the hardware and software; the hardware includes the sun sensors, actuators, magnetometer, gyroscope, and system computer. Meanwhile, the software is programed or coded into the ADCS computer that holds the whole algorithms and the control schemes of the ADCS. The resolution of the ADCS is increased to around 0.6 m in the former 10 years [4]. The cubesat U-class spacecraft belongs to a category of reduced satellites that is mainly used in research and comprises several cubic elements. Moreover, the single largest step in reducing Hardware cost is the usage of commercial, off-the-shelf (COTS) [5]. CubeSats usually employ commercial-on-the-shelf (COTS) in their structure, electronics design, and weights around 1.3 kg/unit [6]. For the control of the CubeSat, there are three phases after launch: de-tumbling, initial attitude determination, and recursive attitude determination. As the most prevalently used algorithms in satellite de-tumbling process, B-Dot controller controls the satellite by aligning it with the earth magnetic field vectors. Indeed, all small satellites use some variation of B-Dot as the controller for de-tumbling process [7].

TRIAD method is one of the initial and simplest solutions to the CubeSat attitude determination problem. This technique entails two sets of vectors: an observation vector from magnetometer and sun sensors, and a vector command for each observation according to its inertial reference frame. In 1977, Davenport presented the first successful application of Wahba’s problem to spacecraft attitude determination in [8] using the quaternion parameterization of the DCM with the q-Method algorithm. In 1979 [9], the QUaternion estimator (QUEST) algorithm appeared as an alternative to the q-method. Although less robust than the q-method, QUEST is the most used algorithm for Wahba’s problem [10]. Many other solutions to Wahba’s problem have been developed since then. A valuable summary on the development of other static attitude determination methods is presented in [11].

QUEST’s popularity, however, has not been trumped due to its adequacy for implementation in on-board processors. Moreover, for the past 15 years, the extended Kalman filter (EKF) has been the prime choice in ADCS designs for CubeSats [12]. In [13], an excellent review of several nonlinear attitude estimation methods which have been arising in an attempt to obtain a better performance relative to the EKF has been presented. The first belongs to the realm of unscented filtering, which shows a performance improvement in terms of convergence properties. Unscented filtering has also been studied for CubeSat attitude estimation [14]. The second is part of a category termed two-step filtering. The two-step filter divides the estimation process into a first-step that uses an auxiliary state in which the measurement model is linear and an iterative second-step to recover the desired attitude states. While both these approaches have some basis in Kalman filtering and acknowledge the stochastic properties of the measurements, the third alternative approach belongs to the realm of nonlinear observers, which are formulated solely in terms of the attitude error dynamics.

In this paper, a hardware implementation of flexible and low-cost attitude determination and control system (ADCS) for two-axis-stabilized CubeSat is presented. CubeSat requires precise ADCS with attitude drift adjustment. This attitude drift if not properly compensated, will cause a slow attitude information loss as the error in attitude rises between the actual and estimated. The proposed ADCS comprises two parts; the attitude determination which estimates the current CubeSat’s attitude and a novel simplified intelligent proportional-integral (SI PI) attitude control algorithm to accurately adjust the attitude. The control algorithm is based on the multi degree-of-freedom controller concept and has no controller gain parameters. The proposed ADCS employs sun sensor, magnetometer, and a MEMS gyroscope sensor to correct the attitude adrift by offering a comparative attitude that is utilized for updating the estimated attitude delivered to the Kalman filter for determining the CubeSat’s attitude and angular velocity. The ADCS model verification and validation are accomplished via Matlab/Simulink and hardware implementation. A Comparison with other ADCS systems is presented. The ADCS simulated model demonstrates precision results with error of less than 0.1°.

The main contributions of this paper are summarized as:

  1. 1.

    A novel simplified intelligent proportional-integral (SI PI) control algorithm that accurately adjusts the CubeSat’s attitude is presented without any controller gains parameters.

  2. 2.

    The proposed ADCS for the CubeSat has been implemented experimentally with a hardware testbed and via Simulink on Matlab environment.

The proposed ADCS technique has been compared with other ADCS and this comparison has been summarized in Table 3 which reveals that the proposed ADCS has less complexity of real time implementation, simpler structure, less cost of implementation, less attitude control complexity, and less attitude error compared with other ADCS techniques.

This paper is organized as follows: Sect. 2 presents the system description. Section 3 presents the ADCS system modeling. Section 4 presents the mechanical system design. Both the simulation and the experimental results of the ADCS for the CubeSat are addressed in Sects. 5 and 6, respectively. Section 7 presents a comparison between the proposed ADCS and other ADCS techniques and Sect. 8 concludes the paper.

2 System Description

2.1 The CubeSat Structure

The nanosatellite U-class spacecraft belongs to a category of reduced satellites that is mainly used in research and consists of many cubic elements. The used nanosatellite in this paper follows the CubeSat standard for 3U CubeSat structure as shown in Fig. 1.

Fig. 1
figure 1

The CubeSat structure and the body coordinate frame

The CubeSat weigh is around 3.2 kg and the body consists of a rectangular prism with dimensions of 300 × 100 × 100 mm module. The solar panels are placed on 5 of its 6 sides and the other side is reserved for the coordinate frame. The significant aspects that must be considered in the CubeSat design are the low power consumption and continuing modularity in the subsystems. Moreover, another key factor has been dealing with the concession between adding up redundancy in vital parts though keeping complexity at a reasonable level.

2.2 The ADCS Structure

The ADCS is vital in CubeSats applications as it is the sub-system which controls the CubeSat orientation in space [14]. The ADCS comprises actuators, sensors, and microcontroller with algorithms. The main goal of the ADCS is to capture the initial random rotation and angular momentum through the completion of the deployment, determine the attitude of the CubeSat and maintain or vary the CubeSat attitude according to the information about the CubeSat. On some CubeSats, a pointing requisite may exist in the payload for operation or accustomed to preserve the CubeSat’s attitude as the solar cell wings are directed to the sun. The expression attitude denotes the CubeSat orientation in a certain reference frame. Figure 2 depicts the system level diagram of ADCS. The ADCS determines the CubeSat attitude drift precisely and sustains stability for extended periods of time to enable pointing prerequisite for operation in clear images. Moreover, the attitude determination is the measurement of the rotation from pre-defined standstill orientation. This rotation can be measured via sensors which measure the sun direction or the stars direction in the form of the 3D vector.

Fig. 2
figure 2

The system level block diagram of the ADCS with the SI PI attitude control

Furthermore, the attitude estimation is obtained via the combing information from two sensors and compare how the measured signals are within the expected values at the standstill position.

2.3 The Attitude Determination Process

To define the attitude and position of any CubeSat, its orientation and location comparative to a well-known celestial body frame of reference should be first determined by selecting one or more reference vectors that the CubeSat position and attitude can be referenced. By defining the orientation of two or more of these vectors comparative to the CubeSat axes, the orientation of the spacecraft in space is determined. Similarly, the CubeSat’s position can be determined from numerous reference vectors using the triangulation. The system design undertakes a primary state when the CubeSat has a full absence of information concerning its attitude in space; the state that every CubeSat confronts once deployed from a launch rocket or instantaneously when the full system start over. Figure 3 illustrates the ADCS schematic diagram for the CubeSat. The ADCS process begins by making use of the CubeSat’s solar panels to act as a coarse sun sensor. The CubeSat electrical power system delivers telemetry to the chief CubeSat’s PC which detects the current and voltage signals from each solar panel exists on the CubeSat which defines the position of sun comparative to the CubeSat various faces. Accordingly, the solar cells are used as a coarse sun sensor that gives imprecise data concerning the comparative position of sun direction.

Fig. 3
figure 3

The CubeSat ADCS schematic diagram

The coarse sun sensor assists the CubeSat to adjust its position to gain the extremely precise sun sensor field of view (FOV). Consequently, the CubeSat commands on-board actuator, like the reaction wheels and magnetorquers to produce a torque, thus the CubeSat rotates to make the sun sensor obtains the sun vector precisely. This action does not need accuracy because the sun sensors are offered with FOV of around 114° and 10 Hz update rate, hence, the CubeSat just requires a moderate swivel to move the sensor into the FOV of sun [14]. The second vector is obtained via the usage of the on-board magnetometer as well as the sun vector is obtained from sun sensor. The two vectors are used by the TRIAD algorithm to determine the absolute attitude. The TRIAD algorithm has to be fed with the reference vectors compatible with the two measured vectors. The two reference vectors are calculated using CubeSat software models and these calculations need precise information about the CubeSat’s present location.

The CubeSat’s current location is determined in two different methods, either via GPS onboard module or by precise information of the CubeSat’s orbit with the present time. As soon as the CubeSat’s current location is identified, the sun reference vector and the magnetic field vector are then calculated by giving a set of two vectors beside the corresponding reference vectors which allow the TRIAD algorithm to identify the absolute attitude needed for the KF to transmit this attitude to preserve the CubeSat’s attitude information. In order to transmit the attitude, the CubeSat has to comprise a gyroscope to measure the angular rotation rate. This angular rotation rate is then filtered for obtaining a smooth signal via low pass filter to recompense random noise from the output of the gyroscope sensor. To get the attitude, the KF is used afterwards to integrate the angular rate.

3 The ADCS System Modelling

3.1 The Attitude Control Using SI PI Controller

The SI PI controller is implemented to regulate the attitude of the CubeSat by comparing the desired attitude with the calculated attitude from the attitude determination algorithm and generates the control signals for the actuators. The SI PI consists of two terms as in (1) and (2):

$$P = K_{p} *(desired\_attitude - calculated\_attitude)$$
(1)
$$I = K_{I} *\int {(desired\_attitude - calculated\_attitude).dt}$$
(2)

where Kp and Ki are the conventional PI controller proportional and integral gains, respectively. The proposed SI PI controller eliminates the need for the Kp and Ki by using (3) and (4) as follows:

$$K_{p} = abs(desired\_attitude - calculated\_attitude)$$
(3)
$$K_{I} = abs\left( {\int {(desired\_attitude - calculated\_attitude).dt} } \right)$$
(4)

From (3) and (4), it is clear that the control algorithm has no controller gain parameters and has simple design structure. According to Fig. 4, the stability analysis of the SI PI controller is performed as follows:

$$GH = \frac{{L(I + P \times S + D \times S^{2} )}}{{S(S^{2} + g \times S + L)}}$$
(5)

where P, I, D are the SI PI controller gains and L, g are constants.

Fig. 4
figure 4

The second order system closed loop with the SI PI controller

From (5), the characteristics equation can be expressed by (6):

$$1 + GH = 0$$
(6)
$$S^{3} + (g + L \times D)S^{2} + L(1 + P)S + L \times I = 0$$
(7)

By using Routh’s stability analysis, the following conditions which make the system stable are expressed in (8):

$$\left\{ {\begin{array}{*{20}c} {D \ge \frac{ - g}{L}} \\ {I \ge 0} \\ {(g + L \times D) \times (1 + P) - I \ge 0} \\ \end{array} } \right.$$
(8)

The first and second conditions are substantiated as P, I and D are ≥ 0 and the third condition is substantiated via applying initial and final values.

3.2 The Gyroscope Model

The gyroscope should be selected to fulfil the minimum technical requirements as follows [15]:

  • The angular velocity measuring range should be within 8.5°/s which is distinct via the CubeSat’s range of angular velocities when split-up from the P-POD.

  • The random error should not exceed the sensitivity threshold of the device, not over 0.005°.

  • The angular velocity minimum measurement (sensitivity) not worse than 0.005°/s (three-Sigma) that is defined by the precision necessities for CubeSat ADCS and angular stabilization requisite for CubeSat in the imaging mode.

The mathematical gyroscope model is expressed by (9) [16]:

$$\omega_{F} = \omega + \xi^{\omega }$$
(9)

where ωF is the gyroscope’s output, absolute angular velocity of the CubeSat which measured in the body coordinate system (BCS) in place of the gyroscope alignment with BCS, ω is the CubeSat’s absolute angular velocity, and ζω is the gyroscope vector of measurement errors.

3.3 Extended Kalman Filter

The process of determining the attitude estimation in CubeSats can be divided into two stages, stage one is the attitude estimation through the system models proposed meanwhile stage two enhances the estimated attitude via CubeSat sensor measurements and reference observations such as the magnetic field Ref. [17]. In 1960, the Kalman filter was introduced by Kalman. This algorithm had been developed for processing the noisy signal and sensor measurements to precisely predict motion. Kalman filter algorithm is an arrangement of mathematical equations which gives a recursive technique that estimates the state of a process whereas reducing the error signal in the framework. Figure 5 depicts the substantiation of the mechanics of Kalman filter algorithm. The Kalman filter is generally used as an estimator in various applications e.g. aircrafts, ships, continuous manufacturing processes, and nanosatellites. Also used for estimating the instantaneous angular rate according to the highly frequent input data. In addition Kalman filter is used for compensating the noise of the sensor slightly. The Mathematical representation of the linear Kalman filter can be expressed as [18]:

$$\frac{{dx}}{dt} = Fx + Gu + \varphi$$
(10)
$$z(t) = Hx + v$$
(11)

where F represents the system matrix and G embodies the input matrix. The vectors x and u represent the state quantities and the input quantities, respectively as in (12) and (13).

$$x = \left[ {\begin{array}{*{20}c} {\omega_{x} } & {\omega_{y} } & {\frac{{d\omega_{x} }}{dt}} & {\frac{{d\omega_{y} }}{dt}} \\ \end{array} } \right]^{T}$$
(12)
$$u = \left[ {\begin{array}{*{20}c} 0 & 0 \\ \end{array} } \right]^{T}$$
(13)
$$f(x) = \omega .dt$$
(14)
$$h(x) = x$$
(15)

where ωx, ωy are the angular rate of the CubeSat in the xy axes and x/dt, y/dt are the acceleration rates of the CubeSat in the xy axes. The H matrix represents the observation matrix and z represents the measured quantities vector. From (12) to (14), the system matrix F can be represented by (16) [18]:

$$F = \left[ {\begin{array}{*{20}c} 0 & A \\ 0 & 0 \\ \end{array} } \right]$$
(16)

where A is the identity matrix and from (15), the observation matrix H can be represented by (17) [18]:

$$H = A$$
(17)
Fig. 5
figure 5

The Kalman filter procedure for congregating on a true state vector

The vector ϕ embraces the disturbance inside the system identification in white noise representation and v represents the measurement disturbance. The matrices Q and R represent the system and measurement noise and can be expressed in (18) and (19), respectively [18]:

$$Q = E\left( {\phi \phi^{T} } \right)$$
(18)
$$R = E(vv^{T} )$$
(19)

For the first stage in the system implementation, the fundamental matrix is represented by using the inverse Laplace transform in (20) [18]:

$$\varepsilon (t) = L^{ - 1} \left[ {\left( {s.A - F} \right)^{ - 1} } \right]$$
(20)

where s is a scalar part. Equation (16) can be approximated by a Taylor series as in (21) [18]:

$$\varepsilon (t) = A + F.t + \frac{{(F.t)^{2} }}{2!} + \cdots + \frac{{(F.t)^{n} }}{n!}$$
(21)

The Kalman filter comprises two stages: update and prediction. The prediction estimates the state quantities for a point in time (k) according to the updated assessment from the previous one (k − 1) via the fundamental matrix that defines the system’s dynamics for estimating the values in the sample rate ts [18]:

$$\hat{x}_{k}^{ - } = \varepsilon_{k} \hat{x}_{k - 1}^{ + } + G_{k} u_{k - 1}$$
(22)
$$\mathop P\nolimits^{ - }_{k} = \varepsilon_{k} \mathop P\limits^{ \wedge + }_{k - 1} \varepsilon_{k}^{T} + Q_{k}$$
(23)

where \(\mathop {x_{k} }\limits^{ \wedge - }\) represents the predicted state vector at k meanwhile \(\mathop {P_{k} }\limits^{ - }\) represents the covariance matrix of the prediction. In the subsequent step, the predicted quantities are updated through a measurement zk [18].

$$K_{k} = \bar{P}_{k} H^{T} \left( {H\bar{P}_{k} H^{T} + P_{k} } \right)^{ - 1}$$
(24)
$$\mathop {P_{k} }\limits^{ + } = \left( {E - K_{k} H} \right)\bar{P}_{k}$$
(25)
$$\hat{x}_{k}^{ + } = \hat{x}_{k}^{ - } + K_{k} \left( {z_{k} - H\hat{x}_{k}^{ - } - HG_{k} u_{k - 1} } \right)$$
(26)
$$\hat{x}_{k}^{ + } = \hat{x}_{k}^{ - } + K_{k} i_{k}$$
(27)

where P+k is the covariance matrix after the update meanwhile holds the updated state quantities. The matrix Kk represents the Kalman gain matrix, and ik denotes the innovation.

3.4 The MEMS Gyroscopes

The gyroscopes are type of sensors fixed to a frame to detect angular velocity if the frame spins. They are utilized to track the variation in orientation from an identified point for attitude propagation. It is conceivable to keep attitude knowledge via the propagation from a predefined reference point. The mechanical gyroscopes are not feasible to be used due to the mass and power limitations of cubesats. The MEMS gyroscope is responsible for providing the angular rate output which then integrated to identify the CubeSat’s orientation.

The MEMS gyroscope contains a capacitive-sensing electrode and micro-machined silicon structure that alongside acts as a proof mass. A miniature piezoelectric oscillating mass is generally used in the MEMS gyroscopes instead of using spinning mass. As a result of motion disturbs the mass, motion initiated by a centrifugal force is associated with the angular motion which is called the Coriolis Effect. Even though MEMS gyroscopes are compact and have the merit of low power depletion, they have an issue that is called the drift. This drift is caused by the thermal deviations that lead to mechanical properties fluctuation of the vibrating thermal mass over time, primary causing a systematic error. The magnetometer measurement can be expressed by (28) [19]:

$$\mathop {b = }\limits^{ \approx } \left[ {\begin{array}{*{20}c} {\mathop {b_{x} }\limits^{ \approx } } \\ {\mathop {b_{y} }\limits^{ \approx } } \\ \end{array} } \right] = (1 + S)b + Mb + B_{f} + n$$
(28)

where S and Bf represent the scale factor and the measurement bias vectors, respectively, n represents the random noise, and M is the cross-axis coupling matrix as in (29).

$$M = \left[ {\begin{array}{*{20}c} {M_{x} } & {M_{xy} } \\ {M_{yx} } & {M_{y} } \\ \end{array} } \right]$$
(29)

where Mx, My are the spring constants and Mxy and Myx are the coupling spring constants. It is supposed that the magnetometer cross-axis coupling is irrelevant. Therefore, the error model is simplified as in (30) [19]:

$$\mathop b\limits^{ \approx } = (1 + S)b + B_{f} + n$$
(30)

The scale factor and the bias are modeled as a 1st Gauss–Markov process. The Gaussian process has an exponential auto-correlation as in (31) [19]:

$$R_{bb} (\tau ) = \sigma_{b}^{2} e^{{ - \beta_{1} \left| \tau \right|}}$$
(31)

where \(\sigma_{b}^{2}\) represents the mean-square value of the noise covariance and β1 represents the time constant. The bias model is obtained from (32) [19]:

$$\mathop {b(t)}\limits^{.} = - \beta_{1} b(t) + \sqrt {2\beta_{1} \sigma_{b}^{2} } W(t)$$
(32)

where W(t) represents the white random noise. The scale factor and the bias errors can be correlated to whichever hard-iron or soft-iron distortions.

3.5 The Magnetometer

The magnetometer is used for measuring the geomagnetic field strength vector. However, the measured vector is compared with an on-board location map of the Earth’s magnetic field for defining CubeSat’s attitude. For LEO implementations, this sensor is preferable for its low-cost, lighter weight, and reliable attitude sensor. The Earth’s magnetic field B can be embodied as the gradient of the scalar potential function V as in (33) [20]:

$$B = - \Delta V$$
(33)

V can be represented by a series of spherical harmonics as in (34) [20]:

$$V\left( {R,\theta ,\lambda } \right) = R_{e} \sum\limits_{n = 1}^{k} {\left( {\frac{{R_{e} }}{R}} \right)}^{n + 1} \sum\limits_{m = 0}^{n} {\left( {g_{n}^{m} \cos \left( {m\lambda } \right) + h_{n}^{m} \sin \left( {m\lambda } \right)} \right).} P_{n}^{m} \left( \theta \right)$$
(34)

where Re represents the equatorial radius of Earth, \(g_{n}^{m}\) and \(h_{n}^{m}\) represent the Gaussian coefficients, and R, θ, and λ represent the geocentric distance, co-elevation, and east longitude from Greenwich, respectively.

3.6 The Attitude Representation

In this paper, the attitude can be represented by quaternions as they have less computational potential than Euler angles and direction cosine matrices (DCMs), in addition to they do not involve singularities. The quaternion comprises a vector quantity (\(\mathop v\limits^{ \to }\)) and a scalar quantity (s) which are represented by a 3 × 1 matrix (q). The scalar quantity is the first element of q as in (35) [21]:

$$q = \left[ {\begin{array}{*{20}c} s \\ {\mathop v\limits^{ \to } } \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} s \\ {v_{x} } \\ {v_{y} } \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} {q_{s} } \\ {q_{x} } \\ {q_{y} } \\ \end{array} } \right]$$
(35)

The quaternions can be employed for the transformation of a vector from one coordinate system into another or spinning a vector in the similar coordinate system. For both circumstances, the scalar part embodies the angle meanwhile the vector part embodies the axis of transformation, respectively. In case of transforming from coordinate system A to B, the giving quaternion in (36) is applied [21]:

$$q_{B \leftarrow A} = \left[ {\begin{array}{*{20}c} s \\ {\mathop v\limits^{ \to } } \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} {\cos \alpha /2} \\ {\mathop e\limits^{ \to } .\sin \alpha /2} \\ \end{array} } \right]$$
(36)

where α is the rotating angle meanwhile \(\mathop e\limits^{ \to }\) refers to the stabilized vector of the rotational axis. The rotation direction of the axis or the angle can be inverted by changing the sign. If both altered their sign, the quaternion will fluctuate from the original one and on the other hand the denoted orientation will be identical. The norm of the quaternion can be set from (37) [21]:

$$\left| q \right| = \sqrt {q_{s}^{2} + q_{x}^{2} + q_{y}^{2} }$$
(37)

3.7 Triad Algorithm and Attitude Drift

The attitude drift is the decay in the attitude propagated result from the previous absolute attitude repair provided by TRIAD. This indicates that error in attitude is gradually mounted up by time. The attitude determination structure compromises a gyroscope and a KF. At t = 0, the KF starts to integrate the gyroscope outputs after receiving the absolute attitude. Generally, the attitude error is minimal at first, but increases quickly after 1000 s, or nearby 16 min. Ultimately, the attitude error increases and the attitude knowledge is lost. The traditional technique for solving this drawback on big Satellites is to appraise estimated attitude intermittently via the TRIAD algorithm in (38) [22]:

$$\left| {\xi_{i}^{\omega } } \right| \le \delta_{i}^{\omega }$$
(38)

where i = x, y and δωi parameters are acquired from the accuracy of measurement i of the gyro channel.

3.8 The Energy Consumption

For the ADCS design, it is important to consider the energy consumption under different operating conditions. The power consumption of the proposed ADCS is determined via measuring the current drained from the battery. A resistor of 1.8 Ω is placed in series between the ADCS and the battery. The current flowing through the resistor can be calculated via measuring the voltage drop over the resistor. The ADCS power consumption is mean somewhere between 170 mW (run mode) and 130 mW (sleep mode) most of time as it is either executes the control loop or in sleeping mode.

4 Mechanical System Design

The mechanical system design is vital for positioning the solar sail to generate a control torque around the body XB (roll) and ZB (yaw) axes. This arrangement is desirable for moving in two orthogonal directions, thus, manipulating the solar pressure induced torque through controlling the centre-of-pressure (CoP) to centre-of-mass (CoM) vector.

The intrinsic requisite of the arrangement aims to be stable and lightweight. This arrangement is significant as the weightier the CubeSat becomes, the less operative any positioning control systems become. The specs for the arrangement are addressed in Table 1. The volume, mass, and range of the system are characterized as the critical objectives for the design phase.

Table 1 Mechanical design specifications

4.1 The Stepper Motor

The stepper motor driver is an H-bridge configuration which controls the motor by passing desired voltage through the motor windings. In this paper, a bi-polar (has two windings to magnetize the core) stepper motor is used, so a total of 4 wires (2 for each winding) come as power cables as depicted in Fig. 6. A4988 stepper motor driver carrier was used to power the stepper motors. The driver has 5 steps of operations as illustrated in Table 2. STEP pin is connected to the pulse width modulation (PWM) output of the microcontroller which also provides a pulsating highs and lows. The PWM signals are used for driving the stepper motor to make it rotate with a fixed angle in consistent with the set direction and control the angular displacement via controlling the number of the pulses. The DIR pin changes the direction of the stepper motor in the desired direction. To enable the driver pins, STEP and RESET are connected with each other as instructed by the manufacturer. The stepper motor used has 1.8° step revolution or rotation resolution, so 200 steps with 1.8° displacement will give one full revolution of the motor shaft. The step size is decided based on the PINs available on board namely MS1, MS2, and MS3. The microstep resolution is adjusted by the voltage on the logic inputs for MS1, MS2, and MS3. For the full step mode, the MS1, MS2, and MS3 are connected to controller logic (low) as illustrated in Table 2.

Fig. 6
figure 6

Stepper motor control circuit

Table 2 Step resolution of the driver

4.2 The Reaction Wheel

The CubeSat utilizes a reaction wheel to rotate the CubeSat through angular momentum exchange.

The reaction wheel comprises an electric motor and a circular mass attached to the rotor. By fixing the motor to the CubeSat, a torque on the CubeSat can be created by spinning up the circular mass in an action-reaction manner. As well as having to change the CubeSat attitude towards a desired reference, the system will also have to compensate disturbance torques at every moment and also make the spacecraft rotate at the same rate as it does around the Earth to preserve the nadir pointing. This means that each wheel has to periodically accelerate and decelerate in a sinusoidal manner to keep the angular momentum constant in the inertial reference frame as the CubeSat rotates around the earth. In order to maintain a rotational speed, the motor will need to apply a constant torque onto the CubeSat to counter frictional torque, which constantly spins up the reaction wheel. This introduces the problem of saturation, where the system reaches its max capable momentum exchange.

5 Simulation Results

This section presents the different sensors Simulink modelling for the ADCS using the SI PI controller. The parameters of the scaling factors are given as:\(S = \left[ {\begin{array}{*{20}c} {4.22 \times 10 - 5} & 0 \\ 0 & {5.93 \times 10 - 5} \\ \end{array} } \right]\) and the bias vectors values are given as: \(B_{f} = \left[ {\begin{array}{*{20}c} {0.19} \\ {0.405} \\ \end{array} } \right]\).

5.1 The Gyroscope Model

The gyroscope Simulink model is developed and tested to provide high precision and more realistic results. The system is experimentally implemented to obtain the results which consist of a MEMS analogue gyroscope sensor LPR403AL that is imbedded in the adapter board STEVAL-MKI099V1 and mounted on the STEVAL-MKI109V2 motherboard. A set of hardware is then interfaced to a laptop that has the UNICO graphical user interface (GUI) installed. Figure 7 depicts the gyroscope sensor output error at standstill (zero input) and this error must be calculated and modeled to give more accurate and realistic results.

Fig. 7
figure 7

The gyroscope output error at standstill (zero input)

5.2 The Stepper Motor Model

The time for simulation execution is selected to be 0.25 s consistent with the signals from Signal Builder block and set time in Simulink model. From the simulation results presented in Figs. 8, 9, 10 and 11, it can be noticed that the stepper motor moves in one direction for 0.1 s (STEP = 1 and DIR = 1), stops in period from 0.1 to 1.5 s (STEP = 0, DIR = 0) 0.05 s rotates in the opposite direction (STEP = 1, DIR = 0) and finally stops for 0.05 s (STEP = 0 and DIR = 0). The stepper motor transient performance characteristics are illustrated in Figs. 8, 9, 10 and 11 at no load operation. With sufficient zooming of the Matlab results in Figs. 8, 9, 10 and 11, it can be concluded that stepper motor reached the speed of 200 rad/s and moved from position 0° to 98°. It stays in that position for 0.052 s before it reaches 0.156 s to change its direction and it stops at 0.204 s on position 47°.

Fig. 8
figure 8

The stepper motor phase currents

Fig. 9
figure 9

The electromagnetic torque

Fig. 10
figure 10

Stepper motor angular speed

Fig. 11
figure 11

The stepper motor position angle

5.3 The ADCS Results

Figure 12 shows the ADCS by the smoothing filter. The attitude results are enhanced due to the usage of the smoothing filter which is applied to the gyro measured output, nevertheless still not precise adequate for obtaining the actual attitude. The Kalman filter compensates and minimizes the error between the actual attitude and the measured attitude via the MEMS gyroscope. The Kalman and the smoothing filters are used in the attitude determination process and the result is depicted in Fig. 13. After connecting the Kalman filter to the smoothing filter output that is connected to the gyroscope measured output, it can be observed that the error between the measured gyroscope output and the actual attitude is minimized with less than 0.1° steady-state error. Figure 14 depicts the ADCS readings for position between smoothing filter output, the gyroscope measurements, Kalman filter reading, and the real position under external disturbance.

Fig. 12
figure 12

The CubeSat ADCS using the smoothing filter

Fig. 13
figure 13

The CubeSat ADCS via smoothing and Kalman filters

Fig. 14
figure 14

Different attitude readings for CubeSat position under external disturbance

6 Experimental Results

The laboratory setup for the complete hardware implementation of the CubeSat ADCS is depicted in Fig. 15. The gyroscope and other hardware specs are given in Appendix 1.

Fig. 15
figure 15

The hardware setup for the proposed CubeSat ADCS

The laboratory setup comprises the eMotion motherboard (STEVAL-MKI109V2 board), analog gyroscope sensor LPR403AL, the MEMS motion sensor (LPR403AL), and the adapter board LPR403AL for a standard DIL24 socket (STEVAL-MKI099V1).

The LPR403AL is a low-power dual-axis micro-machined gyroscope sensor that can measure the angular rate along 2-axes. It gives high temperature stability and resolution over an extended operating temperature range between (− 40 and + 85 °C) compared to other sensors in the market. Indeed, the LPR403AL has a full scale of ± 30 dps and is able to detect rates with − 3 dB bandwidth and up to 130 Hz. The instrument contains a sensing element which contains a single driving mass, kept in nonstop oscillation and can react according to the Coriolis principle, when an angular rate is applied. The CMOS IC provides the measured angular rate to the external world via an analog output voltage, allowing high levels of integration and production trimming to better match sensing element characteristics. Moreover, the STEVAL-MKI099V1 is an adapter board that is designed to ease the assessment of MEMS instruments in the LPR403AL product family. The board presents an effective solution for rapid system prototyping and device assessment directly within the user’s individual application. This adapter board is braced by the STEVALMKI109V2 motherboard that comprises a high performance 32-bit microcontroller functioning as a bridge between the sensor and the personal computer, on which it is possible to use the downloadable graphical user interface (UNICO GUI), or dedicated software routines for customized applications. The STEVAL-MKI109V2 (eMotion) is a motherboard that is primarily designed to provide the user with a complete ready-to-use platform for the demonstration of MEMS devices mounted on adapter boards. Furthermore, the STEVAL-MKI109V2 board uses an STM32F103RET6 microcontroller. The STEVAL-MKI109V2 board features a DIL24 socket that is capable of mounting all existing adapters for both analogue and digital output MEMS instruments. The ADCS employs a MEMS analog gyroscope sensor LPR403AL that is built-in in the STEVAL-MKI099V1 adapter board which is connected to the motherboard STEVAL-MKI109V2 and then interfaced with the personal computer using the UNICO interface (GUI).

Figure 16 shows the practical output error of the gyroscope when the sensor is at standstill and not rotating (zero input). The gyroscope sensor outputs during the rotation in the X-axis and in the Y-axis are shown in Figs. 17 and 18, respectively. Figure 19 shows the output of the gyroscope during the rotation in both the X and Y axes.

Fig. 16
figure 16

The gyroscope sensor output at standstill (zero input)

Fig. 17
figure 17

The gyroscope sensor output during the rotation in the X-axis

Fig. 18
figure 18

The gyroscope sensor output during the rotation in the Y-axis

Fig. 19
figure 19

The gyroscope sensor output during rotation in both the X and Y axes

7 Comparison with Other ADCS Techniques

In this section, a comparison between the proposed ADCS with other ADCS techniques is presented and summarized in Table 3. This comparison is according to the complexity of the ADCS implementation, spin stabilized, gravity gradient, jets, the handle system constraint, the cost of the ADCS technique, the attitude control complexity, and the attitude error. In [17], the attitude is determined via the global navigation satellite systems (GNSS) carrier signals. This technique estimates the attitude as initial guess for iterative algorithms through three steps. Firstly, the baseline vectors are estimated using least-squares method (LSM). Secondly, the restriction of the direction cosine matrix (DCM) is passed over and the LSM estimates of its nine elements are solved. Finally, a mathematical DCM is obtained from the beyond estimated free matrix. The error attitude is conveyed via the Gibbs vector to relate the previously estimated and the actual attitude. The Gauss–Newton iteration is used for solving the LSM problem through the measurement model. In [23], the CubeSat’s attitude is determined via the star sensors and the gyro. The significant sources of the attitude error determination are the complex environmental factors. The integrated design of the gyro and the star sensor on the identical benchmark can successfully evade the error impact and enhances the CubeSat’s ADCS precision. In [24], the attitude of a Multi-CubeSat relative State is determined via the array signal detection (MUSAS) technique. This technique employs the existing communication systems and antenna arrays on the CubeSats without using additional components. In the MUSAS, by using the bi-directional spatial spectrum estimation, both the angles-of-arrival (AoA) and angles-of-departure (AoD) of the propagation paths from the deputy vehicle CubeSat to the dominant vehicle CubeSats are estimated. The attitudes of the CubeSats relative to the dominant vehicle CubeSats are determined through the derived rotation matrices. In [25], the CubeSat attitude is determined by Magnetic-based attitude control technique with three magnetic torquers. The magnetic torquers are used for damping the CubeSat, and then it is controlled to the Sun-pointing. When the wheel starts up, its rotation will afford gyroscopic stiffness, while the attitude is controlled by the magnetic torquers. According to Table 3, the comparison reveals that the proposed ADCS technique has less complexity of real time implementation, simpler structure, less cost of implementation, less attitude control complexity, and less attitude error compared with other ADCS techniques.

Table 3 Comparison between proposed ADCS and other ADCS techniques

8 Conclusion

An efficient and low-cost real time implementation of a flexible attitude determination control system (ADCS) that detects the input measurement signals via different sensors and produces the attitude feedback for CubeSat has been presented via the Simulink model on Matlab and verified experimentally through the hardware testbed. The proposed ADCS has two steps; the attitude determination which estimates the current CubeSat’s attitude and a novel simplified intelligent proportional-integral (SI PI) control algorithm for adjusting the CubeSat’s attitude. The SI PI technique is based on the multi degree-of-freedom controller concept and has no controller gain parameters. The proposed ADCS uses the sun sensor, magnetometer, and the MEMS gyroscope sensor for correcting the attitude drift by offering a comparative attitude that is used for updating the estimated attitude delivered to the Kalman filter for determining the CubeSat’s attitude and angular velocity. To fulfill the request for CubeSats associating various applications, their developers anticipate reusing one adaptable strategy for numerous applications and accordingly developing platform aspects that can be achieved via explicit scenario. Hence, it is vital for inspecting new proposals for flexible CubeSats, as performed in this paper for the ADCS. The design steps of the control code for ADCS sensors have been verified through Matlab/Simulink as discussed in the simulation results section. The magnetometer algorithm and the MEMS gyroscope have been simulated to demonstrate the efficacy of the system. Nevertheless, the present technique of acquiring sun sensor data can be enhanced by complex technique which integrates the gyroscope and the sun sensors to fulfill precise sun position estimation. Moreover, the CubeSat attitude determination obstacles have been addressed and the Kalman filter based attitude determination technique has been presented. The Kalman filter uses the sensor fusion that syndicates sensor annotations with an estimated attitude according to the dynamics of the CubeSat. Simulation and experimental results have been addressed to verify the efficacy of the proposed ADCS technique for the CubeSat. The results endorsed that the proposed ADCS technique is more precise as the steady-state error is less than 0.1°. In addition, the proposed ADCS has been compared with other ADCS techniques according to the complexity of the ADCS implementation, spin stabilized, gravity gradient, jets, the handle system constraint, the cost of the ADCS technique, the attitude control complexity, and the attitude error. This comparison reveals that the proposed ADCS technique has less complexity of real time implementation, simpler structure, less cost of implementation, less attitude control complexity, and less attitude error compared with other ADCS techniques.