Output Module

Overview

The output modules are, just like the input modules, essentially a string of 8-bit modules.
These are attached to the Arduino controller and can be controlled through xPL commands from MisterHouse.

The current hardware is in design phase, and there are several versions:

  • A version with 2 8-bit modules integrated, providing 16 digital outputs.
  • A version with 2 8-bit modules integrated, providing 2 analoge 0-10V outputs to connect to existing dimmers.
  • Possibly version with a single 8-bit module integrated, providing a 230V phase dimmed output.

They can be mixed together and are addressed in 2 ways.

Details

Imagine the string of modules as a string of bits.

1, 2, 3, 4, 5, etc...

A digital module will add 16 bits to this string.
An analogue modules will add 8 or 16 bits to this string.

It is important to know that this numbering is relative, so changing the order of the modules, will change the numbering!!!
You can not remove a module from the middle and expect everything to still work.

In MisterHouse you can define the outputs as this:

Digital


XPL_SENSOR, johan-arduino.io:o1, light_hall,, output
XPL_SENSOR, johan-arduino.io:o2, light_kitchen,, output

This defines bit 1 and bit 2 of the string.
And the following code will manipulate these bits.


$light_hall->set(on);
$light_kitchen->set(off);

Analogue

Because of the setup, analogue modules will always start on a number divisible by 8 and will always be 8 bits long.
So they could start on bit 1, bit 9, bit 17, etc...
It is recommended to define an analogue Item on this boundary:


XPL_SENSOR, johan-arduino.io:o17, light_kitchen_dimable,, output

(Recommended as it is not required, the software will automatically locate the right address.)

You can set a dim value of 50% by using code similar to:


$light_kitchen_dimable->set(127);
$light_kitchen_dimable->set(50%);

If you send an analogue value to an XPL_SENSOR with a misconfigured address, the software will automatically fix this for you internally to the "start"-address of the module. So as long as the address is in the same 8-bit span, the functionality is the same.

Remarks

Although there is nothing that stops you from manipulating bits 17 to 24 directly for an analogue device, you should probably not do this. :-)
The opposite is also true: Writing "0", instread of "off" to a digital device, $light_hall in this example, will clear the first 8 bits, and thus turning $light_hall, $light_kitchen and possibly other things off.

This is because under the hood, the software checks if the xPL command issues "on" of "off" and then manipulates bits directly, or if it sets a value from 0 to 255 (or a percentage) and then writes this byte to the output module.

Although you might think this is a nice "hack" to turn of multiple devices at the exact same time, it really isn't as it will fail to set the correct states for the objects within MisterHouse and there is a special command for that. ;-)

Special commands

With the standard code, there are some special Items, which do special things.

xPL_Output_Commit

When $xPL_Output_Commit is set to 0, the outputs will not change when you give a command.
When it is set to 1, the outputs are "active" and will be set.

This can be used if you want certain states to change at the same time.

You set $xPL_Output_Commit to 0, you change all the outputs you want, and then you enable $xPL_Output_Commit and all these changes will be activated at the same time.

xPL_Get_Inputs

This command will cause the Arduino to send the current status of all inputs.
It should be used when MisterHouse starts or restarts as there is a chance some inputs have been changed during the time MisterHouse was down and therefor couldn't react on it.

In the default code, this is already taken care of.