https://github.com/br3ttb/Arduino-PID-Library/blob/524a4268fc01e6ea397e7fc5b5d820741e9b662f/examples/PID_RelayOutput/PID_RelayOutput.ino#L32C2-L44C2 This leads to unexpected behavior since the pullup/high-impedance doesn't drive relays or relay drivers very well. See https://github.com/br3ttb/Arduino-PID-Library/pull/137 for a fix or just add a line like this to setup: pinMode(RELAY_PIN,OUTPUT);