Yep.. I need HELP! Pellet stove controller...

forewarning- I am a farmer/ rancher and punctuation, grammar are not strong with this one…

My wife and I Just purchased our first home, which has a pellet stove for its primary heat. We have full intentions of installing a central heating system come tax return season, but we didn’t make it there. Day three of owning the home the pellet stove quit.
Some quick checks concluded that the controller had given out… well being that we put every dime we had into purchasing the property a new controller just isn’t an option. I have a pretty good understanding of mechanical functions and was able to manually run the stove. I had bought some arduino stuff for other future projects and decided to try to use them for a new controller.

I know some people are going to say safety, safety, safety which I agree. So I will explain what I am retaining from the pellet stove.
100% original wiring with 7A fuse.
all of the “Snap Discs”. For over heat and to turn on convection fan.
Vacuum switch that only lets the auger/ feed motor turn on if the combustion blowers are on.
and thermo couple incorporated into the code…

Now… the … code… That is where the wall was met.
Please bare with me… I am all for constructive criticism but don’t do well with belittling…
This is my first arduino project.

I started off just trying to turn everything on and then turn the ignitor off and well… never got past that… Here is what I came up with.

#include <OneWire.h> 
#include <DallasTemperature.h>
#include <Wire.h>



int sensorPin = A0;    // 10K potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor
int setTemp = 0; // variable to store temp desired
int CombPin = 10; //combustion blowers
int AugerPin = 6; //auger
int IgnitorPin = 9; //ignitor
int ConvFan = 7; //  convection fan
float Temp;
float currentTemp;
int FireState = false;
int IgnT = 10000UL;
int millisR = 0;
long OnTime;

#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

void setup(void)
{

Serial.begin(9600);
sensors.begin();

pinMode(ConvFan, OUTPUT); //set convection fan pin as output
digitalWrite(ConvFan, HIGH);
pinMode(AugerPin, OUTPUT); 
digitalWrite(AugerPin, HIGH);
pinMode(CombPin, OUTPUT); 
digitalWrite(CombPin, HIGH);
//pinMode(hcLED, OUTPUT); 
//digitalWrite(hcLED, HIGH);
pinMode(IgnitorPin, OUTPUT);
digitalWrite(IgnitorPin, HIGH);
}



void loop(void)
{

  sensors.requestTemperatures();
 Temp = (sensors.getTempCByIndex(0));
 delay(100);
  currentTemp = Temp * 1.8 + 32.0;

  
  
 Serial.println(setTemp);
Serial.println(currentTemp);


delay(500);

  sensorValue = analogRead(sensorPin);  
  
  setTemp = (sensorValue + 7.5) / 3; //seems to give a decent temp range for POT



// Heating Mode

  if (FireState == false && currentTemp < setTemp - 1)
  {
   OnTime = millis();
  digitalWrite(IgnitorPin, LOW);
  digitalWrite(CombPin, LOW);  
  digitalWrite(AugerPin, LOW);
  Serial.println("Heater On");
  FireState = true;
  Serial.println(OnTime);
  }
  
  if( FireState == true && OnTime >= IgnT)
    digitalWrite(IgnitorPin, HIGH);    //ignitor off
  }

I have tried several different things to get the Ignitor to turn off but clearly don’t understand millis…
here is a chart of what I am trying to accomplish.



any help is greatly appreciated as its a very cold house here in Colorado.
Thanks,
Devin

I started off just trying to turn everything on and then turn the ignitor off and well… never got past that… Here is what I came up with.

The code you posted does something. It would be nice to know what it actually does.

It prints (anonymous) stuff, too. It would be nice if the values were NOT anonymous, and it would be nice to know what you see printed.

Have a look at the tutorial Thread planning and implementing a program

I reckon you need to write a program that goes through each of the steps in the boxes in your diagram. Each box is pretty much equivalent to the steps in that tutorial.

I would keep the code neat and the logic clear by putting the code for each box in a separate function.

I haven't read all the boxes but I notice in Box 7 an output from a thermocouple is expected. Is it working properly? Are all the other sensors working properly? Have you the means to verify that?

It would be a good idea to write separate short programs to verify the working of each sensor and to verify your own understanding of how to use it with your Arduino.

Be careful that you don't void your liability and property insurances.

...R