Making PCBs Using the Toner Transfer Method

December 17th, 2011

I've been making a bunch of breakout boards recently using the toner transfer method. I think I've finally nailed the procedure such that I get good, repeatable results. The following wiki article only explains how to do the transfer, generating the layout and etching is pretty straightforward (links are provided to some good guides). I've been using gEDA's "pcb" software to layout the board and a cheap bottle of ferric chloride for etching.

Here's a link to the article: Making Printed Circuit Boards Using the Toner Transfer Method

Using an HD44780-based display with a TI MSP430 microcontroller

November 5th, 2011

I've recently been tinkering with TI's MSP430 line of 16bit microcontrollers thanks to the crazy-cheap MSP430 Launchpad development board. For less than $5 you get a USB programmer, an in-circuit debugger (that works with GDB!), and a USB to serial converter. There's pretty decent Linux support for these chips, much like with Atmel's AVRs you have a GCC port (msp430-gcc) and software to program the chips (mspdebug, which also doubles  the in circuit debugger and GDB proxy). Overall, I'd say I like MSP430 better than AVR. The documentation is better (although there's much less user-generated content/code), the header files make more sense (register names stay the same between chips, and there's no 1<<PB4 nonsense, bits are actually defined as bits, not shift increments), and most importantly, the development environment is cheap and not at all intimidating (ie. I didn't have to build my own programmer).

Anyway, gloating about the MSP430 wasn't the purpose of this post, it's about a simple HD44780 driver library I wrote for use with MSP430 microcontrollers. The library is written such that at a clock frequency of 16MHz, the display will be written to as fast as possible (with respect to the timing requirements set forth in the datasheet). The example compiles down to roughly 450 bytes which isn't too bad, if you manage to cut it down, let me know :)

All the information you need is available on the wiki.

Mazda’s Entertainment System, More Information Than You Require

August 19th, 2010

For the past couple weeks I've been working on adding an auxiliary input to my car's stock head unit. Mazda didn't make it easy but in the end I think I have a nice solution that works pretty well.

What you see above is a little board that pretends to be a tape deck in order to trick the head unit into opening up the tape deck's audio inputs. It also is capable of interpreting commands from the radio and sending them to an iPod which makes changing songs on the road a lot easier and safer.

I titled this post "More Information Than You Require" because I put up a series of pages on the wiki completely documenting the protocol used by the head unit as well as schematics and source code so you too can build a tape deck emulator.

Simon Says

July 15th, 2010

In an effort to learn more about the capabilities of Atmel's range of "tiny" AVR microcontrollers I decided to build clone of the popular "Simon Says" game using an ATtiny45.

The completed circuit (click for larger version)

The gist of the game is that it blinks out a pattern using the LEDs and you simply have to key in the same pattern to advance to the next level. The patterns get longer as the game goes on in order to increase the difficulty.

Hardware

My challenge was to use as little hardware possible to make a working game. I started by selecting the smallest microcontroller I had, the 8 pin Atmel ATtiny45, followed by 4 normally open switches, 4 LEDs and 8 resistors. The board is powered by 2 AAA batteries, and there is no on/off switch. The circuit can always remain powered on because I took take advantage of the AVR's "power down" sleep mode. When the unit is "sleeping" it only consumes 0.2 micro-amps of current.

Since the AVR I'm using only has 6 I/O pins, each LED shares a pin with a switch in the following configuration: This allows me to use a single pin as both an input and an output. The only downside to this configuration is that you can't simultaneously use the output and the input, but this is acceptable for my application. Also, every time the user closes the switch the LED will light up, but this is also not a problem for my application. In fact, it gives the user a visual cue that let's them know they pressed the button which means I don't have to do that in software.

The full schematic is available at the end of this post (not that it's much more complicated than what you see above).

Software

As is customary with AVRs, the software is written in C using the tools from the AVR Libc project. I tried to take advantage of as many features of the ATtiny45 as possible to make this project a little more interesting. The seed value for the random number generator for instance is generated by using the analog to digital converter. The game saves power by powering down the AVR after a preset timeout (using one of the 8bit timers) and game progress is never lost because roughly every 4 seconds the game state is saved to the AVR's non-volatile EEPROM memory.

The random number generator is a simple linear feedback shift register using a Fibonacci feedback function (see the wikipedia article for all the gory details). To keep things interesting, the random number generator is seeded with a random number each time the device is reset. Generating the random seed value is actually not that difficult, but it is time consuming (for the microcontroller). All ATtiny45's come with a built in temperature sensor which can be read using one of the analog to digital converter channels. It's a crappy sensor (accuracy of ±10°C) but if we sample it really fast with the ADC (to get as much noise as possible) a good 30-40 times in a row, we'll get a nice big kinda-random number which is temperature dependent!

Saving power is pretty easy, most of the AVR's peripheral devices can be powered down and which means that they only need to be using power when you need them. The ADC for instance is only powered up for reading the temperature sensor then it gets shut down. I even shut off the timer before putting the device in it's "power down" mode, which is why it can consume such little power while sleeping.

Downloadables

My Alarm Clock

February 2nd, 2010

For the longest time I've been using an old CRT television as my alarm clock. It was very simple, there was a sub-menu in the TV's setup menu that allowed you to set a time for the television to turn on. This worked great for many years until I got rid of the TV. I tried using a radio like a normal person but the television is far more effective. It combines light, sound, annoying commercials and terrible programming which gets me out of bed in no time.

So what's an average Linux user to do?

Turn an old laptop into a TV of course! With the help of XBMC installed on the laptop and my trusty MythTV backend I had everything I needed to make an IPTV. The laptop is an old Toshiba with an Intel Celeron processor, 768MB of ram and an Intel 915GM graphics card. It surprisingly runs XBMC pretty well at the screen's native resolution of 1280x800. This is great, now I have a TV again with all the added benefits of MythTV's PVR capabilities. Although, this still doesn't solve my alarm clock problem...

Or does it?

It turns out that there's a very simple way to get XBMC to play a live channel from MythTV. The following bash script does just that:

#!/bin/bash
 
XBMC="xbmcbox2:8080"
MYTHTV="USERNAME:PASSWORD@mythbackend1"
MYTHTV_CHANNEL="906"
VOLUME="60"
 
function xbmc_command(){
  wget -q http://"$XBMC"/xbmcCmds/xbmcHttp?command="$1" -O /dev/null
}
 
xbmc_command "SetVolume($VOLUME)"
 
MYTHFILE=myth://"$MYTHTV"/channels/"$MYTHTV_CHANNEL".ts
xbmc_command "PlayFile($MYTHFILE)"

Note: "xbmcbox2" and "mythbackend1" are hostnames, replace with whatever you're using (like IP addresses or your own custom hostnames).

By running the following script on any computer in your network the computer running XBMC (pointed to by the XBMC variable) will start streaming the channel you specified (by setting the MYTHTV_CHANNEL variable). It also sets the volume to an appropriate level in case I left it too high/low the night before. This script can be added to a crontab or to your favorite alarm clock program (like Kalarm or Alarm Clock).

In order for the script to work the computer running XBMC must be allowed to stream from the MythTV backend and XBMC must be configured to allow remote HTTP connections without a password (this could be fixed by using wget's --user and --password options).

Creating Animated GIFs from Video Files

April 13th, 2009

It's surprisingly simple to create an animated GIF from a video file using only free software tools. I'll be using Avidemux and the GIMP for this tutorial.

Set the beginning of the selection by clicking the "A" button

Set the beginning of the selection by clicking "A"

Read the rest of this entry »

Panucci 0.3 – A Polished Turd

March 30th, 2009

panucci-large1

After a lengthy testing cycle Panucci 0.3 has been uploaded to Maemo Extras and is available to all Maemo 4.1 (Diablo) users that have the Extras repo enabled. Panucci 0.3 is a big step forward from 0.2, here's a brief run-down of what's changed:

  • Bookmarks are stored in an SQLite database
  • Playlists (m3u,pls) are fully supported (importing and exporting)
  • Playlists can be modified on the fly:
    - Tracks can be added or removed
    - Tracks can be reordered (via drag and drop)
  • Bookmarks are now listed under the track name (using a treeview)
  • The code is much more modular and tries to respect a MVC architecture
  • Many more d-bus methods are now exposed through dbusinterface.py
  • Logging is much fancier thanks to python's logging module

As you can tell, these changes are mostly internal but we'll be able to see the benefits of these changes in the next release. Speaking of which, 0.4 development is already on the way. The GUI is going to get some nice improvements, here's a preview screenshot:

panucci-04

Special Thanks to all the people who made this happen:

  • Thomas Perl - http://thpinfo.com
  • Matt - From the panucci mailing list ;)
  • All the testers from ITT

More links:

Using The Xv Overlay Adaptor By Default

September 21st, 2008

For most people the overlay adapter is a better choice than the textured video adaptor because you can use it with compiz and it doesn't have horizontal tearing on fast action scenes. The disadvantage, as pointed out by someone in #gstreamer is reduced color accuracy (iirc) but I don't notice it...

If you have an Intel graphics card that's capable of using the Xv overlay adaptor here's how to enable it (for gstreamer):

Run gstreamer-properties (using Alt+F2)

Run "gstreamer-properties" (using Alt+F2)

Use the following settings

Use the following settings

For mplayer, find the port base of the overlay adaptor:

[nikosapi@localhost ~]$ xvinfo | grep -A2 "Video Overlay"
Adaptor #1: "Intel(R) Video Overlay"
number of ports: 1
port base: 81

Then add "vo = xv:port=81" (change 81 to whatever your port base is) to the [default] section of your ~/.mplayer/config. This is what my config file contains:

[default]
vo = xv:port=81

Bypass Bell’s BitTorrent Throttling With rTorrent

September 13th, 2008

This assumes you have tor and privoxy installed (and privoxy is accepting connections on port 8118).

rtorrent \
-i `curl whatismyip.org 2>/dev/null` \
-O encryption=require,require_RC4 \
-O http_proxy=127.0.0.1:8118

It's that easy ;)

UPDATE: You may need to disable DHT for this to work, add "-O dht=disable" to the command line or simply put "dht=disable" in your ~/.rtorrent.rc

Site Updates

September 13th, 2008

Today I finally got around to moving this website to a proper webserver with a ton of bandwidth :)

If you find any dead links/broken pages please contact me, I'll make sure they get fixed ASAP.