Added timesync with Pi

Added timesync with Pi and some improvements retating Pi communication.