Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
You must login to post a message.

09/27/2022 7:35 AM
Welcome, @sihar and plf5

09/26/2022 11:12 AM
coffeeground Welcome

09/25/2022 11:58 AM
Zarkness Welcome

09/21/2022 6:56 PM
Freded welcome to HRO! Welcome

09/16/2022 12:45 AM
@ ZoydW and CoffeeCrafters, welcome cup

In Memory Of Ginny

Latest Donations
dmccallum - 10.00
JackH - 25.00
snwcmpr - 10.00
Anonymous - 2.00
Anonymous - 5.00
Users Online
Guests Online: 8

Members Online: 0

Total Members: 7,663
Newest Member: sihar

View Thread

Who is here? 1 guest(s)
 Print Thread
Frequency for ON/OFF AC-relay heater

I have now my popcorn roaster connected with 2 probes and an AC-relay.
With my Raspberry Pi I can see both ET and BT and switch on-off the heater by means of a Button and/or Event.

However, what frequency for switching ON/OFF should I apply to the resistance if for instance I want to achieve a heat of 70% of its maximum power (1200Watt) during a certain period of my roast?

For example, a cycle of 7 seconds ON/3 seconds OFF would be good/efficient or should that be fe. 0.7 seconds ON/0.3 seconds off?

Hope you get my point. Any hints will be appreciated!

For tubular heating elements, the lower frequency cycle rate is fine but for coiled resistance wire for heating a convection air stream, go with the 1 second time base to prevent convection air temp fluctuations during each cycle.
1/2 lb and 1 lb drum, Siemens Sirocco fluidbed, presspot, chemex, cajun biggin brewer from the backwoods of Louisiana
Thank you!
Too fast cycle will bring another issue than fluctuations: losing control resolution.
That's because the smallest quota of power you can on off is given by the period of the sine wave.
So if you want 1% change of the slider to be 1% change in heat, then you should use 2 seconds for 50 Hz mains, or proportionally less for 60 Hz mains.


renatoa wrote:

Too fast cycle will bring another issue than fluctuations: losing control resolution.
That's because the smallest quota of power you can on off is given by the period of the sine wave.
So if you want 1% change of the slider to be 1% change in heat, then you should use 2 seconds for 50 Hz mains, or proportionally less for 60 Hz mains.

I thought it was 1 second at 50Hz to allow 1% resolution. The sine wave crosses zero volts twice in each cycle giving the SSR 100 opportunities to switch each second?

This is my python script which works from the command line: "./ 30"
...cycles the heater 0.3 secs on and 0.7 secs off.

However, if I run it from Artisan by means of the slider, it works the first time moving the slider, but if I move the slider again, the script does not kill the previous cycle and starts the new I end up with several cycles running simultaneously.

This is because of the "while" statement which does not get interrupted by the sliderevent.
How should I rewrite the while so Artisan resets the cycle correctly?

Hope you get my point!

Thanks and regards


# importeer de GPIO bibliotheek.
import time
from time import sleep
import RPi.GPIO as GPIO
from sys import argv
import max6675

#Zet de heater aan
def heaterON():

#Zet de heater uit
def heaterOFF():

def calculate_on_off_time(cycle):
#Loop door aan/uit heater
# Invalid slider argument
if cycle not in range(0, 100):
print("Incorrect slider argument. Exiting now. ")

# Calculate on- and offtime
ontime = cycle/10
offtime = (100-cycle)/10

# read temperature connected at CS 22
et = max6675.read_temp(cs1)
# read temperature connected at CS 29
bt = max6675.read_temp(cs2)

return ontime, offtime

if __name__ == "__main__":
# driver code
# ===== SETTINGS =====
# in this case there are two sensor. one is connected to 22 with CS, the other is connected to 29 with CS
cs1 = 22
cs2 = 29
sck = 18
so = 16

# max6675.set_pin(CS, SCK, SO, unit) [unit : 0 - raw, 1 - Celsius, 2 - Fahrenheit]
max6675.set_pin(cs1, sck, so, 1)
max6675.set_pin(cs2, sck, so, 1)

# Zet de pinmode op Broadcom SOC.
# Zet waarschuwingen uit.
#Pin number (fysiek) voor aanzetten relay
ACPin = 35
# Zet de GPIO pin als uitgang.

cycle = int(argv[1])
timeON, timeOFF = calculate_on_off_time(cycle)

while True:

except KeyboardInterrupt: # trap a CTRL+C keyboard interrupt
GPIO.cleanup() # resets all GPIO ports used by this program
Found this solution, that is, writing the latest slidervalue to a file check on this value within the "while"...
It works but I am not very experienced with Python and I suppose there must be more elegant solutions...

Thanks in advance!
# write the cycle slider value to slidervalue.txt
cycle = int(argv[1])
sliderfilepath = "/home/pi/Roaster/Scripts/slidervalue.txt"
sliderfile = open(sliderfilepath, "w")

# get the time OFF and ON
timeON, timeOFF = calculate_on_off_time(cycle)
# while this file has the latest cycle value
latestcycle = True
while latestcycle:
# check if this is not the newest process
newestcycle = get_slidervalue(sliderfilepath)
if newestcycle != cycle:
latestcycle = False
# set heater ON and OFF for desired time

Just to inform that I tested with the 1 second base (fe 0.7 seconds on, 0.3 seconds off) for 70% power and works very well IMHO.

What you mean by works very well ?
How do you measure 70% pwm translates into proportional less heat ?
Did you compared with heat at 69 or 71%, to see if temperature follows power ?
The most important detail... is the SSR instant fire or zero cross ?
Hello Renatoa,

I have these 2 types of SSRs, to be honest, I have not looked whether these are zero-cross or random fire since I hadd these laying around. Can you tell from the pics what type these are?
zamunda attached the following images:
bbb.jpg aaa_1.jpg
Zero cross both, you are good !
What is this factor important?

With an instant fire SSR, there are two issues: you have always a variable width incomplete wave slice at that start of the ON PWM pulse, that can lead to a beating phenomenon, i.e. variable fluctuation power in one percent band, that led to about 3C degrees air fluctuations, even your PWM pulse is rock solid... and second issue, much more annoying, when the PWM pulse goes ON at the summit of sine wave, you have a sharp.edge voltage/current increase, from 0 to 380V ( for 230V mains) that could produce serious perturbations/interference in a normal house equipment sensible to EMI.

With a ZC SSR, the relay opens starting with the next sine wave after the moment when PWM pulse goes ON, so the above issues dow not exist, and you are guaranteed to have a complete wave switched regardless of the moment when your PWM signal change status.
Hello Renatoa

Thanks for this info, great that i'm fine with these!
What on the pics tells you these are zero cross?

Thanks and regards!
The SSR codes, did a search in the manufacturer data, and found the fire type.
Jump to Forum:

Similar Threads

Thread Forum Replies Last Post
Air Popper Heater Popcorn Popper roasting 39 08/29/2022 2:50 PM
Artisan heater control issue Dataloggers/Controllers/Rate of Rise Meters 9 07/03/2022 8:13 AM
Rewire 230V popcorn machine fan & heater Popcorn Popper roasting 134 02/21/2022 1:40 PM
Popper gets really hot after only a few seconds of heater on Dataloggers/Controllers/Rate of Rise Meters 22 01/08/2022 5:57 AM
Modifying DASH 1400W Popper with TC4 + Transistor DC Relay Building a Coffee Roaster 36 02/23/2021 12:28 PM
Homeroasters Association Logo, and all Content, Images, and Icons © 2005-2016 Homeroasters Association - Logos are the property of their respective owners.
Powered by PHP-Fusion Copyright © 2022 PHP-Fusion Inc
Released as free software without warranties under GNU Affero GPL v3
Designed with by NetriX