Page 1 of 3

Stringed Instrument Tuner, Ideas?

Posted: Tue Sep 16, 2008 10:34 pm
by MrAl
Hello,


Using a microcontroller to make a guitar tuner is a very
simple task. The program changes the state of an output
pin every 1/2 cycle of the tuning frequency and this creates
an almost perfect square wave and the frequency can be
adjusted to be very very close to the actual frequency
of a typical guitar string, within a small fraction of a
percent. The output pin is then used to drive a set
of headphones through a rather large value resistor and
the result is a tone at the required frequency. It takes
about 30 minutes to get the program going and uploaded
to the ic chip and then we're up and running, so it truely
is a very simple project.

What i was hoping to do however, is to drive a small white
LED, and that LED will be directed at the string of choice
and it will act as a strobe, so that when the string is
at the right frequency it will appear to be still rather
than vibrating back and forth. This will form a tuning
system that is far more accurate than the human ear because
that string will appear to move slowly even if it's frequency
is only off by a small amount.

There is a slight problem with this idea however, and i just
starting to think about this. When the string is plucked it
vibrates back and forth (guitar or other instrument laying on
its back) and this causes the string to be ever so slightly
tighter at the two extremes of its travel, and this causes
a change in movement especially since the string vibrates to
less and less extremes as the tone volume dies down. Thus,
it's a little hard to narrow down the frequency with a strobe
of a fixed frequency because the frequency varies slightly
as the string vibration damps out. The ear averages this
out a bit but the strobe doesnt have the ability to change
frequency as a string would, and i feel that would be too
complicated to build into the system.

Any ideas how to improve the system? Perhaps a short duty
cycle instead of a square wave? Perhaps a light sensitive
pickup to sense movement and analyze with the uC or send
the data to the computer for some analysis?

Any ideas/comments/suggestions?

Posted: Wed Sep 17, 2008 4:03 am
by Dean Huster
I, too, for many years used to take weeks to build devices for $80 to do the same job (in a larger package, uglier, more power hungry, etc.) than the $20 item I could have bought.

Dean

Posted: Wed Sep 17, 2008 10:02 am
by MrAl
Hi Dean,


Ok, so your idea is to scrap the whole project and just buy a unit
from the local music shop? He he.

Well, i considered that option and realized that i already have the
controller chips on hand and i have the white LED and plenty of
resistors, so why not? If it was going to cost 80 bucks i wouldnt
be doing it that's for sure. Besides, i like building my own stuff
when possible...that way you can fix it when it breaks down too.
Besides, a lot of us here still do stuff like this as a hobby
anyway...dont you find it just a little interesting too? (i know it's
not rocket science though). I dont even play that much anymore
(took jazz lessons back in the day) but now and then i still
pick it up..."Take Five" anyone? :smile:

The other thing is that it already works as is if i simply connect
a set of headphones to it via a resistor such as 10k, so its not
useless even the way it is already, i just wanted to improve it
if possible. The user would have to tune by ear first anyway,
and then fine tune using the strobe.

It's also interesting i think that the oscillator that runs the strobe
is so steady that you can actually see the effect of the string as
it changes frequency ever so slightly as the vibrations damp out.
It's hard to hear this difference though.

Any more ideas also appreciated...

Posted: Wed Sep 17, 2008 1:23 pm
by MrAl
Hi again,


Little Update here...


I tried a 10 percent duty cycle and it seems to help a lot. It appears
that the main problem was with a 50 percent duty cycle the eye
picked up too much of the vibration and so it became a bit confusing.
With only 10 percent the eye only sees a fraction of the string travel
and so it sees the 'beat' frequency between the string and the actual
oscillator frequency. It's pretty cool really, and if you never tried
it you might want to. As the string comes closer and closer to the
oscillator frequency it 'appears' to move back and forth slower and
slower. I say 'appears' because it is actually vibrating much much
faster but the eye only sees it when the strobe is lit, which is a
short time pulse of light.

Posted: Wed Sep 17, 2008 5:09 pm
by Lenp
Dean,
I learned a long time ago that one sign of maturity is when you learn that ..
"Just because you can do it is not always sufficient reason to do it".

:grin: Len

Posted: Wed Sep 17, 2008 6:10 pm
by MrAl
Lenp wrote:Dean,
I learned a long time ago that one sign of maturity is when you learn that ..
"Just because you can do it is not always sufficient reason to do it".

:grin: Len
Hi Len,

If i took that attitude i probably wouldnt build anything.
Like i said in my last post, some people still do this stuff
as a hobby, unless of course you would like it better if
everyone stopped doing that? :smile:

Posted: Wed Sep 17, 2008 6:23 pm
by Dean Huster
MrAl and Len,

Actually, I'm guilty of all the same stuff. Being older, I tend to not build what I can buy cheaply ... I suppose that terminal laziness has set in. However, I still have a major fault: since I have a massive stock of TTL & CMOS ICs and a boatload of 741C op amps, I tend to use those in projects rather than even considering a PIC or other processor. So, my projects are large, heavy, power hungry, complex, etc.! I still even make circuits using (gasp!) discrete transistors!

Dean

Posted: Wed Sep 17, 2008 6:29 pm
by jwax
How's this for a possibility from a non-musician- use a frequency counter. You know what each string/chord is supposed to be, right? A 6 or 8 digit counter should give you resolution enough, right?
Is there any error introduced by using a square wave to beat with the strings sine wave?
Just "grabbing at strings here"! :grin:
Sorry.

Posted: Wed Sep 17, 2008 7:06 pm
by dtief
It sounds like he is using the LED as a strobe light. So it needs to go on / off fast. = square wave. The tuning accuracy is related to the frequency / pulse rate of the flashes. Very similar idea to strobe based tachometers.

Dave

Posted: Thu Sep 18, 2008 3:48 am
by Jim Barrett
Come on folks, the thing is "not how well the bear dances, but that the bear dances at all". For folks like us these things are intellectual exercises, not an attempt to aquire perfection or utmost efficency.
Keep tinkering, you never know when it might spark another idea and heaven forbid you (or we) might learn something.

Posted: Thu Sep 18, 2008 9:34 am
by ecerfoglio
MrAl wrote:Hi again,


Little Update here...


I tried a 10 percent duty cycle and it seems to help a lot. It appears
that the main problem was with a 50 percent duty cycle the eye
picked up too much of the vibration and so it became a bit confusing.
With only 10 percent the eye only sees a fraction of the string travel
and so it sees the 'beat' frequency between the string and the actual
oscillator frequency. It's pretty cool really, and if you never tried
it you might want to. As the string comes closer and closer to the
oscillator frequency it 'appears' to move back and forth slower and
slower. I say 'appears' because it is actually vibrating much much
faster but the eye only sees it when the strobe is lit, which is a
short time pulse of light.
An "ideal" strobe should use "cero length" light pulses - a good strobe should use very short pulses.


I needed a strobe to measure the "slip" of an induction motor. (difference between the actual shaft speed and the AC line).

When we used the motor at night (in a room with fluorescent light fictures) we (the teachers, knowing what to look for) could barely see the stoboscopic efect, and the students couldn't see it at all.

I built a led strobe with a 555 timer, triggered on the AC line cero crossing (10 ms for 50 Hz). It lights a LED for 70 microseconds (duty cycle = (70 / 1000000) / (10 / 1000) = 0.7 percent). It gives a very sharp image.

Strobe duty cycle is a tradeoff between image sharpness and average light level.

Posted: Thu Sep 18, 2008 11:54 am
by MrAl
Hi again,


Dean:
Yeah, hehe, i have lots of parts laying around doing nothing too.
I also dont like to waste the time i spent learning in college and
after college...nice to be able to use some of that for these things.

jwax:
I actually have three frequency counters...one home built (8 digit)
and two bought that came as part of DVM's. I can even connect a
10 second time base to my 8 digit counter to get 0.1Hz resolution,
better than most guitar tuners i've seen.
What i was after here though was a very very simple way of doing
this yet obtain high accuracy, or at least higher than one could
obtain by simply listening to the two tones and adjusting the string
tension. The whole thing only takes one ic chip and one LED
and one resistor (ok perhaps a tiny 5v regulator too and a speaker
if you want a tone output to go with the strobe output). A whole
frequency counter, although a good idea, takes a lot more parts.
Using a wave (square or other) to beat with the string sine wave
is an interesting idea too though, which should be considered. The
beat frequency might be sent to a speaker which would produce say
'clicks' that get farther and farther apart in time as the string
comes closer to the reference frequency. I'll have to give this
some thought too.

Dave:
Yes, that's it. The LED turns on just long enough to see the string
as it moves out in one direction, and if it appears to be still then
the string is perfectly tuned, but if it is waving back and forth it
is not. The movement appears to slow down too as the string comes
closer to the reference frequency oscillator.
And yes, it's like the automobile strobe light idea.

Jim:
Yes, that's part of the idea too :smile: and just to see how well
a strobe light can work when tuning a stringed instrument.

E. Cerfoglio:
Yes, the shorter light pulse seems to work much better. As per your
notes it looks like going even shorter could work even better.
Right now i have it set to 10 percent and i have another output set
to 50 percent (for tone generation also) but it doesnt take much
to make the 10 percent 5, 2, or even 1 percent. I'll try that next.
The tone output BTW is so the user can tune the string close to the
right frequency to start with, then fine tune with the LED strobe.
And yes, i have found the average light output dies as the pulse
gets shorter, but that's life, and since the LED can take higher
current pulses for a shorter time period i can get the brightness
back up by going to a higher current driver (say 60ma perhaps).
Right now i am trying to keep it simple however.

Posted: Thu Sep 18, 2008 12:02 pm
by ecerfoglio
MrAl wrote:Hi again,

......

The tone output BTW is so the user can tune the string close to the
right frequency to start with, then fine tune with the LED strobe.
That'a a very good idea, espacially if the instrument is "very out of tune" (like when you change a string).

The strobe method can give false readings on harmonic and subharmonic frecun¡encies - not unlike a DSP's aliassing

Posted: Thu Sep 18, 2008 12:33 pm
by MrAl
Hi again,

E.C.:
Yes, the tone will allow the user to get close first to avoid that situation.


jwax:
Oh, maybe you meant using a uC as a frequency counter, which would
keep the parts count and complexity low too? That would be a good idea
too, as the LED could then blink when the string was out of tune, in
step with the beat frequency. Might need an amplifier on the input first
but that's not too bad.

Posted: Thu Sep 18, 2008 2:18 pm
by philba
When I tune a stringed instrument, I use the audible beat between the reference and the DUT (er, string). I'm not sure if a strobe would be better. I've got a tin ear and still get it pretty accurate.