# First post: best place for this?

Discussion in 'Electronic Basics' started by Ed, Apr 13, 2007.

1. ### EdGuest

(Earilier posted in .design - moved here by recommendation.)

Many moons ago, I was an electronics repairman in the military. Most
tubes had been replaced by then with solid state, which of course was
gaining wide use in the commercial world! I was a dabbler in
circuitry, and devoured the TTL Cookbook I bought at Radio shack
along
with any component I wanted.

25 years later, Radio Shack is something different and so is
electronics. I'm sure E=IR still works, but I'm not sure what they
do
with it any more! The most I get to do with "electronics" is change
a
ballast in a flourescent light! Everything seems to be programmed -
well, I dabble in VB6 and VBA macros, but that's it. But I've got a
couple of things I'd like to see if I can cobble together, and I'm
wondering if this is a good place for me to start.

Two projects right now:

Project 1: A digital metronome of sorts. A footswitch that would
count the time intervals between successive taps of my toe, average
the times, and flash a light at that interval. That would connect to
a unit by my hand that would have buttons to increase and decrease
the
time interval counts. I also want a number pad for direct entry of a
number that would set a "beat time".

I'm figuring I would need a stable frequency generator of some kind
into a pulse counter. A tap on the foot button would zero the
counter
and open a gate for about 10 seconds - within that time, every
successive tap would capture the number of pulses between taps and
increment a tap counter, add the count to the previous one and divide
by the number of taps to get the average. The average is fed into a
counter that flashes a light after this many pulses.

So far, not bad. I did things of that sort with 555s and TTL up/down
counters. But adding and averaging weren't included. And now I want
buttons that will increment that count by a plus or minus, and I want
to directly enter a count. Which means I also need a display, and I
need a circuit to convert whatever the actual pulse count is into
something meaningful in my world, and convert my entered number into
a
pulse count the unit can deal with.

Am I out of my league yet?

Project 2: A comparative thermostatic controller for an attic fan.
I
live in the Arizona desert and want a fan in my attic to cool things
down up there. If I set it for say 120 degrees, the thing will run
day and night for months! So I'd lke to compare the attic temp to
the
ambient temp, trigger it on when the attic raises maybe 20 degrees
above and shut off when the temps are even.

I have looked up temperature chips on the internet, but I've never
worked with any. I imagine there would be voltage comparators and
flip-flops (do they still use those?) to control the on/off.

So how are we doing? Should I be here for help with these? Or over
in the "wishful thinking" group?

Ed

2. ### defaultGuest

I'm in a similar situation. Navy CTM. For the metronome a
programmable chip is the answer and there will be plenty of folks to
recommend one - I've used the basic stamp and it would do it at a cost
of ~\$50-100 with the hardware and a relatively steep learning curve
if you aren't used to programming. But it is some fun learning to do
it - and you'll likely spend hours just getting some leds to blink
until you get proficient.

Someone in the group has recommended the picaxe chip for simple tasks
- I have no experience with it but had no problem convincing myself
that it is so easy and inexpensive that I have to learn it. That chip
is available in several flavors from 8 to 40 pins. It is just a
programmable logic chip with a bootstrap loader burned into memory -
the programming is done in Basic and a (free) compiler sends the
machine language over to the chip on a serial cable from your
computer.

All you need to start is the \$3 chip and some breadboarding stuff and
a cable - or for your metronome you'd likely need the \$8 (18 pin
version) All the manuals software and tutorials are on line and free.

I ordered the stuff from www.phanderson.com on line and a \$20 book
from www.abebooks.com total cost with 3 chips, USB to serial cable
and prototyping board was under \$40 (minus the book - I like paper and
have a cheesy printer)

I don't know how one learns Basic these days - I learned with a Radio
Shack Color Computer years ago - then an Action Instruments
programmable industrial controller that used SYBLE (or something like
that) it was easy to use and I had a robotic system running in a few
weeks. SYBLE is BASIC with a few additional commands to turn things
on and off and add time delays easily.

I think they call the technique you mean digital smoothing or
averaging. Measure the time between taps and average until you get to
some number of total taps then start throwing out the first ones. Tap
one and two are averaged, then three, four, five, then throw out five
and keep averaging the last five counts. (or some number I
arbitrarily said five) Subroutine takes the average time and
calculates frequency based on period.
The second project is very easy. Two temperature sensing chips like
the LM318 (if I remember the # - National Semiconductor has it -
they'll probably still provide free databooks or a CD with the entire
searchable component line) or just a pair of thermistors and an analog
comparator, feeding a solid state relay. You'd have to tinker with
the calibration and deadband settings a bit. Op Amp Cookbook would be
a good place to start if you haven't used them in awhile.

I built a small incubator that does something like that - use two
comparators with one pot to set temperature and another for deadband.
As temperature drops, the heater comes on. When the ambient gets high
enough it turns on a fan - a pot sets the difference between both
control points and one sets the whole range.

3. ### Anthony FremontGuest

<snip for brevity>

See, it's like the twilight zone (get it?) Same people, different tudes.
;-) Like Joerg said before, the TI MSP430 is a popular micro with
hobbyists. You already know I do the PIC thing. There is another micro
that has allot of popularity called an AVR. Pretty much equivalent to a
PIC, but different. That's more of a Ford/Chevy issue than anything. The
AVR is a little more friendly with C compiler expectations.

Microcontrollers rock, learn to use them properly and you will agree. You
will be able to build things you never thought possible.

4. ### John PopelishGuest

Ed wrote:
(snip)
Unless you want to wire up a square foot or so of logic
chips, this really would be a nice project for a small
microprocessor, like a PIC or AVR. But getting up to speed
to load up the first one is a pretty steep climb. After
that it just gets easier and easier.
This is much simpler than project 1. A couple thermistors
or integrated temperature sensors, or even a pair of
transistors or diodes as temperature sensors, some opamps to
build up any small signals to something robust, a comparator
(or opamp operated as a comparator, since speed is not
important) to make the decision and a solid state relay to
drive the fan and you are there. I built one of these 10
years ago, to heat a basement by ducting hot attic air to
the basement any time the attic was warmer than the basement.

To get started on either of these two projects or anything
in between, I suggest you get familiar with operational
amplifiers (and their comparator cousins) and the 4000
family of CMOS logic, which is about as simple and forgiving
as any logic will ever be. But don't wait too long to get
your 4000 series parts in DIP packages. They are getting
obsolete as we discuss.

Here is an opamp tutorial to get you started.
http://web.telia.com/~u85920178/begin/opamp00.htm

5. ### Randy DayGuest

Heh. It's a galaxy of choice out there, that's for sure.
Fortunately, most of it's dirt cheap; perfect for
experimenting.
So you know a bit of programming. That helps.
Project 1 is tailor-made for a microcontroller;
not only does it have a clock source on-chip,
it'll count pulses, read buttons, flash leds,
add/average and other math. It'll also drive or
interface with any type of display you want.

You'll want to get an idea how many inputs and
outputs you'll need, pick a micro that has
enough i/o (\$2 to \$20), then buy or build a
programmer for it.

The PIC, the Basic Stamp and the PicAxe are
the three that get talked about most on s.e.b.
Each family has small, cheap i/o devices, with
a few K of memory; midrange devices with stuff
like analog-digital conversion, USB and RS232
i/o capability; high-end units with lots of
i/o, onboard memory space and peripherals.

Most uC's have flash memory versions, so you
can burn (program) them thousands of times
over and over; great for debugging.

The 'net has lots of freeware compilers and
schematics for uC burners, but you may need to
spend time getting it all to work together.

The commercial kits (\$80 to \$300) include
software and the hardware necessary to program
the chip. I bought a PicKit 2 for PIC's that
programs via the USB port on my PC. I can
compile and burn to chip with a few mouseclicks.
Got a bug? Recompile, burn again.

The downside? Learning curve. uC's like the
Basic Stamp use a variation of the Basic language
to program the micro, so there's a bit of
familiarity for you. A purchased learners kit
will have tutorials, and example code to flash
led's, read buttons, that sort of thing.
You tell us!
The only temp sensor I'm familiar with is the
LM35, and only because I have one in my parts
bin. Two of those in a window comparator
circuit might work.
This is definitely the place. No question is too
simple, though some of the answers can be

Randy

6. ### EdGuest

Okay - I feel that ~here~! <G>

Thanks to everyone for all the tips. I'll look some things up and
post back with each project as I come to it.

Cheers!
Ed

"Just remember that everything electrical runs on smoke. If you ever
let the smoke out, it will never run again!"