Hello,
I thought to give you a brief overview of how the X10 module in my home automation system works. It is very special. I chose Arduino because I didn't like the CM15a very much. I wanted something different. I had an XTB-IIR which I used to improve the performance of my system. I decided to do tests to see if I could pass X10 codes to it. My tests having been very conclusive, I then decided to make it the central part of my home automation system.
Many thanks to Jeff Volp for the XTB-IIR. It allows me to obtain a reliable and very efficient home automation system.
I drew a block diagram which represents the software part. I also give a diagram.
Operation:
If there are no inputs or outputs to execute, the refresh rate is approximately 6 times per second. First, the Arduino board reads the inputs from the Internet, then the wired inputs (Optocoupler), then the expired timers and finally the X10 inputs from the XTB-IIR. Whenever an input requires an X10 command, this command is stored in memory in order to be executed at the end of the cycle. So, once arduino has read all the inputs, it executes the commands, starting with the fastest ones, and eventually the slowest ones (X10). In my old version, I executed X10 commands immediately after reading the input. The efficiency rate was around 90%. By saving the input (EEPROM), I make sure I don't lose anything, and I have increased the efficiency to almost 100%.
For X10 commands, I use an old library. I managed to adapt the code for all the X10 modules that I use. In the attached block diagram, I give some examples.