Blogs

Dimmer I

For a number of reasons, Jon and I are not happy with the powerline modem options. Chief amoung those reasons are that they are expensive and proprietary. Building them into our product seems to be too restrictive.

So, we decided to investigate the wireless options which seem to be improving in price recently. Bluetooth, Zigbee and Wifi are all comparably priced these days (<$10). However, Wifi seems to still require a somewhat expensive CPU to work and Bluetooth doesn't seem quite right for meshing networks. A closer examination of the Zigbee standard led us to believe that it is the cheapest and easiest low data-rate command network to deploy.

So, we decided to experiment with it by creating our own light switch dimmer. Since we might be abandoning Insteon, we will have to make our own dimmer/control panel for our product. Here is a picture of the layout:

You can find the light switch dimmer schematics here.
You can find the BOM here (OpenOffice Format).
Here are some things to note:

  1. CPU. We are using the Freescale MC13224. This is a third generation 2.4GHz 801.15.4 SOC. In addition to an integrated antenna transmit/receive it also has two ADCs and many GPIO lines. O... and it is very cheap. This makes it an excellent choice for a low cost dimmer.
  2. Antenna. We are using the Planar Inverted F Antenna recommended in the application notes of the MC13224. This antenna has a very good omni-directional pattern and is low cost due to it being constructed from copper on the PCB. The antenna is designed to be a quarter of a 2.4GHz wavelength (124.0mm) and have a characteristic impedance of 50 ohms.
  3. Power. The entire dimmer design runs 'hot'. That is, it is not issolated from the main AC power lines. This is typical for light switches but does pose a safty risk for the developer (I have a power limited AC source in my lab for safty). The DC voltage rail is formed by clipping the 170V AC signal with a 5.1V rectifier. To limit the current (so the rectifier doesn't burn up), a 1uF capacitor is put in series with the mains. This acts like a 2.6K ohm resistor which limits the current entering the circuit to about 50mA. A 100mA 3.3V regulator is then used to stabalize the board power.
  4. Triac. We are using a 600V, 4A triac to control the power to the load. The MC13224 controls the duty cycle of the triac so that it is only on during part of the AC sinewave. This has the effect of varying the power to the load (thus, dimming it).
  5. Power Monitor. We have put a 0.050 ohm resistor in series with the load in an attempt to measure the current going to the load. The MC13224 has an integrated 12bit ADC so by measureing the voltage drop across the shunt resistor, we should be able to estimate the current. Since the curcuit also includes a zero-crossing detector, we should be able to calculate the power (including power factor) going to the load.
  6. Temperature Monitor. We decided to include another circuit to measure the voltage drop across a varistor that is sensitive to temperature.

Prototype VI - First Music!

DigiSpeaker Prototype VI hit a major milestone this week. The Prototype VI Controller and Amp boards were able to play a WAV file!

Here is a picture of the two boards connected together. The Controller is on the left and the Amplifier is on the right. The AC cord coming from the upper left corner of the Controller card is connected to a powerstrip that has another powerline modem plugged into it. This provides the Controller card with its Ethernet link. The digital power supply is connected to the Controller card with the yellow cable. The orange cable is connecting +3.3V to the digital section of the Amplifier. Digital ground is connected to Amplifier board via the ribbon cables (about every other wire). However that digital ground is kept isolated from analog ground on the Amplifier (only connected at a single location -- as recommended by the DAC datasheet).

To play music, I wrote a three small programs. 'ampcmd' can be used to toggle the Amplifier control lines (reset and mute) and I2C registers. 'amptone' can be used to play square, triangle and sine waves. 'ampwave' can be used to play a WAV file. The source code for all three of these programs is attached.

Here is a picture of the amplifier. Two I2S signals from the Control board enter on the left through the ribbon cables. They are processed by the DAC (a TI PCM1690 on the left). The differential outputs of the DAC are then buffered and filtered by the two dual N5532s. This produces four outputs (two per I2S channel). The channels of the first I2S signal (left and right) are each fed into one side of the LM4765 for amplification. Likewise, the channels of the second I2S signal are fed into the second LM4765. However, in this case, the fourth channel is not used. Instead, the third channel is fed into both sides of the second LM4765. In this case, one side of the second LM4765 is non-inverting and the other is inverting. Speakers are then floated between the two amplifier outputs to create a BTL signal. This provides three channels of music that are intended for tweeter (30W), mid-range (30W) and woofer (60W).

Notice the large heatsinks connected to the two LM4765s. Those are actually fence building hardware that I found at Lowes and hacked up to make heatsinks for the amplifiers. Without them, the amplifiers went into thermal overload at very low power levels.

Here is a picture of the control board. This is not much different than previous posts. However, one significant difference is how the I2S channels are connected. In this case, Codec1 (PSC1) is used as the master I2S controller and Codec2 (PSC2) is in slave mode. Notice the wirewrap jumpers (in red) near the ribbon cables. This is where the bit-clock and the frame-clock of Codec1 is connected to their counterparts of Codec2.

Prototype VI - Amplifier

Jon wanted an amplifier that he could use to test tri-amping and room correction algorithms. We could have used our TAS5504 evaluation module but we wanted to gain some experience with Class AB amplifiers so we decided to make a board based on the National Semiconductor LM4765 audio amplifier. This is a dual amplifier package that can deliver up to 30W per channel.

The schematic is here.

  1. Amplifier.
  2. Each amplifier can be configured for Inverting or Non-Inverting operation. Also, each pair of amplifiers (U1 and/or U2) can be configured for BTL operation. This lets Jon configure one LM4765 as the tweeter and the mid-range while the other LM4765 can be configured as BTL for the woofer. Roughly, this should provide 20W/20W/40W for the tweeter/mid-range/woofer.

  3. DAC.
  4. We selected the PCM1690 from TI as the Digital to Analog converter. This part has excellent SNR (113dB) in a compact multi-channel package.

  5. Power Supply.
  6. The board takes +5V and +-24V. The +-24V is then cut down to +-15V using one LM317 and one LM337. The digital logic is supplied (+3.3V) by the interface board.

The Bill of Materials is here.

The layout is below. Click on the image to get a larger/detailed PDF.

Evaluating Zigbee

I bought an Atmel Raven development kit so that I can work with Zigbee.

The LR44 batteries that came with the board lasted 48hrs. So I needed a permanent power solution. The simplest way to power a Raven board is via a USB cable. Cut the end off from it to get at the wires inside. Solder red(+5)/black(GND) to the PCB. Note that you hook power up on pins 1/2 of J401 - not where the power jumper is located. +5 on pin 1, GND on pin 2. Use a powered hub as a power supply and you can move the boards away from your PC.

The demo firmware that comes with the boards, is for.. demos. I quickly figured out that I needed to write new firmware. Of course I don't have any way to load this new firmware into the device. I have to get a JTAG that works with Atmel products like the AVR JTAGICE mkII. Lucky for me Arrow is running a half price sale on the JTAG unit. $150 plus $8 shipping is cheaper than you can buy a clone unit from China.

Now I need to start learning about 802.15.4, 6LoWPAN, Zigbee profiles, etc...

Siemens has started an open source Zigbee implementation for Linux. But as soon as I started looking at it I discovered that the license from the Zigbee alliance for using the Zigbee spec is incompatible with the GPL. A request has been made to the Zigbee alliance to fix their license so that it is GPL compatible. We don't have an answer back from them yet.

We are primarily focused on using Insteon in our product, but we are hedging out bets. There is another set of licensing complications around Insteon that we haven't resolved with Smart Labs.

I looked a little at Z-wave. Like Insteon, Z-wave is controlled by a single vendor, Zensys. I haven't explored the licensing world of Z-wave yet.

MPC5200 AC97 ALSA driver

As part of a deal with Phytec I wrote an AC97 driver for their mpc5200 development system. We use these Phytec boards as a prototype platform. They are reasonably priced and they work well.

The code for this driver has already been accept for the Linux kernel and it will appear in 2.6.31. AC97 and I2S are both implemented by the same PSC block on the SOC. This code will become the basis for the tri-amp Digispeaker I2S driver.

While I was at it I also implemented AC97 support for the Efika. The Efika is a $99 mpc5200 based development board available from Directron. The Efika was useful for driver development since it has USB and a PCI slot. The current version of the Phytec development system has now added these features making the Efika less useful. Note that it is hard to add custom hardware to an Efika since they didn't bring all of the pins out form the CPU.

Syndicate content