What microcontroller (and other components) would I need to create a timer device?
Asked Answered
R

7

10

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)

Reprovable answered 29/8, 2009 at 14:41 Comment(3)
How do you input the list? Serial port? Memory device? Hardcoding? Number pad?Caslon
Memory, I have updated the questionReprovable
added more info to the answerCaslon
C
10

Just use a PIC like 16F84 or 16F877 for this. It is more than enough.

As LCD use a 16 x 2 LCD. It is easy to use + will give a nice look to your project.

LCD

The language is not a matter. You can use PIC C, Micro C or any thing you like. The LCD's interface is really easy to drive.

As other components you will just need the crystal and 2 capacitors as oscillator + pull up resister. The rest of the components depend on the input method that you are going to use to set the times.

If you are using a computer to load the list then you will need additional circuit to change the protocols. Use MAX 232 to do that. If you want to use USB, you need to go ahead and use a PIC with USB support. (18F series)

alt text
(source: sodoityourself.com)

This is a set of nice tutorials you can use. You can purchase the products from them as well. I purchased once from them.

Caslon answered 29/8, 2009 at 14:45 Comment(4)
Thanks for the set of tutorials, great resource!Reprovable
A USB-to-UART adaptor could be used instead, removing the need for a MAX232; see my answer below.Nonentity
Why are there so many answers advocating PIC and not even mention AVR (which are pretty similar in regard to the question)? Is this like a religion?Ecumenicity
@ziggystar: Good question. My idea is something like this. Though we don't use Pascal today we use Pascal as a teaching language because it helps understanding the basics. I think PIC is the easiest and cheapest way to a beginner. Any other views? :)Caslon
A
5

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.

Area answered 29/8, 2009 at 15:34 Comment(2)
I have created a stackexchange proposal for the eZ430-Chronos Kit: area51.stackexchange.com/proposals/13122/…Coracoid
www.ti.com/launchpadwiki, you can get an msp430 kit for $4.30Area
D
5

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 :-)

Degraded answered 31/8, 2009 at 16:34 Comment(0)
N
4

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.

Nonentity answered 30/8, 2009 at 15:19 Comment(0)
M
2

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.

Malca answered 29/8, 2009 at 14:54 Comment(4)
Can the AC power frequency be considered as a high security oscillator? I don't think so.. :)Caslon
Yes it can. Your TV uses the AC frequency to keep time (which is why America has 60Hz TVs and Europe has 50Hz TVs). leapsecond.com/pages/mainsMalca
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.Sitarski
When there is a power failure? Assumes you are not getting such failures. In Sri Lanka we get a lot :)Caslon
C
1

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/

Chery answered 29/8, 2009 at 14:54 Comment(0)
F
0

PIC series will be good, since you are creating a timer, I recommend C or Assembly (Assembly is good), and use MPLAB as the development environment. You can check how accurate your timer with 'Stopwatch' in MPLAB. Also PIC16F877 has built in Hardware Serial Port. Also PIC16F628 has a built in Hardware serial port. But PIC16F877 has more ports. For more accurate timers, using higher frequency oscillators is recommended.

Flirtatious answered 25/9, 2012 at 8:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.