In this article we present a new algorithm implemented on a microcontroller for the classification of human physical activity based on a triaxial accelerometer. In terms of long term monitoring of activity patterns, it is important to keep the amount of data as small as possible and to use efficient data processing. Hence the aim of this work was to provide an algorithm that classifies the activities "resting", "walking", "running" and "unknown activity" in real-time. Using this approach memory intensive storing of raw data becomes unnecessary. Whenever the state of activity changes, a unix time stamp and the new state of activity, as well as the number of steps taken during the last activity period are stored to an external flash memory. Unlike most accelerometer based approaches this one does not depend on a certain positioning of the sensor and for the classification algorithm no set of training data is needed. The algorithm runs on the developed device Motionlogger which has the size of a key fob and can be worn unobtrusively in a pocket or handbag. The testing of the algorithm with 10 subjects wearing the Motionlogger in their pockets resulted in an average accuracy higher than 90%.