Related lists

Description

This quick project demos the use of Hexabitz solid state relay (SSR) modules-H09R00 for driving AC loads such as LED lamps, fans and synchronous motors. You will learn about various relay modes (timer and PWM) and build a large array of relays. To make things more fun, we show you how to disassemble and modules and re-assemble them again in a completely different configuration without writing any code!

Details

What is it?

We will use the project to demo both the H09R00 Hexabitz solid state relay (SSR) module and the concept of building relatively large arrays and the way they can be automatically configured and controlled without writing code. 12 SSR modules are assembled in the first configuration and then the array is reconfigured into a different shape with only 10 SSRs. To make the system stand-alone, we also added a single 3.3V / 1A DC-DC module (H03R00) to power the modules themselves from a wall AC-DC adapter.

After the array is assembled, we demo a cool Command in Hexabitz CLIs: It is the automatic array exploration that allows modules to discover their neighbors and form their connections and routing table without you writing any code. After the array topology is explored and saved to non-volatile (MCU FLash) memory, the array can be used for its intended application. We show you single-cast, multi-cast and broadcast Commands that control only a single relay, a group or relays or all of them.

In the project logs, we test a smaller array of three SSRs and a single DC-DC module with a bunch of momentary tactile switches. We connect various AC loads to the relays: 120V AC LED lamps, an AC duct fan and an AC synchronous motor (usually used in microwaves!). Using the tactile switches we control these relays and their loads by toggling them ON / OFF or using the timeout functionality. We also show module PWM functionality modulating the relay and generating a variable RMS voltage.

Building And Configuring Arrays

First start assembling the relay modules in your preferred configuration. We chose this beautiful shape that fits 12 modules with all the green connectors (relay switch) on the outside perimeter. Add the H03R00 module is you are planning a stand-lone system. If not, you can power directly from your USB-UART cable!

Connect to one of the modules and run the CLI. We used the lovely modified Kelvin clamp to connect to the module array port! Once you call the explore command, module LEDs start dancing performing the complicated algorithm of finding neighbors, swapping ports, communicating their states and building the routing table. Once succeeded, the array topology and relevant information are stored to each module's MCU Flash so that whenever you power up again, all modules know their location and connections in the array.

After that you can test everything works well with a broadcast command all.toggle. The yellow LEDs mean the relay output is turned ON, i.e., closed. The command was broadcasted to all connected modules and they toggled their output state from OFF to ON.

Modules can be grouped and given a name or alias as well. Commands can then be targeted only to the group members. Grouped module don't have to be adjacent or of the same type. You can for example, group all LEDs together and all relays together. Or you can group the relays driving the heaters in a group called heaters and the ones driving fans in a group called fans regardless of their physical location in the array. All you need then to control heaters and fans is to call them by name:

group heaters #1 #4 #5
group fans #2 #8
heaters.on
fans.toggle

Or split the relays into groups based on their load location: south room, north room etc.

Can't decide what to build? Get twice the fun by disassembling the array and going into same process again for a completely different shape (and even quantity)! Before you disassemble the old array, make sure to erase the old topology from module non-volatile memory by executing the command:

Files

Project Logs

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.c, main_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.

Button 1 is used to drive the duct fan as a continuous switch. It's popular in many industrial applications. So, as long as you're pressing the button, the fan works. Once you release the button the fan stops.

Button 3 is used with a timer (for example for building/staircase lighting). Once you click it, it works for 3 seconds and then turns off. If you click again, it resets the timer.

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.c, main_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.

We built a smaller array of three relay modules (H09R00) and one DC-DC power module (H03R00 ) to control actual AC loads. This is a simple software example to test SSR functionality:

Button 1 (connected to module 1) broadcasts a Toggle Message to all modules so that they toggle their output state. Note that the orange LED is directly connected to relay output. So whenever the relay is ON (switch closed), the orange LED is ON.

Button 3 (module 3) toggles between modules starting with 1 then 2 and then 3. Combining these two button actions you can create interesting patterns. Also pressing button 1 for 1 second turns off all relays.

This example is shown in the following three videos:

One without any load (this is the best way to develop and debug the software. Once you're satisfied with results you can easily disconnect programmer and plug in the green connectors and power the H03R00 module)

One with the AC LED lamps

One with one LED lamp, the AC synchronous motor and the duct fan.

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.c, main_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.