Code and Code Related

The following link is to the completeC/C++ code implemented using the Arduino IDE.

The Following Link is to the PID Controller Function that is part of the Complete Temperature Control C/C++ Code

Function Declaration

Function Call

The C_Variable which is the filtered temperature sensor, and the heaterSetting which is the Set Point generated by the Set Point potentiometer are normalized 0.0 to 1.0 by dividing the 2 variables by 500, the full temerature range corresponding to maximum voltage at the analog input to the Nano microcontroller. The LM35 sensor will only generate a voltage of 0 to 1.4 Volts corrsponding to 0 to 140 deg C, but the analog input is 0 to 5V which corresponds to 0 to 500 deg C.

The diagram above illustrates the steps that occur in implementing a PID algorithm digitally. The first block and the final block are done outside of the PID function.

The following function declaration, part of the Compete Temperature C/C++ code, is used for filtering the Temperature Sensor.

The following function call is for the above filtering function.

The basic logic for a difference equation method 1st order filter is: