Controlling guitar volume

Hi, everyone - first post so forgive me if I'm maybe in the wrong forum.

I'll explain what I'm trying to achieve. I have an utrasonic range sensor (HC-SR04) and wanted to use it to control the output volume of a guitar before it goes into my ampllifier.

Given that I only have limited components available, one of which was an LDR, I came up with the attached (crudely drawn) circuits.

It's actually really simple and works, to an extent, but there are some problems.

Let me explain the setup here, I'm testing this on breadboard before I go all-out and build this into my project strat.

We have two small circuits, the first is just two 1/4 inch input jacks, back to back. The ground of each are connected on the breadboard with nothing in between. The 'live' of the guitar has an LDR in series, this is what should control the volume or output of the guitar.

The second circuit is just the sensor connected to 5V and the UNO (it's actually a Freenove v4 clone, great little board), I also have an LED (blue) coming from pin 3 of the board, the idea is that the closer my hand is to the sensor the dimmer the LED gets, this controls the LDR and subsequently the output volume.

Results...

So it works, I had to create a small enclosure for the LED and LDR to omit ambient light, but it works! The problem, the biggest problem, is that when the intensity of the LED changes I get a slight electrical buzz from the amp which intensifies with the brightness of the light, this only happens while the light is changing intensity. Both of the circuits are isolated but naturally, the LDR and LED are enclosed in close proximity, is this potentially the cause? There's definitely some interference there and I'm wondering how I could maybe filter this out, it's quite noticeable.

The second issue, which isn't so bad but still - even the the LED is completely off, I can still hear a very faint output from my amp, it needs to be up quite loud but it's there.

The way this is working is the sensor will drop the LED intensity to 0 if the sensor detects anything <= 5 cm away, from there we have a range of 20 cm to control the volume - if we hold our hand 25 cm away or greater we get 255 (max) output, if we're at exactly 5 cm we get 0, and there's everything else in-between.

As I say, this works to a fashion, if I could filter out that pesky buzz and maybe figure out how to really drop the output signal it'd be great. What I don't want to do is process the guitar signal via the board, I'd prefer to keep that isolated, no processing other than volume control.

Much obliged and hope this all makes sense - apologies for my crude schematic but it's a fairly simple concept.

EDIT: Just thought I should add, my mistake - I neglected to include the 220 ohm resistor in series with the LED, but it's there. If it helps I can take a picture of the breadboard but it's not pretty - if there's a way I can upload video I could post a demo of it in action althought I'd be using my phone, not great.

The code I have is fine and I intend to re-factor, it's not relevant to the obvious buzzing problem but I'm happy to post it if it helps. I've tried a few things, adding caps in various configurations, tried the LDR in series with ground as opposed to live - kinda guessing at this stage so any input or even suggestions on how to better achieve this would be appreciated.

GuitarVolumeCTL.png

GuitarVolumeCTL.png

There's at least two potential issues that come to mind.

  1. There could be electromagnetic coupling between the guitar pickup signal and either the LED PWM or some external source. External will usually manifest as hum at the power line frequency (50 or 60 Hz depending upon where you live). The LED with PWM on Arduino Uno pin 3 is at 490 Hz (approximately B4 / B string 12th fret with standard tuning). In either case the first thing to do is clean up the wiring by using twisted pair throughout (LED power and return, guitar pickup signal, the ultrasonic sensor, and power to the Uno). Keep the wiring as short as possible especially for the guitar signal which is low level and prone to interference pickup.

  2. It's possible that the LED PWM is AM modulating the guitar signal on the light dependent resistor, but that shouldn't show up when the guitar isn't being played.

If the buzz is ~500Hz try a capacitor in parallel with the LED to filter the PWM. Mayne about 100uF.

The second issue, which isn’t so bad but still - even the the LED is completely off, I can still hear a very faint output from my amp, it needs to be up quite loud but it’s there.

You’ve made a variable [u]voltage divider[/u]. You won’t get silence unless the LDR has infinite resistance (or very-high resistance relative to the amplifier’s input impedance).

A potentiometer (volume control) is also a variable voltage divider but you’re adjusting both resistances in opposite directions.

A related issue is that different guitar amps have different input impedance so you can get different results with a different amplifier.

Noted, appreciate both responses.

On tinkering, it turns out that even with the components covered on the breadboard there's still some light getting through. Yeah, I figured the LDR wouldn't suddenly become an insulator so I don't know why I'm surprised, really...but turning all lights off and testing yielded a much better result in that regard. This is fine as the final build will be behind a pickguard with the LDR and LED under a plastic housing.

As for connections, I know breadboard can cause certain side effects and the connections can be unreliable. I'm also using farily cheap jumper wires. I think now that I've at least tested and proven the concept it might be worth building a permanent circuit on PCB and keep the wiring tight, see if that makes any difference.

Yeah, I tried this through a couple of amps, there's always some kind of odd interference although it's a lot different on different amps. Amusingly, the clean channel on a crappy old Line 6 sounds tolerable, any effects it gets worse. I tried it through a Peavey vypyr and the clean is terrible, it's a far better amp than the Line 6 - doesn't seem to matter what guitar I use, though.

I'll try the cap thing and see how that goes, I'll probably have a working PCB by the weekend...much obliged!

Varying the impedance seen by the pickup can affect the frequency response, since pickups are
large inductances. A single series resistor also is matched to a specific amp input impedance, meaning
the volume response might be different with different amps.

I'd suggest making an explicit divider with the LDR and a fixed resistor (high value like 220k or
so) as a divider.

Another approach entirely is to use a digital potentiometer, although these are mainly available
only in lower impedances like 10k and 1k. Standard guitar pickup impedances are 220k to 1M
range.

Hey, guys. Thought I’d post a brief update since you took the time to offer some advice.

Again, thanks for the input and suggestions. I played about for a while and found a solution. I only had a few caps on-hand and had tried a couple of them across the live/ground of the guitar with varying results, there was always some interference.

In the end I tried two 10 micro farad caps in parallel and that actually works, in that it removes the buzzing I was getting, but it seems to have resulted in a voltage drop, so the output is always considerably lower than it’d normally be at that level.

But it’s progress, for sure. I just need to now figure out how I can ampify the outgoing signal back up to compensate for the loss but I’ll get there, I may come back begging for more advice but I’ll play around for now and see what I can do with this. I also managed to refactor the code, somewhat, getting more stable and accurate readings from the sensor albeit at a small trade in terms of response, but it’s negligible.

Not sure how long dead threads will remain open but I’ll update if and when I get this working 100%.

Thanks again for the help.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.