1KHz 0dBu pocket generator

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
I remember asking in the hifi shop I worked in if we could get a CT-100 for general usage in store , its been around at least 20 years. I do see the Ebtech on ebay for as much as $260 dollars , buyer beware indeed .

Maybe an xlr adapter with a trimable attenuator built into it could allow you set a reference level into a given load.
 
e
Tubetec said:
Maybe an xlr adapter with a trimable attenuator built into it could allow you set a reference level into a given load.
I am thinking of using the second half of the TL072 for this. It can act as a trim-able buffer and we can set its output impedance  to 150 ohms which is pretty standard these days and trim the odBu output level with a 1K5 load, which again is typical.It is easy to add an attenuator for say -40dBu output and still maintain the 150 ohm source impedance.

Cheers

Ian
 
My Behringer CT-100 arrived today. I have now taken it apart. It has two PCBs. The top one houses the micro, LEDs, the switches and 3mm phones jacks. The bottom PCB hold the remaining connectors. The two are connected together by an 8 way header.

I tool the label off the micro. It turns out to a very early PIC, the PIC16F57 in a 28pin SMT package. It has a 4MHz resonator for its clock. This micro has 20 I/O lines, 2K words of program memory, 75 bytes of RAM and a single 8 bit timer. Very basic. There are also a couple of 74HC138 3 to 8 line decoders; quite why they need those with 20 I/Os is beyond me.

Cheers

Ian
 
Wow fast delivery ,

Seems like the enclosure and connectors would make a perfect candidate for some kind of transplant surgery, a daughterboard with a half decent sine wave output and accurate level control ,all the leds and cable testing functionality could be dispensed with ,
Definately seems to be a hole in the market for a budget standalone line checker .
 
Tubetec said:
Wow fast delivery ,
Amazon prime
Seems like the enclosure and connectors would make a perfect candidate for some kind of transplant surgery, a daughterboard with a half decent sine wave output and accurate level control ,all the leds and cable testing functionality could be dispensed with ,
Definately seems to be a hole in the market for a budget standalone line checker .
Yes, it is a very sturdy metal box with a nice battery compartment. I think I can easily repurpose it for a prototype. I can keep the connectors board and just replace the micro PCB.

Cheers

Ian
 
Just for fun, I confirmed you can program a Raspberry Pi to send a sine out the headphone jack with a very simple program based on the ALSA library.  Here is the code:

C:
#include <alsa/asoundlib.h>
#include <alsa/pcm.h>
#include <math.h>

#define BUFFER_LEN              48000
#define SAMPLE_RATE             48000
#define TONE_FREQUENCY          1000
#define AMPLITUDE               0.8     /* Trim this to get the peak amplitude desired. */

static char *device = "default";
float buffer[BUFFER_LEN];

int main(void)
{
    int error = 0, j = 0;

    snd_pcm_t *handle;
    snd_pcm_sframes_t frames;

    /*
     * Open the PCM sound device for playback.
     */
    if ((error = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
      printf("Playback open error: %s\n", snd_strerror(error));
      exit(EXIT_FAILURE);
    }

    /*
     * Use float samples, interleaved between left and right (if sending stereo).
     */
    if ((error = snd_pcm_set_params(handle,
                                    SND_PCM_FORMAT_FLOAT,
                                    SND_PCM_ACCESS_RW_INTERLEAVED,
                                    1,                  /* Single stereo channel */
                                    SAMPLE_RATE,        /* 48 kHz sample rate */
                                    1,                  /* Enable soft resampling */
                                    500000)) < 0) {     /* 0.5 sec latency */
      printf("Playback open error: %s\n", snd_strerror(error));
      exit(EXIT_FAILURE);
    }

    /*
     * Fill the buffer with samples based on the math libraries 'sin' function.
     * WARNING: this code doesn't handle a complete period of a sine *not* ending
     * exactly on the last sample of the sample period.  With a 48k sample rate
     * and 48k sample buffer, and a 1kHz tone, this isn't an issue.  To support
     * arbitrary frequencies and arbitrary sample rates this code needs to be
     * slightly more complicated, where one would keep track of the phase of
     * the sinus as it was at the last sample, and make sure the next buffer
     * starts at this point to prevent a discongruety of the signal.
     */
    for(j=0; j<BUFFER_LEN; j++){
      buffer[j] = AMPLITUDE * sin(2*M_PI*TONE_FREQUENCY/SAMPLE_RATE*j);
    }

    /*
     * We have 48k samples, and a 48 kHz sample rate, so each loop sends
     * 1 second of audio.
     */
    for (j=0; j<5; j++){
      frames = snd_pcm_writei(handle, buffer, BUFFER_LEN);
      if (frames < 0)
        frames = snd_pcm_recover(handle, frames, 0);
      if (frames < 0) {
        printf("snd_pcm_writei failed: %s\n", snd_strerror(frames));
        break;
      }
    }

    snd_pcm_close(handle);
    return 0;
}

The headphone jack can drive 600 ohm inputs without breaking a sweat.

The nice thing is that it's pretty simple to output any arbitrary waveform:  square waves, triangle waves, pink noice, white noise, etc.  On my Pi, setting the amplitude to 0.8 yielded close to 1.1V peak required to be at 0dBU.
 
In case anyone is interested, I managed to tweak the software a bit to support any arbitrary output frequency and any amplitude.  I also figured out how to access the frame data to get at each side of a stereo channel, so I could output a balanced sine wave rather than just a mono out one side.

The Pi has enough CPU horsepower that you can compute the next 1 second worth of sine data while the previous second is being spat out the output ports.  This means there is no pre-computation needed, and you can do fancier algorithms like AM or FM if you want just via software.

Scope pic attached:  the frequency and amplitude are dead on for 0dBU (at least into a bridging impedance).  The two signals are the left and right, which could be fed out to pins 2 and 3 of an XLR for testing any balanced input.
 

Attachments

  • SDS00005.jpg
    SDS00005.jpg
    103.8 KB · Views: 41
Whoops said:
I don't know if this circuit helps or not, but check it out to see if it's useful:

https://www.circuitstoday.com/variable-frequency-oscillator

That is a textbook circuit using the 555, analog electronics 101 if you may, it does work thou, if you want a sine wave out of it first you should convert the square wave to a triangle wave with something like an integrator, then you will need a triangle to sine converter.
 
Matador said:
In case anyone is interested, I managed to tweak the software a bit to support any arbitrary output frequency and any amplitude.  I also figured out how to access the frame data to get at each side of a stereo channel, so I could output a balanced sine wave rather than just a mono out one side.

The Pi has enough CPU horsepower that you can compute the next 1 second worth of sine data while the previous second is being spat out the output ports.  This means there is no pre-computation needed, and you can do fancier algorithms like AM or FM if you want just via software.

Scope pic attached:  the frequency and amplitude are dead on for 0dBU (at least into a bridging impedance).  The two signals are the left and right, which could be fed out to pins 2 and 3 of an XLR for testing any balanced input.

That is excellent!  (Way above my Pay Grade) in terms of coding!

For a Universal gizmo, the output circuit should not care about the load destination.  Output xfmr is an obvious "fix" or a THAT chip?

In the Real World in any studio setup, ya never know what you will encounter.

Folks say "a 600 Ohm load is soooooo....1960's"  but I see LA-2 or 1176 units, etc. with a 600 Ohm input Z all the time, along with both balanced or unbalanced input circuity depending on the gizmo.  Real World!  lol

Hang a THAT 1646 at the output for "universal" usage? Maybe a battery eater for a portable device.....

Bri








 
Ian wants to make this work with a 9V battery, from a quick search, the Raspberry Pi consumes from 250mA idle to 450mA at full CPU load, a 9V battery is according to Google 500mAh, so it will drain the battery pretty quickly, say you leave it on for 2 hours (or less) and that battery is kaputt. Even if you use a different chemistry PP3 like a lithium, it wont be very power efficient.

I still think an all analog solution is best, but kudos for the programming!
 
user 37518 said:
I still think an all analog solution is best, but kudos for the programming!

I am working on two solutions at the moment. The first is a straight forward Wien bridge with buffer based on a TL072. I have bread-boarded it and it seems to work fine. I am current creating a PCB layout for it.

The second is based on an 8 pin PIC that has a built in 8 bit DAC and a 12bit ADC. I was thinking it could not onlyenerate tomes but give a simple indicate of sibnal present/level as well.

Cheers

Ian
 
Agreed, in many ways, something like a Pi is way overkill for something like this.  However you can get cheap 10Ah USB batteries that will run a Pi all day (and your phone too!) if you need it completely portable.

I've started using the Pi to test audio circuits, because it's super easy to change the frequency and amplitude of the signal by just changing program parameters.  Supporting sawtooth, square, or triangle waves is just writing some code.  You can sweep input frequencies by just looping on the command line. 

It beats spending $100 on a bench-top audio function generator (and most of the inexpensive ones don't even do balanced output), and if you already have a Pi around then it costs nothing other than making up a cable.
 
Matador said:
Agreed, in many ways, something like a Pi is way overkill for something like this.  However you can get cheap 10Ah USB batteries that will run a Pi all day (and your phone too!) if you need it completely portable.

If we are going to use a different battery, I still can make a point for using the ICL8038 or XR2206 instead of a Raspberry Pi, and a lot cheaper.
 
user 37518 said:
If we are going to use a different battery, I still can make a point for using the ICL8038 or XR2206 instead of a Raspberry Pi, and a lot cheaper.

I was a fan of those function generator chips.  More than a few desks used them.  I wonder how long the supplies will last?

https://www.jameco.com/z/JE2206-Jameco-Kitpro-Function-Generator-Kit-Assembly-Required_20685.html

https://www.jameco.com/z/XR2206CP-EXAR-Corporation-IC-XR2206CP-Monolithic-Function-Generator_34972.html

Bri

 
Brian Roth said:
I was a fan of those function generator chips.  More than a few desks used them.  I wonder how long the supplies will last?

https://www.jameco.com/z/JE2206-Jameco-Kitpro-Function-Generator-Kit-Assembly-Required_20685.html

https://www.jameco.com/z/XR2206CP-EXAR-Corporation-IC-XR2206CP-Monolithic-Function-Generator_34972.html


Bri

They are extensively used in synth circuits even today, you can find dirt cheap kits on e-bay

https://www.ebay.com/itm/XR2206-Function-Generator-DIY-Kit-Sine-Triangle-Square-Output-1HZ-1MHZ-Case/401185073102?hash=item5d687e67ce:g:M-4AAOSwgJNe2Llo
 
If splitting of the baby is permitted, I would also consider something along the lines of this:

https://www.analog.com/media/en/technical-documentation/data-sheets/AD9833.pdf

Which are DDS chips that are 'programmable' via 3-wire interfaces like SPI.  So instead of fiddling with a pot, you write a register to tell the chip what frequency and waveform type you want it to output, and you can do things like frequency or phase sweeps with SW rather than HW.
 
I like the original concept of a simple standalone battery operated analog signal source , no major bells or whistles ,just reliable clean(ish) sine waves at a couple of  known levels/freqs into a standard impedance.

I also like the idea of incorporating PC/usb conectivity ,
the Meizu Pro DAC has impressive specs , it could easily turn the CT-100 enclosure into the front/back end of a REW audio test setup.Four wire hook up,  mini jack TRRS. In the region of .0003% thd, less than 50buck/euros for both .Santa's stocking filler for Diy'ers




 
Matador said:
If splitting of the baby is permitted, I would also consider something along the lines of this:

https://www.analog.com/media/en/technical-documentation/data-sheets/AD9833.pdf

Which are DDS chips that are 'programmable' via 3-wire interfaces like SPI.  So instead of fiddling with a pot, you write a register to tell the chip what frequency and waveform type you want it to output, and you can do things like frequency or phase sweeps with SW rather than HW.

All of what you have been proposing are great ideas, but completely overkill for what the original specification requires which is a simple sinewave@0dBu, thats it! no need for phase sweeps or anything fancy. If a need for a good function generator should arise, then I would say you are on the right track, but this project is just a simple sinewave at a fixed frecuency to test the input level of stuff, the simpler and cheaper the better. A simple one opamp Wien Bridge oscillator is hard to beat in this respect.
 

Latest posts

Back
Top