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.