onsdag 29. april 2020

LED dial light pipes

For the XM8 UI I want led dials around the potentiometers/encoders. I've sent a prototype of the led ring itself to production, and now I had a little time to quickly test some ideas for making it look as nice as possible.

If possible, I want to have a continous ring clockwise from the left to where the current setting is. It may draw too much current, but for now that's my goal. I also want the end of the ring to be as sharp as possible - and in the event of having to use a single led at the time, having as little leaking light from the current led to the ones next to it. Finally, I want the light to be as uniform as possible.

To get distinct sections along the ring, I'm trying out light pipes, one for every LED. They need to have as smooth as possible sides to reflect the light and keep it contained within the pipe, and they must be separated to prevent leakage.

As I'm not sure about exactly how to do this, I made several prototypes:

For the two first ones each light pipe is actually a separate piece of plastic. I thought that painting the sides of the pieces and glueing them back together could be an option.

Number three is a variation where all the parts are still held together at the edge. The gap between them is whatever the laser leaves behind when cutting the acrylic.

Row two: The first one is just to have somewhere to glue the pieces from the center one in row one, as I could not be bothered making the cut lines shorter.

For the center one, I've made the slits between the segments a little wider, my theory was that this would reduce leakage.

As for the four last ones, they test the second design goal - uniform light. Wherever there is black on the drawing there will be engraved white on the acrylic, effectively making a diffuser. There are two diffusers where I have not cut any lines, they will be used on top of the light pipe, and two where the segments themselves were diffused.

I quickly realised that painting and glueing the parts together is not a viable option. The parts are too small and there are too many of them.

The ones with laser-thin slits actually have quite wide slits as it is, so there was no need to widen them.

As for diffusers: Putting the diffuser on the segment means that the slits are still visible. Not a great look.

I also wondered if the diffusing layer should be on top or bottom. It definitely needs to go on top, as the light has to spread before it hits the diffuser.

To test the combinations I taped off a normal led so that it is as narrow as one segment. I put the diffuser layer with the diffuser down against the layer with the segments. The diffuser is clearly visible, the slits are mostly hidden. I would like the diffuser to be less visible, but I think that using red acrylic may help a lot here. Each layer in my test is 3mm btw, so this builds 6mm in addition to the height of the leds.

LED with tape on it to make it more narrow
Segment layer
LED below one of the light pipes.  
There is almost no light leakage between the light pipes, I am really satisfied with this result. There will definitely be visible lines between each segment though, so I may have to experiment with engraving instead of cutting the slits, to allow a little bleeding at the top. An air gap between the layers may also help.

Notice thast the gaps are slightly visible. I think this will improve slightly once the pot is put in a case as there will be no light coming from behind.

With a randomly chosen cap on top. I think this looks great! This diffuser is 4mm wide, I also have one that is 2mm, making each segment almost square. I will test both to see which one I like the most. I will also put black acrylic in the centre of the ring (on the segment layer), and the diffuser layer will be cut so that only the ring protrudes through the front panel.

torsdag 9. april 2020

Distortion breadboarded

I've breadboarded two versions of the distortion circuit, both with input attenuation and output amplification to keep a 10Vpp signal almost untouched.

Pre-distortion amplification

First I did the version with pre-distortion amplification. With distortion CV at 0V the distortion circuit sees around 30mVpp. This is heavily amplified to distort.

At the other end, a second OTA amplifies the signal. The output has unity gain for a 10Vpp input when CV is around 2.5V.

Hard clipping circuit with pre and post distortion VCAs

Hard clipping, distortion CV from 0 to 5V

Soft clipping circuit with pre and post distortion VCAs

Soft clipping, distortion CV from 0 to 5V

This circuit worked pretty much as in the simulation. I do have some issues with CV feedthrough so centering is not perfect when distortion changes.

I think I have to bite the bullet this time and introduce AC coupling to get rid of this. Placing a cap in series with the 1k resistor to the distortion op amps negative pole seems to do the trick, and will function as a high pass filter as well (beware though, if not chosen correctly low frequencies will not be distorted, in fact they will be attenutated.

Distortion CV at 0V

Distortion CV at 2.5V, almost full distortion and more than double amplitude

Distortion CV at 5V, full distortion. Signal is clipped unevenly by the op amp.

Distortion CV at 2.5V, almost full distortion

Distortion CV at 5V. Very similar to half distortion.

It seems that the real life circuit sees a higher maximum input gain than the simulation. Full distortion is reached much earlier. Also, compared to the OTA in feedback loop version below, the CV response seems exponential, not linear.

OTA and parallel resistor in feedback loop

Then I tried breadboarding the OTA-in-feedback version. I had lots of trouble and could not get it working as expected at all. After much experimentation I ended up with a well functioning circuit. I then started documenting the changes, and realised what was going on: I had inadvertently put a 33k resistor in the feedback of the distortion op amp. This works in tandem with the signal fed back through the OTA, so it completely changes the amount fed back.

As a bonus, the CV control of this version seems to feel much more linear - in the other version all changes came at the start of the CV and very little later. Also, the soft clipping amplitude seems to stay very close to 5V, so in some ways it feels more "correct", the volume doesn't increase as much.

After discovering my error I simulated this circuit too and it works as on the breadboard.

PS: The distortion CV now works in reverse: 0V is max distortion, 5V is no distortion. Unity gain through the circuit is the same as above, approximately 2.5V.

OTA and 33k resistor in feedback of op amp

Soft clipping

Hard clipping, starts very soon after turning the distortion pot.

OTA in feedback loop without the 33k resistor

Now I went back to the circuit that I was TRYING to breadboard and looked at the simulation again. I think I got lost because I couldn't get it working the way I wanted to. Looking at my previous Distortion post, I realised that the hard clipping starts much later, and so the output has a higher amplitude when clipped than in my happy accident.

I then changed parts back to my original design and did some tweaking, resulting in this circuit:

OTA and no resistor in feedback. Soft clipping version

OTA and no resistor in feedback. Hard clipping version
Soft clipping

Hard clipping

Results on the breadboard for versions with OTA in feedback loop

The circuit on the breadboard have some small differences from the simulated one. The output amp uses a 120k resistor instead of a 150k to get unity gain at 2.5V CV. I left the 180pF (Low pass filter) in place, and used 1k pots instead of the resistors to ground on the OTA inputs (except for the distortion OTA in the version without resistor in the feedback.

The potentiometer settings used were:
VCA pot: 620 ohm to ground on negative input, 365 ohm to ground on positive input
Distortion pot: 479 ohm to ground on negative input,  512 ohm to ground on positive input in distortion OTA. For the version without a feedback resistor I breadboarded it as in the schematics.

All oscilloscope pictures are of a 473Hz 10Vpp input wave. Vertical resolution is 5V/square. Output VCA CV is at 2.5V which according to the simulations should give us unity gain for undistorted signals.

First, the circuit with both an OTA and a 33k resistor in the feedback, soft clipping:

Triangle wave, soft clipping selected and distortion CV is at max (5V) meaning least amount of distortion. Output is equal to input
Same as above but with distortion CV at 0V, meaning max distortion. Amplitude only changes slightly but output is heavily distorted.

Hard clipping:

Same as above, but this time with hard clipping. 5V distortion CV, No signs of clipping and still unity gain.

Again same as above, hard clipping, but with 0V distortion CV/max distortion. Heavy clipping and just slightly higher amplitude.

Without 33k resistor in feedback

Now for the circuit without the 33k resistor in the feedback loop. This didn't work very well, the clipping became very asymmetrical. This may be due to the high attenuation of the input signal? I tried replacing the resistors at the positive and negative OTA terminals with a 1k resistor but that didn't change things. Maybe an HP filter capacitor would help?

Soft clipping:

Soft clipping, max distortion CV. The signal passes unclipped but with the output VCA CV at 2.5V the amplitude is only around 7Vpp, and also not symmetrical around 0V.

Soft clipping, no distortion CV. Heavy but unsymmetrical clipping. Amplitude is almost the same as for the previous circuit.
Hard clipping:

Hard clipping, max distortion CV. Same as soft clipping, no surprises there.

Hard clipping, no distortion CV/max clipping, looks very similar to hard clipping for the other circuit except that the clipping is unsymmetrical.

Pre and post OTA breadboarded

510 ohm resistors instead of trimmer for version with 33k in feeback

I tried replacing the 1k trimmer pot on the distortion feedback OTA with two 510 ohm resistors to ground. That gave the following result:

The input is now distorted, meaning the OTA sees a too high voltage.

By measuring the position of the trimmer potentiometer for the distortion feedback OTA when signal does not clip at 10Vpp input (750 ohm), and using the resistor divider equation, I found that the distortion OTA sees +/-165mV. Going the other way, a resistor divider with 15k and 510 ohm will yield the same result. Here I have done the change:

When tweaking the potentiometer I could see that clipping starts right after I started turning the potentiometer. Since there may be production differences, an even smaller input resistor would give a litte room for trimming the input digitally. Here is the effect of 12k, a slightly smaller amplitude:

I also tried replacing the trimmer in the VCA OTA part, that heavily offset the output. It could be possible to use AC coupling here, but we would still get uneven clipping in the VCA at high gain, so it might be best to use a trimmer.

I also did see a slight distortion at minimum distortion CV, but this is probably not related to clipping.

510 ohm resistors in the simulation

In simulations though, it does not work very well:

Signal is much smaller than in the breadboarded circuit when no distortion CV is applied.

I am not sure I will do any more work on this now, I have a well functioning circuit that I will test with some "real" signals instead later (the one with the extra 33k resistor in the feedback, 12k on the input and 120k on the output).