Nexa Remote

downloads: 1024 | type: gz | size: 131.71 kB
  • Released: Oct 25, 2009
  • Requires: NEXA receiver + libusb

What is this?

This is a tiny device that will let you control lighting and other electrical equipment provided it is connected with a NEXA receiver module, a power plug that goes between the equipment you want to control and the wall socket. The device is connected to a USB port and is controlled with a command line tool.

I’ve only tested this on Linux, but it should work on Windows as well.

Hardware

I chose to build the device around an ATTiny2313 micro controller from Atmel. This device does not support USB natively, but thanks to a software-only-solution provided by Objective Development, this is no longer a problem. The driver will handle all USB communication without the need for extra hardware.

The following components are needed to build the device. Total cost is approximately 100-150SEK.

Name Description Value
C1 Electrolytic capacitor 2.2uF
C2 Ceramic capacitor 47pF
C3 Ceramic capacitor 47pF
C4 Ceramic capacitor 100nF
D1 Zener diode, BZX55C3V6 3.6V
D2 Zener diode, BZX55C3V6 3.6V
IC1 Microcontroller, ATTiny2313
JP1 USB cable connection
JP2 Antenna
JP3 ISP header
LED1 LED, 5mm RED
Q1 Crystal, 30pF, HC-49/S 12MHz
R1 Resistor 330 Ohm
R2 Resistor 68 Ohm
R3 Resistor 68 Ohm
R4 Resistor 1.5 kOhm
R5 Resistor 10 kOhm
TX1 433.92MHz transmitter module (3-12Vdc/10mW)
  • The LED and its current limiting resistor (R1) is optional. The LED will be lit during transmission, and the commandline tool has an option to control the LED for testing purposes.
  • The ISP header (JP3) is optional. It will let you program the device in place, mount on circuit board
  • Instead of mounting a USB connnector on the circuit board, I took an old USB extension cable.

The antenna is a bit more complex than just a piece of wire and I’m far from an expert on the subject (RF and antennas are kind of black magic to me). A professional antenna will probably improve the range, but you can get away with a home built one too. I found three models of interest:

  • The simplest antenna you can make is a so called “whip”, a quarter wavelength straight wire that points away from the groundplane. At a frequency of 433.92MHz, the length should be approximately 17cm (7500/frequency).
  • The short whip is similar, but with a slightly shorter wire and to compensate for this you coil it near the base.
  • The helical antenna is a fully coiled wire. You wind a 2 or 3 times longer wire into a long coil, cut it so it resonates. You can fine tune it by spreading or compressing the length of the coil.

I chose the helical model but did no calibration so I have no idea how well it performs (I have no equipment to measure this). Tests in my apartment show that I can reach all parts of it so I’m happy.

Circuit Board

It isn’t very difficult to build this circuit on a breadboard, thanks to the low part count. I haven’t had the time to do a real PCB yet, and the current prototype is working so well I haven’t felt the need for one. But, since some friends of mine have shown interest in this project, I guess I’ll have to do one sooner or later. When I do, I’ll include it in the downloadable file.

Software

The micro controller isn’t of much use without the software to control it. The download above contain both micro controller firmware and the host software (a command line tool). Firmware is provided in both source code form, in case you need/want to modify it, and as a HEX file, ready to programmed with suitable equipment, so there is no need for a cross compiler tool chain, unless you intend to modify the code.

You will need additional software and hardware in order to program the micro controller. Search the net for AVR and ISP, there are plenty of circuits out there that are easy to build (mine is connected to the parallel port and contain only a couple of resistors and diodes). As for programming software, avrdude is a nice program that support many models of both programmers and micro controllers.

Building the firmware and command line tool is easy. Just download the file above, extract it to a temporary folder, cd into it and execute make all to build both firmware and command line tool. Or you can type make firmware or make tool to build one of them.

The command line tool depend on libusb. Most Linux distributions provide this as an optional package, or you can download the source from the libusb project page. If you’re running windows and want to give this a go, visit the libusb-win32 project page instead.

Using the command line tool

Once you’ve compiled the command line tool, type control_nexa to get a short description on how to use the program.

$ ./control_nexa control_nexa v0.1 - Control lighting and electrical equipment

Usage: ./control_nexa led <on/off>......................Turn LED on or off
   or: ./control_nexa send <house> <unit> <on/off>......Turn NEXA on or off

NEXA is identified by a house code (A-P) and a unit code (1-16)

So, to turn on unit B 15, type ./control_nexa send B 15 on.

It’s as simple as that.

Comments are closed.