The High Energy Rapid Modular Ensemble of Satellites (HERMES) Technological and Scientific pathfinder is a space borne mission based on a constellation of LEO nanosatellites. The payloads of these CubeSats consist of miniaturized detectors designed for bright high-energy transients such as Gamma-Ray Bursts (GRBs). This platform aims to impact Gamma Ray Burst (GRB) science and enhance the detection of Gravitational Wave (GW) electromagnetic counterparts. This goal will be achieved with a field of view of several steradians, arcmin precision and state of the art timing accuracy. The localization performance for the whole constellation is proportional to the number of components and inversely proportional to the average baseline between them, and therefore is expected to increase as more. In this paper we describe the Payload Data Handling Unit (PDHU) for the HERMES-TP and HERMES SP mission. The PDHU is the main interface between the payload and the satellite bus. The PDHU is also in charge of the on-board control and monitoring of the scintillating crystal detectors. We will explain the TM/TC design and the distinct modes of operation. We also discuss the on-board data processing carried out by the PDHU and its impact on the output data of the detector.