This is the in-progress page relating to our build of a lightbulb PCR machine based on Russel Durrett’s design.


Here is the code so far (it is very simple).  We will need more advanced coding for holding temperatures for extended periods of time, but this is a learning experience.


One can modulate the if/than temperature to control the hysteresis loop, as well as the delay to control sampling time.


It was modified from the official site for the thermistor


#include <math.h>

int RelayHOT = 4;

double Thermister(int RawADC)
double Temp;
Temp = log(((10240000/RawADC) – 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp – 273.15; // Convert Kelvin to Celcius
return Temp;

void setup()
pinMode(RelayHOT, OUTPUT);

void loop()
float Temp = Thermister(analogRead(0));
Serial.println(Temp,2); // print Celcius temp with 2 decimals reading in serial monitor

if (Temp < 24.5) digitalWrite(RelayHOT, HIGH); //if the temperature is less than XX.XX C, turn on the relay which will turn on the light and increase temperature
else if (Temp > 25.0) digitalWrite(RelayHOT, LOW); //if the temperature is greater than XX.XX C, turn the bulb off because it is hot enough

delay(2000); // wait 2 seconds before sampling temperature again