AC heater temperature control

If you wrote the code, ten days is plenty of time to fix it.

What don't you understand about the problem or the proposed solution?

This line will never do anything useful, because zero_cross is a pin number:

  if (zero_cross == HIGH) {          //We make an AND with the state register, We verify if pin D8 is HIGH???

Best to get each part of the project working before combining all the parts.

Yes, thank you so much.
This project truly make me goes crazy

You will llikely get even crazier when you really try to maintain a temperature of an oven. I have actually done what you are trying, but using a SSR to control the power. The first problem is the initial heating of the oven. The temperature will overshoot your set temperature because the temperature sensor is not directly attached to the heating element. Heated air must circulate from the heater to the sensor and in that time, the heating element is just heating away. So you overshoot and turn off.

Same thing happens, but now you have turned off the element and are waiting for the convection air to tell the sensor the air is cooler, so turn back on. But the oven air has cooled below the set point and we continue the race between the sensor and the heating element.

Hi, @alang-021_kt
Welcome to the forum.

Did you write your code in stages?
If so you should have some code that JUST reads the buttons to prove you have a proper connection.
Use the Serial Monitor to show that the buttons are working.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

So, can anyone help me write the new code? But please make the hardware connection is still same

Yes, I can.
See post #7, 16, 18 and 21.
When you make the button work then we can go onto the other problems.

2 Likes



bool bPress = false;
bool YesHeating = false;
int start_lastButtonState = 0;


void setup() {
  //Define the pins
  pinMode (start_pin, INPUT);
  pinMode (estop_pin, INPUT);
  start_buttonState = digitalRead(start_pin);

  lcd.init();       //Start the LC communication
  lcd.backlight();  //Turn on backlight for LCD
}

void loop()
{
   void zeroCross();
   void checkUp();
   void checkDown();
  currentMillis = millis();           //Save the value of time before the loop

  // Push the start button to activate heating but NOT start the timer yet
  if (start_buttonState != start_lastButtonState)    // compare the buttonState to its previous state
  {
    if (start_buttonState == LOW)   // if the state has changed, increase the counter
    {
      bPress = true;  // if the current state is HIGH then the button went from off to on:
      YesHeating = true;
    }
  }
  start_lastButtonState = start_buttonState;   // save the current state as the last state, for next time through the loop
  
  if ( YesHeating == HIGH)
  {
    heating_active = true;    // Activate heating
    timer_started = false;    // Ensure the timer doesn't start until setpoint is reached
  }

is it like this?

Does it do what you want?
Hint: add some Serial.print(); in your code to check...

Have you fixed this yet? You need to use if (digitalRead(zero_cross) == HIGH) to read and test the detector output.

  if (zero_cross == HIGH) {          //We make an AND with the state register, We verify if pin D8 is HIGH???

In order to get this project working, first get all the parts working, each by themselves.

Make sure you can read the switches, read the zero crossing detector output and turn the heater on and off, with short, individual programs, before putting the pieces together.

I still can't do it, plz help me

Plz, i truly begging you. Give me the coding to start and stop the program, i just cannot handle it anymore😭

Perhaps you are confused about what help this forum offers. Please read this article carefully and consider editing your code with the help given.

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966

Of note, this link was posted earlier in this discussion, but is still relevant.

Good luck with your project.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.