Trouble with using encoder and pid library together

Your sprintf() statement is likely overflowing the timeBuffer array. Why did you only reserve 6 bytes?