• Hardware
  • Audio Input Maximum Voltage and Input Buffer

Hi,
I want to use my bela board to develop a guitar effect pedal. First thing I've noticed (and read somewhere in the forum as well) is that the 20k/80k input impedance of the ADC is not big enough for guitar input. So I would like to add a buffer stage in front of the audio input to increase the input impedance of my pedal. This leads me to my question:
What are the maximum voltage levels that are save to be supplied to the ADCs input. (Including the capacitors and diodes that are placed in front of the ADC's input on the cape). I tried to find that information in the datasheet of the ADC but all I could find is that it's to be used with a 3.3V supply voltage, no negative supply voltage. That leads me to my second question: Does the ADC then not care about negative voltage levels on the inputs? (Talking about pin 14/16 for Line2L / Line2R). Does the ADC offset negative voltages itself?

For buffering, I would probably use the 3.3V supply to power an OpAmp and use half of that for a bias voltage. Add a poti and It can be used as input drive as well. The ADC would then have to deal with 0V to 3.3V or -1.65 to +1.65V since the inputs are DC blocked.

Sounds like an exciting project!

The full-scale input for the audio in is 1.8Vpp. There is a digitally-controlled preamplifier (PGA) on board that can add a gain of up to 59.5dB. This means that, e.g.: if your input stage delivers a pk-to-pk voltage of 0.9Vpp, you can later correct that by adding 6dB gain with the PGA. There is also an attenuator just before the ADC that could be used if your input voltage is higher than that, but you probably do not want to exceed the values specified in the codec's datasheet.

The inputs are AC-coupled (see here for details about it), so you can indeed plug in negative voltages, within the safe ranges.

Oh also forgot to mention: we are using the LINE1LP and LINE1RP on the codec, as denoted here.

As far as the output goes, the molex connector on the board breaks out the heapdhone output, but the line output is also available on the board, both on Bela(DC-coupled, balanced, on J9) and BelaMini(DC-coupled, unbalanced on J2).

14 days later

I would recommend using a rail-rail opamp (maybe you already plan to do this). You would get about 3.1Vpp, and then follow that with a divide-by-two resistor divider. That way your input can slam the 3V3 op amp to its rails but you will never get more than about 1.6V peak-peak at the output of the resistor divider.

Assuming 16-bit resolution of the ADC, you wouldn't lose an LSB, log2([1.6/1.8]*216). It often sounds better to clip in hardware rather than saturating registers.

A design I have in simulation (haven't built yet) does similar to an overdrive pedal. I use a high-pass shelf at about 720 Hz, amplify, then divide and apply de-emphasis filter. That way clipping sounds more crisp like overdrive rather than muddy like a fuzz pedal.

LTSpice has a wav file output utility so I was able to simulate a wave file and listen to the circuit simulation. Sounded like overdrive to me...now I just need time to build it and test it on the real thing.

I've spent quite a few hours on this project now. Still nut much further. 😃

Regarding audio I/O: I'll probably stick to the molex connectors so I don't have to worry about DC and protection. As far as I understand, the DAC HP out maxes out at 0.707V rms / 2Vpp. Correct?

My input / output circuit currently looks like this but it's not fully designed yet. I also went through a bunch of iterations. Since I want to stick to through hole components I want to keep the number of OpAmps somewhat low.

Basically, I buffer and offset my signals to 2.5V since I'll be using the 5V to GND supply. Followed by a drive stage doing 0..24dB that simply uses diodes to limit the signal to what the bela takes. I didn't check what diodes I want to use, probably a combination of SI and GE to get a nice response. Adding a capacitor might be a good idea but I also don't want to change the sound to much on the hardware side of things. I've quickly played around with this circuit and a few combinations of diodes and got some nice results at least when going in with a guitar.

I've also decided to compensate for the drive at output with a switch that bypasses the compensation optionally.

What probably is still missing is an output resistor for protection right? And I need input diodes for protection as well.

alt text

    William What probably is still missing is an output resistor for protection right?

    Depends whether this is a separate box or whether it will all be packaged together in the end. If this is packaged in a way that it will be connected to various things other than Bela then output resistor is a good idea. If hard-wiring it to Bela input and leaving it, then the resistor won't do anything meaningful.

    William And I need input diodes for protection as well.

    That is probably overkill. Up the input resistor to 1k. If you add the diodes put them on Pin 3 of the op amp so you have the +/-2.5V headroom for incoming signal.

    As for the input stage -- the back-back diode clipper is going to cause distortion on typical guitar signal. This is soft clipping that will start to have an audible effect on signal levels at around +/-300mV. If you want that coloration going on into outright distortion when you dig in on the strings, you should use a harder clipping mechanism.

    I would suggest you just remove the diodes and put a resistor divider after the op amp. The Rail-to-Rail op amp will clip at roughly 5V pk-pk swing. A resistor divider of 1.6Vpp/5Vpp will put your maximum clipped level within the audio input range of Bela.

    In this case you will have all of the headroom available from the Bela audio input and only be clipping when Bela ADC would be saturating anyway.

    If you use the scope utility and a pot for your post-clipping level, then you can generate a tone from the output, feed back into the input and measure where it is clipping. Adjust the pot to watch the clipped waveform grow until peak-peak is at between 0.95 to 1.0 on the waveform (digital saturation is at 1.0 or quantized to something like 0.9999999999...). That way you can ensure the hardware clips before the register saturates.

    You have a few better options to generate the 2.5V voltage reference. This has to be as quiet as possible, as any noise at the reference will propagate into your audio signal.
    On Bela, if you have a rev B2 board (i.e.: if you bought it after December 2017), then you could use the 2.5V "MicBias" pin. This is an unpopulated pad that connects to the MicBias pin of the TLV32... codec. I didn't test it, but I assume this will be fairly clean an noiseless, and you should be able to use it without buffering.
    On BelaMini, that pin is not available, but there is a 4.096V voltage reference that is internal to the analog ADC that is available on the headers (labelled "REF"), so you could use that. This is high-impedance, so make sure you buffer it with a spare opamp.
    Worst case, if you just want to get this voltage reference as a resistor divider, I would recommend you divide down from 3.3V instead of using 5V (as you are doing now), as the latter is much noisier than the former.

    Another thought is that the actual voltage at the 5V rail will depend heavily on the quality of the power supply you are using. It will often be the case that you will have a noisy rail, whose average value is sometimes around 4.8V or 4.9V instead of 5V. For this reason, in order to maximize headroom, and take advantage of the high PSRR of the opamps, you will want to bias your signal to a voltage slightly below the nominal midpoint of 2.5V. For instance, try biasing to 2.3V, so that a full positive voltage swing (4.6V) will not get too close to the noisy power rail.

    I just switched over to 3.3V and it runs nicely and with very low noise level. (At least in relation to what I got with the 5V from my external power supply or the Bela) The 3.3V is lower then what is noted as the recommended supply voltage for the TLC2262 I use but as far as I understand, it's capable of going down to ~2V. I'm not quite sure about the input voltage level though. Since the ADC only takes 1.8Vpp anyway, I don't really see a reason to use the 5V besides maybe making the OpAmps life a bit easier.

    @ryjobil About the diodes. I wanted to add the gain control to fully use the 16bit. Otherwise a dry signal from a single coil guitar probably wouldn't use much of the 16bit. But I also wanted to make sure to get some nice drive before anything starts distorting hard. Obviously, clipping the ADC will be ugly but clipping the OpAmps I currently use isn't much better.
    I know use a combination of a Ge and a Si diode in series, they hit a ceiling at ~1.3V, I probably could add something else in order to shift it a bit more. I also use a Ge diode in series with a resistor to smoothen out the distortion. I quite like the sound but I probably will play around with adding a high shelf to boost high frequencies that I can compensate for in code again.

      William I just switched over to 3.3V and it runs nicely and with very low noise level. (At least in relation to what I got with the 5V from my external power supply or the Bela) The 3.3V is lower then what is noted as the recommended supply voltage for the TLC2262 I use but as far as I understand, it's capable of going down to ~2V

      I suggested you'd switch to 3.3V (or the other option) as the source for your voltage reference. The opamp can still be powered from 5V: normally opamps are good at rejecting noise in the power supply (often > 80dB attenuation, see PSRR in the datasheet), so there is no need foor their power rails to be extremely quiet

        giuliomoro

        Hey,
        merry XMas and all. 🙂
        I just got the Bela Mini i want to use for the project. Lovely little thing.
        I thought about something.
        Since I‘ll need to add some kind of power input anyway, I thought about using a 9V power supply which could power the I/O opamps (and maybe Analog ins, reduced to 0..4V). I would then use a 7805 to get a 5V for the Bela. Datasheet says that it manages 1.5A, would that be enough to drive the Mini? 9V supply’s for Audio stuff are much more common then 5V, I expect that most of those are just for charging stuff and come with a bunch of noise.

        A bit more complexity but I thing it has some advantages. And I’ll have to make sure not to toast the Bela with 9V. 🙂

          William I would then use a 7805 to get a 5V for the Bela. Datasheet says that it manages 1.5A, would that be enough to drive the Mini?

          The Mini will absorb about 420mA. The 7805 will be able to handle that, but make sure you put an adequate heatsink on it, as you will be dissipating about (9V-5) * 0.42A = 1.68W on it. Also, you will need your power supply to provide enough current.

          Ok, will do. And I’ll probably update my schematic and post an updated version when I’m back on it. 🙂

          Talking about heat. Do i have to worry about the temp the A8? I want to put the whole thing in a Aluminium case. I’ll probably just heatsink the 7805 against the case but I can’t do the same with the A8...

          First of all, what you are doing for the preamp will work lest it sounds like I'm saying otherwise. If it sounds good to your ears, go with it. The rest of this gives you more ideas if you get dissatisfied with the result.

          William @ryjobil About the diodes. I wanted to add the gain control to fully use the 16bit. Otherwise a dry signal from a single coil guitar probably wouldn't use much of the 16bit.

          I fully understand and agree with the intent. The salient characteristics of the strategy I expressed uses harder clipping to reduce the range over which the nonlinear function is operating. The point is to create a wider region of operation where the clipping mechanism has almost zero effect until the output signal gets more near to the rails. That way clean is pristine, but occasional clipping isn't ugly.

          The way you have it implemented the circuit will be distorting even when you want it clean if you're using the full 16-bit resolution. I did some simulations on your circuit where the clipper was a Schottky diode in series with an Si diode, for 1.7Vpk-pk clipping. At 0.8Vpp there is about 1% distortion. Full range (1.8Vpp) the distortion increases to about 20%. Basically you would have 15 bits of clean dynamic range and you lose the MSB to increasing diode nonlinearity.

          A traditional back-back diode clipper is actively affecting the sound long before you get audible buzz. Maybe you always play with a little dirt and don't mind this. On the other hand, 15 bits is pretty good so maybe this will be ok if you use 2 series diodes.

          Here are a couple ideas for how I am working around this problem. Maybe this will make it more clear what I'm saying and perhaps spark some ideas.

          Discrete implementation using "diode compression op amp" (5V "Vcc" needs to be filtered with R and large C since this doesn't have much PSRR to speak of)

          Op amp-based implementation. The key point is clean headroom before diodes can become forward-biased, and then output resistor divider brings the max clipped signal level down to within the ADC input range. You can put as much gain on the input side of things to make up for it.

          The following simulation plots are from the discrete version, but the op amp version is designed for the same frequency response while the op amp clipping is symmetric:

          And a transient sim to see the soft clipping as well as the amount of gain available on the first stage.
          I noticed I made a mistake (notice 870mVpk-pk). Change R4 to 2.2k and R7 to 1.8k to get 1.9V peak-peak assuming Vcc = 5.0V. One could also use a 20k resistor parallel to 5k pot. Adjust the setting on the 5k pot to get full-range input when the circuit is slammed rail-rail. The value of 4k in that lower leg is important to the output symmetry (hint you can tweak clipping symmetry by changing this resistor value).

          FWIW I'm using 12V supply and a 600 kHz switcher to get the 5V. This switcher I designed myself, but you can get SMPS DC-DC converters from DigiKey or other distributor of choice. Murata has a good number of these.

          This might be a helpful tip if you have a hard time managing the heat from a 7805.

          Hey,

          thanks for your input! I'll really have to see how much room i have for the pre/post amp circuit. I'll be working with through hole components and a perfboard. So stuff tends to take quite a bit of space.
          Regarding the voltage supply, I already found a switching regulator that works with 400-500kHz as an alternative to the 7805.

            William I'll really have to see how much room i have for the pre/post amp circuit.

            Yes, there is another consideration. As for me, I use little SOT package dual PNP-NPN complementary pair package and SMT capacitors, so either of my circuits could be made to fit on a board the size of a thumbnail.

            The circuit you posted has simplicity, making it easy to construct in a small space, even with large TH components. The ears give the final opinion that counts.

            Good on the switching regulator. You can always filter the output if you get noise from it, but you can't fix heat with a filter 🙂 . An extra R&C is small compared to a large heat sink.

            Have fun

            @giuliomoro
            Hey, I have a quick question regarding powering the bela mini. Since I want to put the whole thing in an enclosing, I want to use Pin P1-1 for powering the mini with 5V from a 5V/1A switching regulator. However, for programming the thing, I probably want to temporarily connect a USB mini plug as well. Do I have to worry about the two getting in each others way? Or does the bela notice that it doesn't need to draw power from the USB pin?

            Otherwise, I could add a small DIP switch to temporarily turn of the "internal" 5V supply but I've noticed that those switches don't really want to manage up to 1A. (Even though the Bela probably will only have to deal with ~600mA max)

            Another short question: What are the connectors used for the Audio I/O on both Bela and the Mini? I'm looking for a way to connect the board to I/O jacks and so on with 2.54mm pitch connectors. Found JSTs as an alternative but I'm still curious what is used on the Bela,

              William However, for programming the thing, I probably want to temporarily connect a USB mini plug as well. Do I have to worry about the two getting in each others way? Or does the bela notice that it doesn't need to draw power from the USB pin?

              According to this, that pin (P1.01)is the equivalent of what is P9.05/P9.06 on the BeagleBone, which is the one where the external power from the barrel jack goes. This means it's actually meant to be used at the same time as the USB power: the power-management IC should be able to switch seamlessly from USB to the 5V IN.

              William (Even though the Bela probably will only have to deal with ~600mA max)

              I didn't measure the inrush current, but once it's up and running it's between 400mA and 420mA. I didn't manage to see any variation depending on CPU usage.

              William Another short question: What are the connectors used for the Audio I/O on both Bela and the Mini? I'm looking for a way to connect the board to I/O jacks and so on with 2.54mm pitch connectors. Found JSTs as an alternative but I'm still curious what is used on the Bela,

              Hopefully this should help.

                William However, for programming the thing, I probably want to temporarily connect a USB mini plug as well.

                It would be a good idea to have a blocking diode on your external 5V supply unless you know for a fact that your regulator already has this function. Otherwise if your regulator output is less than USB power it might function as an extra load on the 5V rail.

                Schottky or STMicro FERD are good choices for low forward drop.

                Most switching power supplies won't sink current, so by rolling a dice you would probably find 5/6 don't need anything extra.

                I would add something extra in case you have one of those synchronous topologies that will sink and source.

                The switching supply I picked out doesn't come with protection, datasheet isn't very specific but it mentions that one should use a blocking diode. Does it make sense to use a FQP47P06 PMOS in parallel with the diode to block the supply? (gate to ground, drain to supply and source to Bela P1)

                With a 1N5817 Schottky, I get a 200mV voltage drop across the diode at 500mA. Adding the PMOS reduces the voltage drop to <30mV, the PMOS has quite a low drain-source resistance of 0.027 Ohm. I use the same setup to protect my circuit against reverse polarity power supply and it seems to be the same kind of situation, right?