PWM with Solid State Relay

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

PWM with Solid State Relay

#1 Post by wiredcharlie » 08 Oct 2022, 17:42

I'm using an S.S.Relay to drive a heater in a coffee boiler. The SSR does zero voltage switching of AC mains. I'm using PWM on a GPIO to vary the heater power. I just got round to looking at the PwM on an oscilloscope and I see it is 1Khz!!!!

Is there a way to reduce the PWM frequency or a cunning way to implement a low frequency PWM in Rules?

Much appreciated, as always,

Tony

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: PWM with Solid State Relay

#2 Post by TD-er » 08 Oct 2022, 18:26

See the PWM command: https://espeasy.readthedocs.io/en/lates ... ernal-gpio

Code: Select all

PWM,<GPIO>,<duty>,<duration>,<frequency>
It does mention a minimum frequency of 100 Hz, but not sure if that's an actual limit or perhaps more a practical limit for dimming.

However keep in mind the net frequency isn't exactly 50 Hz (or 60 in US and Japan for example)
So I guess it may be very hard to sync the PWM as the solid state relay will turn on at a zero-crossing, but not sure if it will actually turn off between zero-crossings.

Since the heating element is quite slow, maybe it is better to use longpulse and looptimer?

For example run the looptimer every 2 sec and then using looptimer_ms to set the pulse width between 20 msec and 2 sec.
The looptimer will be quite accurate as is the longpulse_ms.

wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

Re: PWM with Solid State Relay

#3 Post by wiredcharlie » 09 Oct 2022, 13:37

Thank you

wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

Re: PWM with Solid State Relay

#4 Post by wiredcharlie » 09 Oct 2022, 16:35

Just an observation here,

Pulse,0,1,([INT#30])*10

Kills the webserver when uploaded to Rules:

192008: GPIO : port#0: set to 0
192020: ACT : oledframedcmd,2,3%
192199: Upload: START, filename: rules1.txt
192321: Upload: WRITE, Bytes: 1999
192322: Upload: END, Size: 1999
192496: Webserver 1 Arguments: 0: 'enctype' length: 19
192509: CRC : SecuritySettings CRC ...OK
>> Failed to fetch <<
>> Failed to fetch <<
>> Failed to fetch <<
>> Failed to fetch <<

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: PWM with Solid State Relay

#5 Post by Ath » 09 Oct 2022, 16:40

Can you check if there are any irregular characters (invisible? characters) in your Rules file? Possibly caused by copy/pasting from somewhere else into the Rules editor.
/Ton (PayPal.me)

wiredcharlie
Normal user
Posts: 57
Joined: 28 Sep 2020, 13:58

Re: PWM with Solid State Relay

#6 Post by wiredcharlie » 09 Oct 2022, 17:17

I did paste from a text editor; but the when I tried on another board, I typed it directly into the Rules - so don't think it's special characters.

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: PWM with Solid State Relay

#7 Post by TD-er » 09 Oct 2022, 18:09

You should use longpulse
pulse is blocking, longpulse does schedule an action to switch the pin back to its old state.

Post Reply

Who is online

Users browsing this forum: No registered users and 95 guests