Tune-O-Matic tuner

sorry it was a bother but I at least found it interesting . I have no idea about any of that stuff . now we just need a patent lawyer on here to definitively explain , but like you said it is different in different countries so would be very lengthy subject .

I did my take on the Tune-o-Matic. I preferred using separate note leds instead of a 7 segment display, it used too much juice. Now I have max 2 leds for one note… Anyhow, I am experiencing a funny issue when I place the tuner next to my VCO. It is especially noticeable without any input connected, but I noticed that it also slightly disrupts the normal working when an input is connected.
Easiest to explain is by these movies. Funny phenomenon. Additionally I should mention that if I place to tuner next to the VCO, but upside down, it acts normal. The issue is happening especially with higher notes. Some interference with the Nano, probably, maybe? A grounding problem?

4 Likes

Using leds and not a 7 segment display is a very nice idea! I expect that fast changes to the tone can now be seen more easily than with the display.

What you describe is an interesting phenomenon. I think it may be that the oscillator circuit is ‘broadcasting’ low frequency energy via its wiring like a sort of low frequency radio transmitter and the input stage of the tuner is picking that up. You might start by shorting the input of the tuner when there is no input jack present using the switch in the jack connector.

I place to tuner next to the VCO, but upside down it acts normally

This seems to me to boil down to distance. Like you demonstrate in the 2nd video. The distance between the input and the oscillator may be large enough for it not to pick up the oscillator signal when upside down.

I’m wondering what happens if you place a mixing module next to your vco. Does that pick up any signals even if there are no patch cable used?

2 Likes

Thanks a lot for your suggestions.
Using leds makes it indeed very clear to see fast note sequences.

I finally found the time to do some more testing.
I added a 100K resistor between the jack switch and its ground. Is that the correct way? or could I have just shorted the switch to ground? What about the Tip shortly making contact with GND?
Anyhow, that did calm down the tuner when no cable is inserted.

Distance is surely a factor. Next to that when I rotate the tuner 180°, the stripboard is between the Nano(and wiring) and the VCO. I should make work of always orienting my board in the same direction in the future. It is more tidy and I guess in cases like this it can make a difference.

I have tried with a mixing module but I could not notice anything out of the ordinary.
What I did notice: when I get the tuner out of my case and place it on the table and place the output cable of the VCO in a curl next to the tuner it also starts acting weird…

All in all it is now working better, but I still notice a difference in efficiency when I place it next to the VCO. I have 2 VCO’s next to each other and when tuning the left VCO all works fine, when tuning the right VCO it seems that the tuner is always switching between the ‘too low’ and ‘too high’ leds.

I was wondering whether I could add some kind of shielding? Or are there other options to check?
Anyhow thanks a lot for helping me on my way!

Yep.

Some jack connectors have a plastic outer ring, which prevents shorting the tip to ground. Most connectors will short it to ground. As long as the module you plug into such a connector is protected against being shorted that is not a problem.

Well, that certainly sounds like it is acting like a transmitter. Maybe you should connect an oscilloscope to the opamps and power supply and GND-lines in the vco and look for unwanted oscillations. Or make a coil with a scope probe by connecting the probe tip to the gnd lead and use that to find the source of the oscillation.

In some schematics I’ve seen small capacitors across the input/outputs of opamps to prevent them from oscillating. The oscillation frequencies may be very high, so you may not hear them. I’ve seen schematics with values like 220pF between the output of an opamp and its inverting input.

Also 100 nF very close to the chips from GND to V+ and from GND to V- may help.

Let us know whether this helps.

1 Like

Thanks for these tips.

I have spent quite a bit of hours searching for signs of oscillation in the Opamps, also tried the loop on the scope. I did not notice anything out of the ordinary.
I did not try the extra caps on the opamps yet

For the moment to tempted to proceed with new builds…
I guess I’ll keep the possibility of interference in the back of my head in case I experience other strange issues.

to be continued…

1 Like

hey, I built the tuna and it doesn’t seem to work. I tried several VCOs and the LEDs on the 7 segment display are only glitching out. it doesn’t seem to settle. I used the exact components no substitutes. Any idea what could cause this. I tried it in the case and externally without touching it. It doesn’t matter at all.

Let’s start with the led test.

In the code there is a line

//#define LED_TEST

which is commented out.
Remove the 2 forward slashes, recompile and upload it to the arduino.
This should allow you to check whether all the LEDs are working.
The tuner itself will not be active, only the LEDs. You should see all segments light up individually, and combined as notes ‘C C. D Dc. etc’ light up. Make sure the ‘decimal point’ also flashes. If anything unexpected happens, report back here.

If you find that everything is working during the LED_TEST, restore the two forward slashes, compile and upload again. Then describe your setup and I will try to help you find the problem from there.

1 Like

so the led test is:
all leds on, then the separate ones deactivate seperately,
then the segments deactivate seperately
then you see the 7 segment display do weird signs none of which are letters, maybe the reverse are the letters?
it looks like not the letters are shown but the segments that should be off are on and the other way around.

I fixed that and now I will check if the tuner works.

1 Like

so the tuner works but apparently doesn’t like PWM audio, with my proper VCO it works fine.

1 Like

You have to choose the display type you are using here (adapt the third line):

const int COMMON_CATHODE = 1;
const int COMMON_ANODE = 2;
const int LED_DISPLAY_TYPE = COMMON_CATHODE;

This behaviour you mention is odd. Have you found its cause?

I have experienced that the tuner works with basic / steady signals. With modulated signals your mileage may vary.

1 Like

I changed the lines down there that adapt to that, so all high:low are now low:high or the other way around I don’t remember. Works now thanks

I bought the display long time ago so I wouldn’t have known which type honestly.

Thanks for the help!

2 Likes

I’m finally building a tuner based on yours and @Jos and @Bas great work. I can confirm that adding a low pass filter before the Arduino makes a huge difference to the responsiveness and stability. The original circuit works well with a triangle wave, but even with my saw tooth it wasn’t great. I simply added a 0.1uF to ground (after the 10K Ohm resistor) and the waveform is nicely smoothed and is handled much better. Edit: Changed to a 0.22uF for even more smoothness; it can handle a pretty rough waveform now!

My next step is to modify this so that I can have three signal inputs and three display outputs from one Arduino using shift registers. Wish me well… :slight_smile:

5 Likes

I’ve managed to pull off the 3-channel tuner with a single Arduino. I’ve also re-written (with a lot of ChatGPT help, lol) the code to convert frequency to note. Instead of a lookup table I’ve used a formula that works out the difference in semitones from 440Hz. Seems to do the trick.

Next step is to get it off the breadboard and into a completed module.

If anyone is interested in the code then I’m happy to share, but it’s maybe not exactly plug’n’play! :slight_smile:

2 Likes

Ha, that sounds interesting! What type of arduino did you use? I guess you used 3 analog inputs for the 3 oscillators or did you arrange things differently? Could you maybe show and explain the formula here?

1 Like

Just an Arduino Nano, I used A0, A1 and A2 to read the oscillator inputs (hacking Amanda Ghassaei’s code so that it handles three inputs instead of one). Then to display on three different 7-segment displays I used three CD4094 shift registers to cut the outputs down to three. I still had plenty of digital outputs after that and so I used nine of them to drive the tuning LEDs.

Regarding the formula, I based it on the formula explained on the website below and rearranged it (credit to ChatGPT) so that I could work out how many half-steps away from a fixed frequency for any particular input frequency.

https://pages.mtu.edu/~suits/NoteFreqCalcs.html

Once you have that, you can move up and down the 12 notes accordingly (using mod 12), and use any remainder to figure out how many cents you’re off by. The number of cents you’re off by is then used (compared to a constant) to figure out if it’s intune (enough), too flat or too sharp.

Here is some of the code that implements this:

double calculateNoteFrequency(double baseFrequency, int halfSteps) {
    double a = pow(2.0, 1.0 / 12.0);
    double noteFrequency = baseFrequency * pow(a, halfSteps);
    return noteFrequency;
}

byte getNoteName(int halfSteps) {
    const byte notePatterns[] = { segDisp_C, segDisp_C_dp, segDisp_D, segDisp_D_dp, segDisp_E, segDisp_F, segDisp_F_dp, segDisp_G, segDisp_G_dp, segDisp_A, segDisp_A_dp, segDisp_b};
    int noteIndex = ((halfSteps + 9) % 12 + 12) % 12;
#ifdef DEBUG
    const char* noteNames[] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
    Serial.print(String(noteNames[noteIndex]) + " ");
#endif

    return notePatterns[noteIndex];
}

NoteMapping calculateFrequency(double);  // define function
NoteMapping calculateFrequency(double frequency) {
    NoteMapping noteMapping;

    double halfSteps = log(frequency / baseFrequency) / log(2.0) * 12.0;
    int roundedHalfSteps = (int)round(halfSteps);

    noteMapping.note = getNoteName(roundedHalfSteps);

    double noteFrequency = calculateNoteFrequency(baseFrequency, roundedHalfSteps);

    double centsOff = 1200.0 * (log(frequency / noteFrequency) / log(2));//log2(frequency / noteFrequency);  // Calculate the difference in cents

    if (fabs(centsOff) <= inTuneCents) 
        noteMapping.led = TUNE_LED_INTUNE; //sprintf(output, "%s - in tune", noteName);
    else if (centsOff < 0) 
        noteMapping.led = TUNE_LED_FLAT; //sprintf(output, "%s - flat", noteName);
    else if (centsOff > 0) 
        noteMapping.led = TUNE_LED_SHARP; //sprintf(output, "%s - sharp", noteName);
    else
    {
        //noteMapping.note = segDisp_Dash;
        noteMapping.led = TUNE_LED_INTUNE | TUNE_LED_FLAT | TUNE_LED_SHARP;
    }
#ifdef DEBUG
   if (noteMapping.led == TUNE_LED_INTUNE )
      Serial.print(" IN TUNE ");
    else if( noteMapping.led == TUNE_LED_FLAT )
      Serial.print(" *FLAT*  ");
    else if( noteMapping.led == TUNE_LED_SHARP )
      Serial.print(" *SHARP* ");
    else
      Serial.print("Error in Tuning");
#endif
    return noteMapping;
}

Not sure how readable it is! :sweat_smile:

Many years ago I used to know how to code to a reasonable degree but my knowledge is all but lost! It’s thanks to ChatGPT combined with my rusty understanding of how it should work that I managed to pull this off. ChatGPT alone is a disaster though - you need to know how to steer it for sure!

2 Likes

Isn’t the cd4049 an octal inverter?

Ha, yes!! Every. Single. Time. I try to type CD4094 I type CD4049! Searching my parts software, searching for the datasheet for the umpteenth time, etc. It’s totally maddening. Thanks, I’ll edit my post.

Next time I make a big parts order from somewhere in going to get a handful of Nano knockoffs and this is one of the things I want to try, using this formula method.

1 Like

https://www.davidhaillant.com/tuner-0-1/

7 Likes