views:

846

answers:

6

As a hobby project to keep myself out of trouble, I'd like to build a little programmer timer device. It will basically accept a program which is a list of times and then count down from each time.

I'd like to use a C or Java micro controller. I have used BASIC in the past to make a little autonomous robot, so this time around I'd like something different.

What micro controller and display would you recommend? I am looking to keep it simple, so the program would be loaded into memory via computer (serial is ok, but USB would make it easier)

+8  A: 
Chathuranga Chandrasekara
Thanks for the set of tutorials, great resource!
Bob
A USB-to-UART adaptor could be used instead, removing the need for a MAX232; see my answer below.
Steve Melnikoff
+1  A: 

There are several ways to do this, and there is a lot of information on the net. If you are going to use micro controllers then you might need to invest in some programming equipment for them. This won't cost you much though.

Simplest way is to use the sinus wave from the power grid. In Europe the AC power has a frequency of 50Hz, and you can use that as the basis for your clock signal.

I've used Atmel's ATtiny and ATmega, which are great for programming simple and advanced projects. You can program it with C or Assembly, there are lots of great projects for it on the net, and the programmers available are very cheap.

Here is a project I found by Googling AVR 7 segment clock.

Marius
Can the AC power frequency be considered as a high security oscillator? I don't think so.. :)
Chathuranga Chandrasekara
Yes it can. Your TV uses the AC frequency to keep time (which is why America has 60Hz TVs and Europe has 50Hz TVs). http://leapsecond.com/pages/mains/
Marius
Thanks... :) A new thing to me..
Chathuranga Chandrasekara
What Marius's page doesn't mention is that the AC oscillations were at one time commonly used to run railway clocks and the like. In part, it has the advantage of being absolutely synchronous, but additionally the power companies adjust the frequency slightly as needed to keep the synchronous time accurate; if they drop some cycles, they'll add them back later.
Brooks Moses
When there is a power failure? Assumes you are not getting such failures. In Sri Lanka we get a lot :)
Chathuranga Chandrasekara
+1  A: 

A second vote for PIC. Also, I recommend the magazine Circuit Cellar Ink. Some technical bookstores carry it, or you can subscribe: http://www.circellar.com/

Tangurena
+4  A: 

I would go with the msp430. An ez430 is $20 and you can get them at digikey or from ti directly, then sets of 3 microcontroller boards for $10 after that. llvm and gcc (and binutils) compiler support. Super simple to program, extremely small and extremely low power.

dwelch
I have created a stackexchange proposal for the eZ430-Chronos Kit: http://area51.stackexchange.com/proposals/13122/ti-ez430-chronos-development-tool?referrer=YppEIivQP8lCxT7Iq4t4JA2
lImbus
+3  A: 

I agree with the other answers about using a PIC.

The PIC16F family does have C compilers available, though it is not ideally suited for C code. If performance is an issue, the 18F family would be better.

Note also that some PICs have internal RC oscillators. These aren't as precise as external crystals, but if that doesn't matter, then it's one less component (or three with its capacitors) to put on your board.

Microchip's ICD PIC programmer (for downloading and debugging your PIC software) plugs into the PC's USB port, and connects to the microcontroller via an RJ-11 connector.

Separately, if you want the software on the microcontroller to send data to the PC (e.g. to print messages in HyperTerminal), you can use a USB to RS232/TTL converter. One end goes into your PC's USB socket, and appears as a normal serial port; the other comes out to 5 V or 3.3 V signals that can be connected directly to your processor's UART, with no level-shifting required.

We've used TTL-232R-3V3 from FDTI Chip, which works perfectly for this kind of application.

Steve Melnikoff
+2  A: 

There are many ways to do this, and a number of people have already given pretty good suggestions AVR or PIC are good starting points for a microcontroller to work with that doesn't require too much in the way of complicated setup (hardware & software) or expense (these micros are very cheap). Honestly I'm somewhat surprised that nobody has mentioned Arduino here yet, which happens to have the advantage of being pretty easy to get started with, provides a USB connection (USB->Serial, really), and if you don't like the board that the ATMega MCU is plugged into, you can later plug it in wherever you might want it. Also, while the provided programming environment provides some high level tools to easily protype things you're still free to tweak the registers on the device and write any C code you might want to run on it.

As for an LCD display to use, I would recommend looking for anything that's either based on an HD44780 or emulates the behavior of one. These will typically use a set of parallel lines for talking to the display, but there are tons code examples for interfacing with these. In Arduino's case, you can find examples for this type of display, and many others, on the Arduino Playground here: http://www.arduino.cc/playground/Code/LCD

As far as a clock is concerned, you can use the built-in clock that many 8-bit micros these days provide, although they're not always ideal in terms of precision. You can find an example for Arduino on doing this sort of thing here: http://www.arduino.cc/playground/Code/DateTime. If you want something that might be a little more precise you can get a DS1307 (Arduino example: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1191209057/0).

I don't necessarily mean to ram you towards an Arduino, since there are a huge number of ways to do this sort of thing. Lately I've been working with 32-bit ARM micros (don't do that route first, much steeper learning curve, but they have many benefits) and I might use something in that ecosystem these days, but the Arduino is easy to recommend because it's relatively inexpensive, there's a large community of people out there using it, and chances are you can find a code example for at least part of what you're trying to do. When you need something that has more horsepower, configuration options, or RAM, there are options out there.

Here are a few places where you can find some neat hardware (Arduino-related and otherwise) for projects like the one you're describing:

There are certainly tons more, though :-)

James Snyder