Close

SSR Module Demo 3

A project log for Relay Hub

Build and use an array of Solid State Relays!

hexabitzHexabitz 03/29/2018 at 05:080 Comments

The H09R00 module driver has PWM (pulse-width modulation) control functionality that permits controlling the output level of relay control pin by switching it on and off at a very high rate and with variable duty cycle. The duty cycle (or ON time) percentage corresponds directly to output voltage. Pulse-width modulating the relay control pin causes the relay itself to turn ON and OFF and thus modulate the AC (or DC) voltage it controls!

main_ex3.c shows one usage example where Button 1 click triggers a ramp up sequence and broadcasts to all relays while Button 2 click triggers a ramp down sequence. The pulse-width modulation is clear with the orange LED level and is also shown on the multimeter measuring the AC voltage. As you can see, its value is changing between 0 and 120 V AC. You cannot notice this effect on most AC loads (e.g., an AC lamp) since most of them have cut-off circuitry to disconnect input voltage when it goes below a threshold (e.g., 110V). Same concept, however, can be used in other applications especially for DC controlled devices.

PWM functionality is available via an API, a Message and a CLI command. All you need is to set the duty cycle percentage from 0 to 100%. Note, however, since H09R00 is an AC relay (Triac) controlled indirectly by a transistor, the PWM percentage does not match 1:1 (the transistor gate resistor is also a bit high). A duty cycle range 0 to 10% results in AC voltage change of 0 to 120 volts. After PWM 10% the voltage stays the same at 120V as the relay is now open. You can, however, remap the range as you want since the duty cycle is a float number.

How to execute this example?

The source code for this project is in the attached zip folder. Each demo example code is available in a separate C source file in User folder called main_ex1.cmain_ex2.c, etc. To run a specific example, replace the main.c file content with the content of the example file and recompile the project for all three targets. Check firmware update article for instructions on loading firmware to the modules.

Discussions