Saturday, April 14, 2007

Simple USB LCD

In this post I will describe a simple way to add a LCD (HD44780 based) to a computer via USB. Besides a LCD the only component needed is a FTDI FT245-chip (or any other FTDI-chip that supports asynchronous bit bang mode). These can either be bought unsoldered for $4 if you have the means to manually solder it (empty breakout board is $3), or they can be bought presoldered on a breakout board with USB connector for $15. You'll also need a USB cable for about $2. All prices are from Spark Fun Electronics. If you live in Europe (I'm from Sweden) you can get FTDI-chips from Lawicel or Farnell, they both have low shipping costs. If you have access to etching equipment you can easily make the breakout board yourself and save some money. Here´s an 600dpi etch mask for a SSOP-28 breakout board (it can be made smaller, this was just a quick auto routing in Eagle):

Once you have your FTDI-chip mounted on the breakout board, connect the FDTI-chip to the USB-cable in the simple bus-powered configuration (see FT245 datasheet) and connect the LCD to the FTDI-chip as follows (NC= not connected):

FTDI: D7 D6 D5 D4 D3 D2 D1 D0

Here are some photos of my test setup:

Install the D2XX drivers from FTDI and you´re good to go! I've made a sample application that prints text to the LCD using the D2XX drivers, you can get it from Google code:

D7 (and optionally D4) can be used for general purpose I/O (buttons or whatever). There are FTDI drivers for Linux, Windows and Mac OS and bindings for C/C++, C#, Java, etc, so it should be easy to make it work cross platform. It would be nice if someone wrote the code needed to make it work in common LCD programs like LCDproc, LCD4Linux, etc. Please let me know in that case :)

Some LCD links:
Nice LCD FAQ , User defined graphics , HD44780 code from LCDproc

Automatic Go game record - Saikifu

I started playing Go with my friend Björn about a year ago after watching Hikaru no Go. It's good fun :) While playing we found ourselves sometimes taking a picture of the board to be able to test variations of our moves later on. We also found ourselves not motivated enough to actually look at the photo afterwards and place it on a board :P That's when the idea to have a computer watch the game and log it automatically came about.
I wrote a small program that looks at a game of Go through a camera and logs it to a SGF file. The main GUI looks like this:

It also acts as an automatic game clock: when black places a stone blacks timer stops and whites timer starts to tick and the other way around. If there is any interest i could add different byoyomi time control methods to enable the program to act as a full-fledged Go game clock.
The program is written in java to be portable, using Java Media Framework API (JMF) 2.1.1e, J2SE 5.0 Update 6 and NetBeans IDE 5.0. It should work with most web cameras.
The code is available at Google code:

Just let me know if you want me to add some features :)


Friday, April 13, 2007

Simple AVR wireless communication using Cypress Wireless USB modules

A simple way of adding wireless communication to your electronics projects is by using wireless USB modules by Cypress. These 2.4 GHz tranceiver (both TX&RX on each module) modules have very low power consumption, over 50m range (over 200m with non-PCB antenna) and cost $10 in quantities of 1 (one). Cypress also offer samples of all their wireless products so you can test them out before you buy. I will show how to interface the CYWM6934 and CYWM6935 modules (they are pin compatible and interchangeable, just different range) (it should work with the CYWM6935PAEC aswell since it's just a CYWM6935 with a power amplifier) with a Atmel AVR mega8 microcontroller.
The modules consists of a wireless transceiver (CYWUSB6934 or CYWUSB6935), a PCB antenna, some passive components, a crystal and a pin header for connecting to the module. Communication between the transceiver and the AVR is done via SPI, which the AVR has hardware support for. The only components needed besides the AVR and the module is +5V and +3.3V power supplies. I used L7805CV for +5V and LM317T for +3.3V (better to use a dedicated 3.3V regulator, but couldn't find one on short notice).
To have something fun to send over the wireless link I connected a Dallas DS1820 temperature sensor (also available as samples) to the transmitting side (any DS18X20 sensor works, DS1820, DS18S20 and DS18B20). To read the temperature sensor I used a collection of code from Martin Thomas. I also used some USART code from Jaakko Ala-Paavola. The following photo shows the first test setup with two CYWM6934 connected to one AVR mega8 each.

After initial testing I moved the module with the temperature sensor to a separate board for range testing. Pinouts for the modules can be found in their datasheets and pin connections to the AVR can be found in the source code (wireless_tx.c and wireless_rx.c).
My code for interacting with the wireless module is available on Google code:

Have fun!

Altec Lansing ACS295 Subwoofer hack

This page will show how to use the subwoofer from the Altec Lansing ACS295 2.1 speaker kit as a stand alone active subwoofer without using the satellite speakers. The speakers are controlled from one of the satellites (as seen in the picture below, the controls are on the left satellite speaker) so if the satellites are lost the subwoofer is dead in the water..

We (me and Fredrik) found two of these subwoofers at a second hand hifi shop and wanted a active subwoofer for a home cinema. There where no sattelites and searching the web we only found other people wanting to know how to use the subwoofer stand alone and that Altec Lansing isn't exactly handing out datasheets :P Thus, we took the subwoofer apart and analyzed/traced the circuit board. Here are some high resolution photos of the board:

The speakers are controlled by a TDA7433 audio processor that speaks I2C with the controls on the satellite. This is a pinout of the connection to the satellite (red connector in the picture above from Dells support page):

After studying the datasheet for TDA7433 and this page about I2C I wrote a controller program for a Atmel Mega8 using avr-libc and connected it to SDA and SCL together with 4.7kOhm pull-ups (there are no pull-ups on the circuit board inside the ACS295). Power the amplifier on by connecting the power pin to ground as shown in the pinout above, send the right parameters via I2c and eureka, we have a working subwoofer! :D Unfortunately Altec chose a cheap plastic to cover the back of the subwoofer and this plastic vibrates and makes a noise when the base is pumping :( Let me know if you find a solution to this (we are thinking of replacing it with wood).
I've made the source code for the AVR I2C controller available at google code: (google is closing down code so the source has moved to github:
I´d be happy of you post a comment if any of this is useful to you, happy hacking!