So, I've been wrestling with this project for a while. I am making a tuner for musical instuments. At first, I was planning on using a simple 555 timer. But I learned from an electrical engineer I talked to today, that it wasn't a sine wave. So here is the plan using the 555 (Which I'm not using now):
I have a 555 chip. I spend a long time solving systems of equations and solve for the frequency I want. I had this schematic to select between the 3 values, (R1, R2, and C). Then you select the note to tune and a comparator tells whether sharp or flat.
The new idea though, is to use a pll. (Phase Locked Loop) This changes things a lot becuase it must use a binary counter, which is stimulated by 88 push buttons instead of the selector. (Really busy on solving that 88 button problem!) The counter's whole goal is to divide the tones down into their respective ratio. Here is a list of the frequencies I need to nail down: (Sorry it's kinda sloppy:()
Octave0 Octave1 Octave2 Octave3 Octave4 Octave5

0 A 55.000-110.000-220.000-440.000-880.000-1,760.000

1 A#/Bb 58.270-116.541-233.082-466.164-932.328-1,864.655

2 B 61.735-123.471-246.942-493.883-987.767-1,975.533

3 C 65.406-130.813-261.626-523.251-1,046.502-2,093.005

4 C#/Db 69.296-138.591-277.183-554.365-1,108.731-2,217.461

5 D 73.416-146.832-293.665-587.330-1,174.659-2,349.318

6 D#/Eb77.782-155.563-311.127-622.254-1,244.508-2,489.016

7 E 82.407-164.814-329.628-659.255-1,318.510-2,637.020

8 F 87.307-174.614-349.228-698.456-1,396.913-2,793.826

9 F#/Gb92.499-184.997-369.994-739.989-1,479.978-2,959.955

10 G 97.999-195.998-391.995-783.991-1,567.982-3,135.963

11 G#/Ab103.826-207.652-415.305-830.61-1,661.21-3,322.438

12 A 110.000-220.000-440.000-880.000-1,760.000-3,520.000





So, the counter will divide it down using complex ratios. I need to have Double Bit Precision on this. I need as many decimal points as possible, So I can measure cents(a pitch unit).
On a simpler issue, I want to make this 7 color LED light that changes with the mood of the note. The whole color thing. It would be a feature that no other tuner has. That would be cool... I need some advice on 7 color leds though. I have never used one. PLLs are also new to me, so if there is any advice on that, I'd love it. I have plenty of time to learn new things. BTW, NO PROGRAMMABLE CHIPS! I loathe them, and can't blow the budget on some fancy programmer again....


Edited by Tanner Wink
What's wrong with using a square wave to tune? But yeah, a PLL is a more dependable tool to use than a 555. So do you basically want a tone generator at each of those frequencies?

Also: please use the button.
Square waves sound terrible Kerm! And yes, I want a tone generator.
adept wrote:
Square waves sound terrible Kerm! And yes, I want a tone generator.
Really? You can hear the difference between a sine and square wave? Then toss in a little rounding capacitor to smooth off the edges.
A square wave sounds harsh to the ears, not pure. A smoother wave form is far more pleasing to hear. Trust me Kerm. A capacitor would slow it down, and make it go flat, plus it wouldn't be a proper sine wave, now would it. Smile
And how could I solve the whole 88 button problem?
May I ask why you don't want to use a microcontroller? That would turn a "super" hard project into a relatively straightforwards one. A dsPIC would seem like a logical choice as they are fast, cheap and have audio hardware on board.
adept wrote:
A square wave sounds harsh to the ears, not pure. A smoother wave form is far more pleasing to hear. Trust me Kerm. A capacitor would slow it down, and make it go flat, plus it wouldn't be a proper sine wave, now would it. Smile
And how could I solve the whole 88 button problem?
False. A sufficiently small capacitor would merely do a tiny bit of phase shifting, as well as smooth out the vertical transitions. Obviously you'd need to pick a possibly-different value for each frequency. There are plenty of simple and naive ways to turn a square wave into a pseudo-sine wave. And I like Ben's idea; why make your life more complicated than it needs to be?
KermMartian wrote:
adept wrote:
Square waves sound terrible Kerm! And yes, I want a tone generator.
Really? You can hear the difference between a sine and square wave? Then toss in a little rounding capacitor to smooth off the edges.
Oh, you most definitely can. The four main wave forms are sine, square, triangle, and sawtooth, and they all have a different sound (timbre). Think of a flute playing a C and and oboe playing a C. A flute has a very "pure" sound (it's very close to a sine wave, with some fundamentals) whereas an oboe is less smooth. If you listen to a lot of chiptunes, you can hear when some notes are smoother than others, and those are generally sine waves.
You can hear them here:
sine wave
square wave
sawtooth wave
triangle wave
It doesn't have them all at the same pitch, but sine and triangle are, and you can hear the difference there.
Indeed, and I do listen to a lot of chiptunes. Laughing Fine, then perhaps my question should have been, how important is the tone sounding audibly-pleasing to the overall purpose of using the tone to tune an instrument?
I don't think it's to do with how nice it sounds as opposed to how pure it sounds. A sine wave produces a pure tone, whereas a square wave is made up of a range of harmonics.
benryves wrote:
I don't think it's to do with how nice it sounds as opposed to how pure it sounds. A sine wave produces a pure tone, whereas a square wave is made up of a range of harmonics.
A fair point (gogogo Fourier series!), but one that doesn't nullify your original point about using a DSPic, or pretty much any uC connected to a DAC.
The dsPIC has an audio DAC built into it. You can top up its FIFO buffer with an interrupt or use a DMA module to top it up automatically. It shouldn't be too tricky to generate a sine wave in software when you've got 40 MIPS to play with!
The problem is the programmer. I don't have a PIC programmer to use. I have a SIMPLE Atmel one I made for the last robot I made. But anyway, I simply don't have funds to buy a programmer, I would rather spend more time in design and make something more complex, but cheaper. I just need some help with the ideas I have, not new ideas I've probably considered already. No offense to anybody's opinion.
adept wrote:
The problem is the programmer. I don't have a PIC programmer to use. I have a SIMPLE Atmel one I made for the last robot I made. But anyway, I simply don't have funds to buy a programmer, I would rather spend more time in design and make something more complex, but cheaper. I just need some help with the ideas I have, not new ideas I've probably considered already. No offense to anybody's opinion.
Definitely understood; I think we just feel that your expenditure in time and components will work out to be more in the long run if you go the non-uC route than if you simply get a dsPic and a programmer.
I got an idea from another professional design engineer. Use a frequency to voltage converter (lm2907) to make the wave a voltage. Then use a specific and calibrated voltage source (Possibly from a variable voltage regulator, with varying R values) to get the reference. Then just a comparator to finish of the circuit. Then display on a bar graph LED thing. I need help implementing the schematic, which after its redesign, I will post a picture here.
Sure, that would work, although you'll need a significant amount of filtering and smoothing circuitry.
That's not what he said! He said:
Quote:

The fact that the tone is not pure is not your problem, the LM2917 includes a comparator with Schmitt trigger inputs which will only trigger when the signal passes through zero, which means that the strongest frequency component will be measured.

You problem is that the LM2917 is not designed to do what you want, it's designed for a tachometer over speed alarm, it's possible to use it for what you want but it won't be easy, see the following quote from the data sheet and note the text highlighted in bold.

Quote
The LM2907, LM2917 series are monolithic frequency to voltage converters with a high gain op amp/comparator designed to operate a relay, lamp, or other load when the input frequency reaches or exceeds a selected rate.


You want to trigger an output when the frequency is approximately equal to a certain rate, not much above or below but nearly equal. The problem with using a F/V circuit like the LM2917 is that you need to detect more than one note and for every note, you need a window comparator which requires two comparators, so for eight notes that's 16 in total which a lot of ICs: four LM339s.

By the time you've purchased the LM2917, four LM339s and the necessary passive components, you might as well have bought a microcontroller, which is: smaller, cheaper and will enable you to do cool things, such as display the note being played on a 7 segment display.

For example, just looking in my local supplie, RS Components:

The cheapest through hole AVR with enough pins I could find on RS is the ATMEGA48PA-PU, for £1.80
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=6962298

The 8 pin version of the LM2917 is £1.086 but there's a minimum order quantity of 5.
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=0460944

The cheapest though hole quad comparator on RS is the LM2901 which is similar to the LM339 costs £0.19 each (£0.76 for 4) but the minimum order is 10.
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=6612781

The cost of the comparators plus the LM2917 comes to £1.846, more than the AVR and that's not even including the extra passive components.


BTW, totally different forum site. EEVBlog. I don't have a reliable way to program these fancy chips. Mine glitched out and failed at least 10 times before it transfered! So I'll ask around. There's no excuse not to use a chip except for the programmer. Anyway, the simple thing to do is to follow the LM2917 idea. So, he gives some answers to the problem. Anyway, any ideas on what the schematic is going to look like. I'll go and scan what I have already tonight after I eat supper in like 10 minutes. Then Kerm, you could tell me whats wrong and needs to change. It'll be up for sure by the time I get out of after school rehearsal tomorrow, if everything decides to go wrong with the scan machine, which I need to hook up... (timer beeps in the background, and I go get my casserole out of the oven...)
AVRs are very easy to program if you have a parallel port on your computer, it's just a case of connecting a few pins directly from the parallel port to the AVR. See avrdude.conf for more information (under "# Parallel port programmers.")

I wouldn't waste your time building a serial port programmer (I used one for a while and they are significantly slower than parallel port ones); if you're going to make the effort, build a USB programmer (that particular one requires a 32-bit OS as it uses an unsigned driver). Of course, you'll still need a way to program the ATtiny2313 in that design...
I did it with a serial port. It didn't turn out half as well as I'd like... It was unreliable in Baud rate, and screwed up many transmissions Sad.

For Kerm:
Here is the schematic. SO SORRY FOR THE SIZE!!!
http://img268.imageshack.us/img268/7894/schematicz.jpg
By adept2 at 2010-09-19
Make any corrections and reply
That's the easiest way to think about it, but remember that the input is nowhere near a perfect wave; it's a giant mish-mash of frequencies superimposed. I feel like you'll need some smoothing and perhaps latency/derivation in there.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement