Showing posts with label X10 Controller. Show all posts
Showing posts with label X10 Controller. Show all posts

Sunday, November 22, 2015

Network Control of X10 - take 2

I posted an earlier version of this, but it was based on the Atmega328 and an Ethernet module.

This version is based on the ESP8266 which provides the microprocessor and connection to the network via WiFi.

I've been having a ball with the ESP8266. It's cheap, programs with the Arduino IDE, and it just works. I've already created a product with it that connects my Geiger Kits to the internet.

So what is it?
The ESP8266 puts up a webpage (like the above) on your local network. The page has buttons for the X10 devices that you want to control. When a button is pressed the ESP8266 drives a CM17A and turns your device on or off. The page also displays any sensor readings that are connected to the ESP8266. So if you are into X10 home automation, this is a cool gadget.

Hardware-wise it's an ESP12 variant of the ESP8266. It's connected to the CM17A through a level shifter. The level shifter is needed because the ESP8266 is a 3.3V device and the CM17A requires 5V to operate. (Since the CM17A is powered by the difference between RTS and DTR strong pullup resistors must be used on the high side - 330Ω.)






You can also attach an I2C OLED display to the ESP8266 which will show the X10 commands that were received.





Here is the complete setup. I used the ESP8266 development board I created for the GK-WiFi kit (available here).






The software is finished (as far as I'm concerned) and is available here.

Saturday, January 24, 2015

Network Control of X10

I really love remote control!
This project allows you to control your X10 devices from any web browser.

The Arduino is used as a web server which puts up a page with controls for House Code, Unit Code, and Command. 

The response is sent back to the Arduino which sends out the X10 commands wirelessly through the CM17A module.

So far it's just on my local network but it appears to be working pretty well.

Still a few things I'd like to change, but the current  Arduino source code is available here.

Saturday, October 16, 2010

Receiving X10 RF Transmissions (Updated 11/21/10)

For me, at least, this was the last piece of the open hardware X10 puzzle. In this blog you'll find open hardware projects that receive and transmit PLC (powerline) signals, as well as transmitting X10 RF signals (via the CM17A). Now sitting in front of me, is an off the shelf 315MHz receiver (detuned to 310Mhz), happily beeping away each time a warm body crosses an X10 motion detector.

The receiver is from Sparkfun, but any similar receiver should work. The key is to get one with a tuning slug as opposed to a crystal. The software that interfaces the receiver to the Arduino is from a suite of X10 libraries written by ThomasM. You can find the whole suite (PLC transmit & receive, RF receive, and IR receive) here. Having written an earlier version of PLC receive, I'd recommend his version for PLC receive and transmit as well.

So lets get started. Get a  315MHz receiver, wire it up per the data sheet, get Thomas's libraries and his example sketch, (or get the "test & calibrate" sketch I made here). Press a key on an X10 RF remote. It should work right away, but only at close range.

So the next step is to tune this receiver closer to 310MHz. You'll want to start by adding an antenna. This page gave me the following lengths (in inches) for a vertical wire antenna at 310MHz:

  • 1/4 wave - 9 1/16"
  • 1/2 wave - 18 1/8"
  • full wave - 36 1/4"
I started with 1/4 wave whip antenna, but the ultimate may be the "egg beater" antenna (Google for examples).

Now it's time to tune the receiver to 310Mhz. I don't have a scope, and I found that a sound card scope was of little help, since the signal is clipped to soundcard inputs, so I came up with two alternate methods.

The first method I tried was to simply connect the output (data pin) of the receiver to the Aux-in on my PC. You will hear a lot of noise! (This is due to the AGC built into the receiver.) However you will clearly hear the RF signal when you push a button on an X10 RF remote - as long as it's close and pointing at the antenna. Pointing the remote away from the antenna gave a fainter signal, and moving it further away made it even fainter. So with the faint signal, I simply turned the tuning slug until I got a clearer sound in the speakers when I pushed a button on the remote. Not very scientific, but it seemed to do the job. (I started by turning the slug CCW - this post said ~160° CCW.)

Later I used a different method which seemed to be more "real word". I made the "test & calibrate sketch" linked above. It simply beeps a piezo and outputs to serial whenever the receiver has a good read. Then I clamped a button down on an X10 RF Remote (HR12A) so it would continuously transmit,  and located it at varying distances from the receiver. While listening for the beeps, I adjusted the tuning slug for good reads at the furthest distance.

While using the second method, I also played around with antennas.  The 1/4 wave whip antenna really didn't seem to do much, and I couldn't pick up signals if the transmitter was outside my house. Then I tried a 36 1/4"  piece of twisted pair from a phone cable. One wire to the ANT pin on the receiver and the other to GND. This made a big difference, and the grounded lead contributed to the difference.

That's about where I am at this point. Interfaced to the example sketch I can receive RF signals from the motion sensors on my front and back doors. There's more about this in last half of this thread in the Arduino forum. [4-3-13] (There were changes to X10rf.h - here is the modified version I used.)

Not sure at this point where I want to go with this - perhaps a "whole house" X10 receiver with some other goodies, or some little dedicated device. We'll see.

Monday, October 19, 2009

Building a Case for the Nex10

Sounds like something a lawyer would say.

Building this case took a solid weekend.

The wood is walnut. I know this wood well because 25 years ago it was a tree on our land in Arkansas. We had to cut down some walnuts to make room for the house and we hauled them to the mill and had them cut into boards. For me, it's a nice mix of the past and present.

I planned a board down to 5/16", cut it up, and mitered the ends. Then I glued up a box.

The board was wide enough to make 2 boxes. I also made the acrylic front using acetone to chemically wield two black strips that hold the 8x32 matrix in place. The IR sensor is glued over a small hole drilled in the top black strip.

I got a few gaps in the wield which show up as shinny spots on the black strips. Next time a little more acetone and better clamping. I used tripoli abrasive on a buffing wheel to finish the edges.

To make the box stronger, and more interesting, I added ebony splines in the corners. I do this with a jig I made for my router table. Its kind of a sled that holds the box at 45° (photo).

After cutting off the excess ebony (photo), I rounded all the corners with the router.

On the inside of the box there's a platform that holds the board in position to line up the SD socket with a slot in the side of the case (photo). I used the router to cut the slot, and a little sanding drum to make the recess in the case for fingers to get at the card (photo).

A back cover of clear acrylic was made to fit into a rabbet cut around the back of the box. A power jack and an RJ14 jack for the PSC05 was added to the back. There's also a hole for the USB cable when I'm developing (photo). (Later I added a wood dowel with a hole that fits over the stem of the reset button to bring it out to the back of the case (photo).

The box was finished with a light coat of tung oil varnish. (photo)

Finally, the obligatory video . . .


Friday, October 16, 2009

Nex10 Functionality

Almost all of the functionality of the "X10 Book" is included in this project and new features have been added.

What's missing is the ability to drive relays and LED's. My thinking is to include such things as optional "add-ons". So a "relay pack" could be designed for lawn sprinklers. I'm currently working on a phone dialer (see above), and I'm considering other ad-on modules like a Bluetooth PC interface. But I've gotten ahead of myself.

One of the biggest advantages over the X10 Book is the ability to read in configuration files that are put on the SD card. So far there are 4:
  1. TIMEDATE.TXT - enter the time and date on a single line, put the card in the Nex10, restart, and the time and date are set. (Then the file is deleted from the card.)
  2. SETUP.TXT - this file is loaded into the external EEPROM and deleted after loading. It has several sections where you can define;
    Messages - like names of the weekdays, full moon names, etc.
    Reminders - yearly reminders like birthdays, scheduled salary reviews, etc.
    X10 Events - timers to send X10 commands at certain times.
    X10 Profiles - Friendly names for House / Unit codes so instead of "A-5" "Desk Lamp" is displayed. Other parameters in each Profile control beep type, display and logging options.
    X10 Macros - (work in progress) "IF A-5 ON - Send G-2 and G-3 OFF" is a simple example. They should be pretty powerful - stay tuned.
  3. PARAMS.TXT - This file contains user defined parameters such as the date and time format, the house code for the remote temp sensor, high / low temp alarms, various delay times, etc.I've pretty much replaced all "hard coded" settings with these parameters.
  4. FONTS.TXT - Since we're using an LED display, a set of fonts must be defined. All characters from ASCII 32 to 127 are included. Additionally about 20 or so "sprites" like the moon phases are defined. This file is loaded to the ATmega644P EEPROM instead of the external EEPROM. It is deleted after it is read in.
So what's it do? We'll you should have some idea from the above, but here's the list in all it's gory detail . . .

Clock Features:
  • Time - set by writing it to a file on the SD card, automatically adjusts for DST. The clock has a battery backup.
  • Day of the week is displayed with a user defined message for each day.
  • The current phase of the moon is displayed as an animated sprite. The number of days to the next full moon, and name of the full moon, is displayed as a scrolling message.
  • The times for sunrise and sunset are displayed.
  • Yearly reminders will display a day in advance and on the day.
X10 Features:
  • All X10 signals that come across the powerline are displayed and optionally logged. If a "profile" was set up for the house and unit code, a friendly name will display - i.e. "Desk Lamp". The profile also has options for 3 levels of "beep", no display, and no logging.
  • Logs are written to the SD card as a text file readable by a PC. A new log file is automatically created each month.
  • The current status of all 255 devices is kept. The status table can be written to the SD card or cleared using the TV remote. The table will be used for one type of "macro" command.
  • A TV remote may be used to manually send X10 commands.
  • X10 commands can be set up to be automatically sent at certain times during the day.
  • X10 Macros are defined in a section of the setup file. Current types supported are; "if cmnd-then cmnds" (up to 5 thens), "if cmnd and time > x or < y then cmnd, if cmnd - display time, temp, etc. I am working on more types like "if temperature".
  • Nex10 will receive the temperature from a remote wireless sensor on a dedicated House Code. (See this.) The time and temperature is logged to a separate file on the SD card. The current temperature and the low and high temperature for the day is displayed in the display loop.
  • Alarms may be set to provide an audible warning if, for example, the the garage door has not closed in a certain time.
  • There's a good chance I forgot something.
Most of the time, the device is just listening for X10 commands coming from the PSC05. Once every 5 minutes or so, it goes into it's display routine and shows all the things listed above under clock features. The display routine can also be activated via the remote, or from a macro.

Credit and thanks to Bill Westfield, Andrew Hedges, and Bill Ho for the ht1632 code that writes to the Sure matrix, Bill Greiman for the fantastic SD card library fat16lib, B. Hagman for a slick non-blocking Tone library, and Mike Rice for a great little sunrise / sunset time calc. library.

Sunday, October 11, 2009

Nex10 Begins

I'm far enough along that I can be posting about this thing.

To the left is a PCB board I designed to be the platform for the "Nex10" - the next level of the "X10 Book".

The goal is to create an X10 controller that is user configurable without the need to change the software. The Nex10 is configured through text files copied to it's SD card. More on the functionality later. This post is about the hardware!

A larger picture of the board is here.

In order to support reads and writes of the SD card, I went with a larger microcontroller - the ATmega644P. This has twice the program space of the ATmega328 used in the X10 Book. The board also has an external EEPROM, RTC (real time clock), piezo, and IR detector. It also has a difficult to solder FTDI chip that allows it to be programmed via USB. I see this as totally optional. I just wanted one to make my development easier. Besides, it's pretty cool!

Other little goodies include a resettable fuse, ISP header, and jumpers for power, auto-reset, and ARef. It runs on regulated 5V and has a voltage regulator that supplies 3.3V for the SD card. It uses a 16MHz crystal or resonator.

I used CadSoft's Eagle to create the schematic and lay out the board and BatchPCB to fabricate it. This is Rev. 1, and amazingly everything worked. If I decide to make a Rev. 2 there are a few changes I'd make, but basically I'm pretty happy. (Eagle files here.)

This board will drive an 8x32 LED Matrix from Sure Electronics. This display is very easy to read, cheap, and uses SPI so no additional hardware is needed on the board.

There is nothing about the board that is dedicated to Nex10 application - it can be used for just about any microcontroller project.

If you'd like a board very similar to this one (with a serial interface), a fellow maker, Florin, sells an easy to solder kit. You can read about it here.

Thursday, May 21, 2009

The X10 Book

The X10 Book is the must useful project I've made with the Arduino. Again, I've already posted a lot of details on this elsewhere, so here I'll write about it from a different perspective (I hope).

The project is based on the Arduino interface to the PSC05/TW523 (see below) and an experiment on encasing electronic gizmos in a book.

It provides me with all the X10 functionality I had with with ActiveHome and a lot more. (I now use my CM15A only as a whole house transceiver.)

At the risk of repeating myself, for those who haven't read the links, here is a partial list of what it does:
  • Displays each X10 command that comes across the power line on a scrolling display. If it's a "known" house / unit code, it displays a friendly name like "Basement Light - On".
  • Stores a list of timed events like "turn on this light at 8PM, off at 10PM, on again at 11PM, etc.".
  • Checks X10 commands on the line, and trigger a "macro" if required - i.e "if garage Door open more than 10 min. display a warning, and trigger the sounder".
  • For defined X10 commands, light an LED and/or open or close a (10A) relay.
  • For selected commands, log the command and the time to an SD memory card that can be pulled and read by a PC.
  • Accept "special" X10 commands that provide variable data, such as temperature, from another X10 project I created (see next post). Note, these are not X10 "extended" commands.
So your saying "that's cool, good for you, but what about me?". Here is where I hope to be able to help by explaining the build process and offering a few tips. Since it's likely I don't know you, I'll imagine someone who is interested in X10, but has little or no experience with Arduino, some electronics, and an interest in programming. You are also patient, and motivated to help yourself. (Yuck, this is going to be long!)

The key things to remember, are that you don't have build all this functionality, you don't have to build it all at once, and you can build other functionality. You also don't have to build it the same way. For example you can use an LCD display instead of a scrolling LED matrix - much easier. If you use an LED matrix, there are several ways to drive it (i.e. MAX7221 vs "595's").

Another suggestion is to make the project in steps. Learn about and complete and test each step before going on to the next. This is where I think I can help the most. Below is the sequence of steps that I suggest you take to create an X10 controller with the Arduino.
  •  Get comfortable with the Arduino. Read the tutorials, join the forum, ask questions there, do some basic projects that interest you. (Get an Arduino with an ATmega328, you will need the room.)
  • Make a simple clock. I suggest a real time clock (RTC) based on the DS1307 chip. (IMO it's the simplest.)
  • For the clock, you will need a display. If you want a display on your controller, consider what you want there when considering your options. You have lots of options, but consider not biting off more that you can chew, you can always beef it up later. (i.e. A single color LED matrix is much simpler than a 2 color matrix.)
  • If you want a TV remote, figure out how to build that. I suggest a Sony protocol with a universal remote. For mine, I picked an interface that was interrupt driven rather than "blocking".
  • If you are going to display a lot of text, and to hold timed events, etc. get familiar with the I2C EEPROM.
  • This can be done earlier, but add the X10 stuff from here and here.
  • Recently, others have created some nice libraries that let you write to an SD card if you want a log.
  • Along the way, you have learned a great deal about electronics. Here is the schematic / wiring diagram for the X10 Book.
I'll add more to this list in future edits.