home about



SPI-X10 Technical Details


The SPI-X10 board (and chip) offers a simple way to access X-10 power line devices. The chip handles the precise timing required to interface with X-10's power line interface module. Using the line interface module provides a safe way to work with the power line signals, offering internal opto-isolation on all signal lines leading to the SPI-X10 chip.


SPI-X10 used with ModCon microcontroller.




The SPI-X10 is based on the PIC '62 family of microcontrollers. The PCB contains all the necessary circuitry to support the PIC processor, and provide connections for the different interface connectors. Two LEDs are provided which show activity on the board. Two 100 ohm resistor network devices are used which help with ESD protection.



The SPI-X10 PCB Layout




SPI-X10 Schematic (click here)



The next figure shows what the SPI signals going to the SPI-X10 look like. This sample shows an X10 output packet that turns unit number A1 on.



Example sequence showing SPI data being sent to the SPI-X10 chip. The most recent keycode (if any) is sent to the microcontroller during byte 0 through the MISO line.



Construction. Begin assembly by laying out all of the components so that they are easy to locate. Start by installing resistors R1 through R7, using the layout diagram, figure 6. Install capacitor C1, making sure the long lead goes in the hole marked +. Install C2 next to C1. Next C3 and C4 should be installed. LEDs 1 and 2 can be installed, again so that the long lead goes in the hole marked +. Next install the long resistor networks RP1 and RP2. Be sure that they are in the correct holes before soldering since they will fit in the holes for J2 as well.

Install the resistor networks by placing the pin marked with a stripe in the hole with a square pad, on the left end. Install the crystal, X1. Install the socket for U1 making sure the end with the notch goes to the left as indicated in the layout diagram. Install J1. Note that there is a small triangle on the outside of the connector indicating pin 1. This should go to the top right in the square pad. It is a good idea to first take a permanent marker and make this mark more visible. Install single row headers at CB1 and CB2. Cut the trace under CB1 on the bottom of the PCB that is shorting the pins marked "S" so that the stand-alone mode can be used. Install the jumper plug over the two pins marked "1." J3 can be installed next. The plastic posts should snap firmly into the holes provided. Last, install the single row header at position J2. Plug the SCI-X10 chip into the socket, making sure pin 1 is to the left.


Byte Coding Purpose Example
1 0000HHHH Packet type (0)=5 byte packet
House Code (0-15)
00000000
2 0000FFFF X-10 function
(see table 2)
00000100
(dim funct)
3 DDDDDDDD Dim level (number of
bright or dim commands to send
00000111
(7 levels)
4 VVVVVVVV Units to be affected
(units 16 through 9)
00001000
(unit #12)
5 VVVVVVVV Units to be affected
(units 8-1)
00000001
(unit #1)

Table 1. SPI packet format for X-10 transmissions. The example column
shows what would be sent to dim units #1 and #12 down 7 steps.

If use of the local keypad is desired, any junk box push buttons or a commercial matrix keypad can be used for the switches. Wire the keys according to Figure 7. For merely testing local mode, only a few buttons need to be wired up, such as the "1" and "on" buttons.

Function
Code
Purpose
0000
0001
0010
0011
0100
0101
0110
all units off
lights on
ON
OFF
dim
bright
all lights off

Table 2. Byte 2 function codes

If a commercial keypad is used, note that the order of the pins on the keypad may not be the same as on the SPI-X10 board's J2. The author's prototype used a Pactec HP-9VB keypad. An adapter cable is needed to put the pins in the right order as shown below. (This may be made available on the authors web site, depending on response). This should not be a problem, since typically the keypad will be mounted some distance from the SPI-X10 PCB requiring longer wires anyway. Note that pin 1 on the Pactec connector is nearest column 4 as given in the instruction sheet. Ignore the pin 1 mark on the connector.

SPI-X10
J2 Pin
PACTEC
HP-9VB
Pin
Function
1 7 Row 6
2 9 Row 5
3 10 Row 4
4 5 Row 3
5 1 Row 2
6 2 Row 1
7 8 Column 1
8 6 Column 2
9 4 Column 3
10 3 Column 4

Table 3. Pactec keypad adapter cable.


Microcontroller test: Remove the power connection if using J4 (Aux power). Move the jumper on CB1 to the "S" position (shorting pins 2 and 3 of CB1). Connect J1 to a microcontroller set up for SPI operation. The author tested with this with the ModCon controller listed in the parts list which uses the HC11 microcontroller.

Two microcontroller tests are available. Keytest.asm returns with the last key pressed on the SPI-X10 keypad; X10test.asm sends packets to trigger X-10 transmissions as well as returning with any keys pressed.

HC11 users can assemble and use keytest.asm or use the pre-assembled file keytest.s19. Once loaded, the keytest program will retrieve any key code that is waiting, as indicated by LED2 being lit. Press a key on the local SPI-X10 keypad or short the pins for row 1 and column 1 together. LED2 should be lit. Type "call 100" to run keytest. The number it indicates should be the key number pressed. Example 1 shows what the results should look like.


Example keypad layout showing matrix keypad connections

Here is an example of a keypad that can be used with the SPI-X10 board. Any keypad can be used, up to 6 X 4 buttons. The layout below shows the connections that are used when the keypad directly triggers X-10 output, If the board is not triggering X-10 output (jumper CB2 installed), the keys can be used for any purpose.




BUFFALO 3.2 (int) - Bit User Fast Friendly Aid to Logical Operation

>load t

[text upload of "keytest.s19" done here]
done

>call 100

SPI Returned:00
P-0100 Y-FFFF X-01FF A-0D B-FF C-D0 S-0047

[key 1 pressed here]
> [return pressed - re-executing the call 100 command]

SPI Returned:01
P-0100 Y-FFFF X-01FF A-0D B-FF C-D0 S-0047

[key "OFF" pressed here]
> [return pressed - re-executing the call 100 command]

SPI Returned:15 [15 Hex = Key number 21]
P-0100 Y-FFFF X-01FF A-0D B-FF C-D0 S-0047
>

Example 1: Retrieving keycodes through the SPI interface

The next test demonstrates how to control X-10 devices from a host controller. Assemble x10test.asm or use the pre-assembled x10test.s19. There are several entry points into this program. An area of memory (locations $01F9 - $01FE) is set aside that represents exactly which bytes will be sent to the SPI-X10 chip. This makes it easy to change the values, then call the routine that sends these values to the SPI-X10 chip. The command Call 100 initializes these values to reasonable defaults. Call 103 sends what ever is in these memory locations to the SPI-X10 chip. Call 106 sends a sequence that will first turn on A12, then wait, then turn off A12.

>load t
[text upload of "x10test.s19" done here]
done

>call 106

SPI Returned:00
SPI Returned:00
SPI Returned:00
SPI Returned:00
SPI Returned:00
[pause... light A12 goes on]
SPI Returned:00
SPI Returned:00
SPI Returned:00
SPI Returned:00
SPI Returned:00
[light A12 goes off]

P-0106 Y-FFFF X-01FF A-0D B-FF C-D0 S-0047
>

Example 2: Transmitting X-10 sequences from a microcontroller.

A basic home automation system can be created by adding the Digital Input Board. For example simple pushbuttons can be placed around the home. One in your TV room can turn on the TV, dim the lights and brighten accent lighting. A pushbutton placed near your bed can serve as an "All Off" button - which will turn off all X-10 modules, not just those on the same house code if you wish. The software included with the Digital Input board allows you to "script" any sort of action according to the input number.

To find out more:
For the latest product information on the SPI-X10 system, visit: Dimmers and other X-10 devices can be purchased online at http://www.gohts.com/ or at http://smarthome.com And of course the X10-USA site is a good resource: x10.com.

* X-10 is a trademark of X-10 Ltd.

Copyright 1986-2024   Zorin   Seattle, WA   (206) 282-6061