This paper proposes an implementable sun tracking algorithm for portable systems powered by alternative energy sources. The proposed system uses a 2-axis tilt sensor and a 3-axis magnetic sensor to measure the orientation and posture of the system, according to a horizon coordinates system, and compensate for tilt effects. Then, through an astronomical calculation, using the present time and position information obtained from GPS sensors, the azimuth and altitude of the sun in that location is calculated and converted to portable sun tracking system coordinates and used to control the A- and C-axes of the system.