AVR Tetris

Tetris, the timeless classic, is one of those concepts that someone will try to run on every conceivable hardware platform. I took on the challenge of programming a Tetris clone from the ground up using hardware I had on hand. At the heart of the build is an ATmega168 microcontroller. The game displays on a KS0108 128×64 LCD module with five momentary push switches to provide directional, rotational, and input controls. You can see the resulting monochrome action embedded after the break.

I had several goals in mind while writing the code for the game.  I wanted the code to be portable so that the size of the board and type of screen used could be easily changed. With that in mind I developed the trunk for a Nokia 3595 cellphone screen and a parallel branch for the graphic LCD. Originally I was working with an ATmega8 but upgraded so that I could operate at the 3.3v the cell phone screen required.

The firmware for the graphic LCD branch compiles to just over 6 kB which means it can still be run on a mega8. Also, the ATmega168 is the same processor used in the Arduino Duemilanove so another Tetris port is not out of the question. I just got a hold of my first Arduino so we’ll see if I find time to start a new branch in the code.

Continue reading “AVR Tetris”

CES Update: Atmega128RFA1

After posting about our visit and interview with [Vemund], the Atmel rep at CES. We got the feeling you needed to know some more. The thing that has got us pretty excited is the ATmega128RFA1(pdf) single-chip microcontroller and Zigbee radio module. It can be found in the ATmegaRFA1-EK1 development board. We look forward to seeing future projects and products involving this chip. How would you use this chip?

Arduino I/O Speed Breakdown

[Jee Labs] has worked out how long it takes for an Arduino to perform various I/O operations. Predictably, analogRead() takes the longest, followed by analogWrite(). Arduino really falls behind when it comes to digital pin I/O: digitalWrite() takes a whopping fifty times longer than a direct bit write to a port register!  This is something to take into consideration when you are looking to do some beefy I/O with an Arduino. Perhaps this I/O performance will be addressed in the future with Arduino 1.0.

New AVR Simulator For Linux

simavr is a software simulator for the AVR line of microcontrollers. You might be asking why anyone would write this sort of thing considering the simulator provided with AVR Studio is a wonderful tool? Well, a lot of folks don’t run Windows and don’t wish to use that development environment even if Wine or Virtualbox could make it happen.

We haven’t tried it out ourselves yet. There is a discussion thread going that reports some positive results of using simavr with GDB and AVR Eclipse. It’s a new package, but so far it seems to have put its best foot forward. Currently there is support for ATtiny25/45/85, ATtiny13, ATmega48/88/168, andATmega164/324/644 chips. Several of the common on-chip peripherals are already supported with the others on the way.

Have you tried it out? Let us know what you think in the comments.

[IC Photo]

Automotive Current Monitor

If you’ve ever had a car with an electrical system problem you know how hard it can be to pin-point the source of your woes. Here’s a hackery solution that uses a diy PCB to monitor the current being drawn off of the alternator.The sensing is provided by an Allegro ACS758 integrated circuit. This chip measures current up to 150A and outputs an analog signal that can be measured by a microcontroller. In this case an AVR ATmega8 measures the signal and spits the info back to a PC via the serial port. This data can be graphed to help locate when too much current is being drawn for the battery to remain charged.

Check out that CNC milled PCB, what a beauty!

[Thanks Joshua via Elektronika]

IPv6 To 1-wire Protocol Translator

[Fli] assembled an AVR based system that can assign IPv6 addresses to 1-wire components. An AVR ATmega644 microcontroller is used in conjunction with an ENC28J60 ethernet controller chip. To get up and running with IPv6 on this meek hardware [Fli] ported the uIPv6 stack from the contiki project over to the AVR framework. Although he encountered some hardware snafus along the way, in the end he managed to get five sensors connected to the device, each with their own IP assigned using the stack’s alias capability.

This is great if you’re looking for a low-cost IPv6 solution. We’re not sure if there’s much demand for that, but it’s useful for that 1-wire home automation setup you’re considering.

Building Capacitive Sensitive Floor Tiles

That title’s a mouthful but you’re already familiar with the technology and application of foot pads as sensors in games like Dance Dance Revolution. The usbddr project sought to make a USB connected DDR controller from scratch. The microcontroller used is an Atmel ATmega8 running the V-USB firmware for connectivity and uses the analog to digital converts to read in data from the capacitive sensors.

The physical implementation is cleaver. The base plate has a capacitor plate attached to the top of it and the tile has the other capacitor plate attached to the bottom of it. The two are separated by some weather-stripping which is spongy enough to allow compression, bringing the two capacitor plates together.

We’re not convinced of the long-term durability of the system. We certainly don’t think it will hold up to very much hard-core DDR playing. But we would love to see a Super Mario RPG style puzzle to unlock the door to the ‘castle’ at a child’s birthday party.

[Thanks Hans]