Tag Archives: AVR Studio

“Clock with Tics” using JY-MCU 3208 module

JY-MCU 3208 Clock with Tics
JY-MCU 3208 Clock with Tics

The “Clock with Tics” project now comes in two production models:

  1. Using the SURE 0832 module — the same module used in Media Circus
  2. Using the JY-MCU 3208 module

The SURE module is an LED matrix with a LED matrix controller built-in. A hand-wired board featuring an ATMEGA328 microcontroller, a DS-1307 battery chip with a button clock backup, and a 5v high-efficiency regulator drives the SURE module.

The JY-MCU 3208 also has the same matrix controller, but also includes an ATMEGA8 controller; no extra wiring is required except for a light sensor attached to a spare data input pin on the ATMEGA.

The JY-MCU 3208 currently sells for just over $12 at DealExtreme.com. It arrives with software that displays date and time using Chinese characters. Fortunately, the module includes a standard six-pin ISP connector that allows hobbyists to upload their own code using AVRISP mkII or other In-System Programmers. This version would not be possible without the replacement code provided by DrJones.

The ATMEGA8 does time-keeping using interrupts, and the program is uploaded to the module using the built-in ISP connector. This is a bare-bones design that does not have a voltage regulator, so you must be diligent in selecting a power adapter that delivers regulated 5v to the unit. I’ve blown a couple of the modules through inattention and stupidity.

My modifications to DrJones’ code include:

  • improved typography
  • auto brightness
  • re-assignment of the three control buttons

Only one hardware modification is required: for the auto brightness feature, connect one side of a CdS cell to 5v, and to the other side of the CdS cell make a direct connection to pin A0 of the ATMEGA8, and connect this point to ground through a 10k resistor. It’s a little tricky if you’re not used to surface-mount soldering; go here and here if you need some tips. If you don’t want to use the auto brightness, comment out lines 352-353 of file clockmtx004.c and recompile.

There are three small pushbuttons on the left side of the module which have been reassigned to provide the following functions, from top to bottom:

  1. Hour adjust – each press adds one hour, hold press to accelerate
  2. Minute adjust – each press adds one minute, hold press to accelerate
  3. “Child-safe” toggle – press once to turn off expletives, press again to turn them on

You can download the code in an AVR Studio 4 package—which includes all the libraries and makefile, and a compiled hex file—here.

As an update to my earlier post on the SURE unit: my clock with the SURE module uses amber LEDS; these have been discontinued by the manufacturer however, and only red and green are currently available. I was able to snatch up the last six amber modules from a Swiss supplier in January 2013. The JY-MCU module is only available in red.

Generaleccentric.net has more videos and photos of the Clock with Tics project.

Guide to Burning Arduino Bootloader using ZeptoProg II and AVR Studio

If you’re interested in working with Arduino microcontrollers, eventually you become hip to the idea that you don’t need to buy expensive Arduino UNOs for your projects. It’s relatively simple to wire up your own minimal Arduino, saving 80% under the cost of an UNO or Duemilanove. I develop on a Duemilanove, and when I need to commit the work to the final project, I can pop out the ATmega328 chip that’s in the Arduino and plug in a fresh ATmega328 to program it. Actually though, you can’t just use any ATmega328 chip — it needs to have a “bootloader” program flashed onto it before it can work with the Arduino system. You can buy ATmega328’s with the Arduino bootloader, but these go for around $4.00 each. You can buy the same chips without the bootloader for about a dollar less, or more than that if you buy in bulk.

To install the bootloader software, you need a device that hooks into the ISP plug on your UNO or Duemilanove. I had an AVRISP mkII that I bought a few years ago, but it stopped working so I needed a replacement. Although I could use my BusPirate as an AVR Programmer, the documentation for that uses the command-line AVRDUDE to communicate with the chip. I wanted to use a toolchain I was more familiar with, the free AVR Studio, version 4.

I bought the replacement a couple of months ago on ebay: ZeptoProg II is an inexpensive AVR programmer with USB interface, and works with AVR Studio. It also sports a 4-line logic analyser and frequency output and measurement, and a few other widgets that I probably won’t ever use.

Most of the time involved in setting things up relates to installing AVR Studio. The version I use is 4.18, so you need to download the core version and then upgrade it incrementally with several service packs. Although I’ve been a Mac person since 1984, I develop on a Win7 netbook partly because AVR Studio on Mac OS X has not been kind to me.

The Guide

I’ve prepared a PDF Guide to Burning Arduino Bootloader using ZeptoProgII and AVR Studio.

Once you’ve mastered this, you can go on to bypass the Arduino altogether: for example, if you are running out of space on your ATmega chip, you can erase the bootloader — gaining about 2k — and use the programmer to flash the HEX file that you created when you compiled the Arduino program onto the chip. An added bonus to removing the bootloader is that on power-up or reset, your project starts faster because it doesn’t have to run the bootloader code.