Four Priests Brewery YouTube channel

The Homebrew Forum

Help Support The Homebrew Forum:

Agentgonzo

Landlord.
Joined
Aug 23, 2021
Messages
820
Reaction score
869
I assume the fancy element power controller that Martin sent you works by pulsing the power on/off for the relay for longer/smaller amounts of time based on the potentiometer setting, rather than altering the actual voltage supply (ie, power) to the element?
 
Joined
Aug 11, 2020
Messages
1,052
Reaction score
1,304
Location
The People's Republic of Sandbach
I assume the fancy element power controller that Martin sent you works by pulsing the power on/off for the relay for longer/smaller amounts of time based on the potentiometer setting, rather than altering the actual voltage supply (ie, power) to the element?
I think he did it the hard way. Pulsing is for SSR newbies, right @The-Engineer-That-Brews ?
 
Joined
Jul 27, 2020
Messages
3,417
Reaction score
3,307
Location
St Albans, Herts
I think he did it the hard way. Pulsing is for SSR newbies, right @The-Engineer-That-Brews ?
Nope - pulsing on and off (for integer multiples of a mains cycle) is in fact the way to go for this kind of application, because it lets you only turn the heating element on or off when the mains voltage is zero... thus reducing both electromagnetic interference and 'shock loading' of the heating element which can otherwise give big surge currents that will shorten its life.

To be precise I use a technique called 'pulse density modulation', which I do with a variation on the 'Bresenham' algorithm that is more normally used to draw 'straight' lines on your computer screen out of discrete pixels (see Bresenham's line algorithm - Wikipedia)

For anyone who's interested, here is relevant section of my code. The main function repeatedly reads the position of the control knob and sets a global 'ones_count' as follows:

ones_count = (uint16_t)(0.5 + BRESENHAM_FRAME_SIZE * (float)adc_value / 1023.0);

Then on a 25Hz interval the following interrupt routine is called:

// interrupt service routine for Timer/Counter1, Output Compare A Match (TIM1_COMPA)
// updates the SSR pulse density modulator
//
ISR(TIMER1_COMPA_vect) {
static int16_t err;

err -= ones_count;

if (err < 0) {
err += BRESENHAM_FRAME_SIZE;
PORTB |= _BV(PB0); // SSR on
} else {
PORTB &= ~(_BV(PB0)); // SSR off
}

}

The 'BRESENHAM_FRAME_SIZE' is set to a suitably large prime number, to avoid predictable patterns in the on/off pulses.
 
Joined
Jul 27, 2020
Messages
3,417
Reaction score
3,307
Location
St Albans, Herts
I think he did it the hard way. Pulsing is for SSR newbies, right @The-Engineer-That-Brews ?
This little video clip shows the overall effect: as the power increases the pattern changes from 'off', to mostly 'off' with a bit of 'on', to 50/50, to mostly 'on' with a bit of 'off', and then fully 'on'.
The video isn't great due to the strobing effect with the mains freq, but I think you can see what's happening.

 

Chippy_Tea

Administrator.
Staff member
Administrator
Moderator
Joined
Mar 17, 2013
Messages
42,156
Reaction score
13,881
Location
Ulverston Cumbria.
Joined
Aug 11, 2020
Messages
1,052
Reaction score
1,304
Location
The People's Republic of Sandbach
@The-Engineer-That-Brews i am not seeing a video.
Are you not seeing this Chippy
1657477393336.png
 

Chippy_Tea

Administrator.
Staff member
Administrator
Moderator
Joined
Mar 17, 2013
Messages
42,156
Reaction score
13,881
Location
Ulverston Cumbria.
If you are having the same playback problem please can you add your answer to the thread below not this one, thanks.

 

Latest posts

Top