-
-
Notifications
You must be signed in to change notification settings - Fork 84
Controlling relays via BSB–LAN
Most microcontrollers allow to control relays, either those that are part of the microcontroller board (such as with the Olimex EVB) or those that can be attached to one or more of the GPIO pins.
In order to connect an external relay to the microcontroller, you have to connect it to power (VCC), ground (GND) and one unused GPIO per relay you want to control. Some external relay cards have multiple relays and thus need to be connected to one available GPIO each.
One you have connected the relay, you can turn the relay on and off simply by using the /G
URL command. Let's take the built-in relay of the Olimex EVB as an example. The relays are connected to GPIO pins 32 and 33, so to turn the first relay on, you have to call the URL
http://bsb-lan.local/G32=1
and to turn it off, you have to issue
http://bsb-lan.local/G32=0
Likewise, for the second relay, you have to call this URL to turn it on:
http://bsb-lan.local/G33=1
and
http://bsb-lan.local/G33=0
to turn it off.
Please note that "turn on" and "turn off" depend on your setup. A relay usually has three connections: NO
stands for normally open, NC
stands for normally connected and COM
stands for common. So under normal circumstances, electricity would enter the relay via COM
and exit via NC
if the relay is not receiving any input.
If it is connected to a microcontroller, for example, it's behavior depends on whether it is an active high or active low relay.
If the relay is active high, a high signal would switch the relay and electricity would now flow from COM
to NO
instead of NC
. If the relay is active low, then a low signal would have this effect.
The relays of the Olimex EVB are active high, which means that you have to set the respective GPIO pin to high (or 1
with the /G
command) to have electricity flowing from COM
to NO
.
A relay can be useful to connect to the programmable input connectors (such as H1 for example) of some heating systems. These can be configured for example to switch the heating mode between comfort and reduced mode. In that case, you would wire the two contacts of the programmable input to COM
and NO
(which one is not relevant) of the relay. Now, if you call the corresponding URL mentioned above, the relay will either lead to a connection of the programmable input connectors – or it will disconnect them. The heating system will then act accordingly. This is espeacially helpful to use with heating systems that do not offer parameters to achieve the same results by using parameters of the heating system only.
Caution: If you connect electrical devices to a relay, make sure that the relay is actually certified for that usage. For example, some relays are certified for 110V, but not for 240V.
Caution: Make sure that you are qualified and allowed to do whatever electrical works you are planning to do. Working with higher voltages (usually above 50V) generally require an electrician to do them.
Quick links:
BSB-LAN manual | BSB-LAN latest version | BSB-LAN bug report | BSB-LAN discussions