Thursday, December 28, 2017

Controlling X10 with Alexa

 I thought it would be fun to control the X10 modules in my house with an Echo Dot .

I am unapologetic about using this 1980's technology for much of my HA.  It's cheap and it works for me.

A quick search revealed that there is an Arduino library written by  Tinkerman that interfaces an ESP8266 to Alexa. (It mimics Belkin WeMo switches.)

Once you have the ESP8266 responding to Alexa, the world is your oyster!

Since I have already written the code to control the CM17A X10 module in Arduino, it was just a matter of combining the two functionalities.

In use, the chain of events is as follows ...
I tell Alexa, "turn tree on". Alexa sees a WeMo switch device named "tree". The Arduino sketch receives that event and calls the corresponding house and unit command for the CM17A. The CM17A transmits the code wirelessly to a TM751 transceiver (or the like) which puts the signal on the powerline. The signal is picked up by an X10 module which turns on the device.

Hardware-wise you need some kind of ESP8266 dev board, an optional I2C OLED display, a CM17A module (AKA X10 Firecracker),  an X10 wireless receiver, a lamp or appliance module. You also need a level shifter.



The level shifter is needed because the ESP8266 is a 3.3V device and the CM17A requires ~5V to operate. Also, since the CM17A is powered by the difference between RTS and DTR,  strong pullup resistors (330Ω) must also be used on the high side of these signals. Here's a rough diagram ...


I have the source code pretty much finalized for this project. If you are interested, you can download what I currently have here,

Enjoy!


16 comments:

  1. Very nice. I control many items in my house with X10 and would need very interested in the code. I'm currently using heyu running on an RPi with a mobile website interface.

    ReplyDelete
    Replies
    1. Robert,
      You can download the current sw using the link at the end of the now modified post.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete

  4. I built something very similar that listens to an MQTT server so that it can be used with more than just Alexa. Also, since the FireCracker has a PIC 12C508A chip, it will work fine at 3.3V, so you could simplify your circuit.

    ReplyDelete
    Replies
    1. Humph! Good to know. I thought it needed 5V for better transmit power, but that could be wrong. Thanks for the info!

      Delete
  5. Thank you for your work.
    I thought the CM17A used only three lines: GND, RTS, and DTR. No VCC.
    I've been controlling them for years with Arduino with no pullups or fourth wire (red in diagram).
    Does this have to do with the ESP3266 and/or the level shifting?
    And what pin would the red (5V) wire connect to on the CM11A dongle?
    Again, thank you for your excellent work.

    ReplyDelete
  6. You are correct! I screwed up the diagram - only 3 wires to the CM17A.
    I also hear that the level shifter isn't necessary, but haven't tested that.
    Given that I created the original Arduino code for the CM-17A I should know better!

    ReplyDelete
  7. I thought a cm17 is build for the American market, Is there something similar for the European market? I think a cm11 or xm10 won't work because the signals they are using are different.
    For example, the wiring for a cm11 are:
    Signal DB9 Connector RJ11 Connector
    SIN Pin 2 Pin 1
    SOUT Pin 3 Pin 3
    GND Pin 5 Pin 4
    RI Pin 9 Pin 2

    ReplyDelete
    Replies
    1. It's been so long I can hardly relate.
      But since it sends via RF, don't know why I wouldn't work assuming the receiver is different.
      All I have on the CM17A is here (see label). The original info I posted is at:
      https://playground.arduino.cc/X10/CM17A/

      Delete
  8. In Europe we use for X10 wireless devices 433Mhz. I thought in US they use something about 315 Mhz for x10 wireless communication. 433 Mhz is not allowed in the us for such applications and 315 Mhz not in Europe. So I can assume that the Firecracer dont use 433 Mhz?
    Greetings,
    Frank

    ReplyDelete
    Replies
    1. When I Google I get:
      As far as can be determined there is no version of the CM17A which transmits at an RF frequency other than the 310 MHz used for X10 transceivers in North America.

      Delete
  9. What a bunch of flowery BS just to hide the fact he wants to hitchhike for free advertising on this blog. Too many lies and liars in this world IMO.
    I'll delete this if requested.

    ReplyDelete
  10. You tell 'im Bro Hogan !

    ReplyDelete
  11. BTW, your X-10 information has been so valuable to me over the years. My house is very automated with this good old technology.

    Thank you so much !!!!!

    ReplyDelete