Sylonex and Arduino preamp

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
I'm working on a Sylonex volume, steered by an Arduino instead of a potentiometer. I want to share my experiences on it here. I will not put everything at once. I’ll write when I have some time, and post it when I have material worth to share.

OK, OK, OK. I agree it’s not the same as the basic version from George. I agree that the basic version will sound as good, maybe even better. I’ve also read lots of discussions on the use of a more complicated version then the basic one. But I wanted something different, I explain why:
  • The concept behind the lightspeed to avoid any contact is really great, I wanted to use it. And now I’ve heard it working, it sounds indeed more open then a good pot (I replaced a Panasonic plastic by the lightspeed).
  • It really bothers me to buy 100 optocouplers, match them all and throw most of them to get some OK parts at the end. Working in the industry, I always feel bad when parts need to be thrown away, especially parts that are still working OK. I know that the cost of throwing 96 parts will be cheaper then what I made, but the idea behind remains.
  • My family is very often putting the volume of my amp at zero to play an instrument. And then they forget the amp, leaving it running useless for hours. I want to stop it automatically after some time.
  • My installation is also too complicated for my family. They need to switch on the amp, and eventually the DAC. And the input needs to be chosen on the amp AND on the DAC. This seems really difficult, although I still don’t understand why :confused:. Therefor I want to change it: they will have to push 1 button to choose 1 source, and then everything will be switched automatically.
  • I want full remote control over amp, PC, CD, tuner. I prefer the remote on a tablet or even better from a mobile phone over wifi or bluetooth.
  • I wanted to use an Arduino since a very long time. The platform looks really great and there is lot of support available.
  • I wanted to develop some new electronics as that is something I really like. And not only microprocessor or digital, but also some analog and the link between all of them.
  • I never worked with I2C, and as a lot of ICs have this as a connection, useable over a long-distance bus, I wanted to try this as well.
  • And lbnl I want to try commands going over bluetooth, usb, coming from html etc. So some programming and communication on top.

Enough excuses? Enough for me anyway to buy an Arduino, to buy some Sylonexs, DACs, ADCs, opamps etc. But not after setting up the concept first. Here the concept:
  • An Arduino (Mega) will manage the complete installation (preamp, DAC, tuner, CD-player, poweramp, user-input, link to PC, link to remote).
  • A human interface on the Arduino, PC and/or tablet, phone etc will make it really easy to manage the whole thing.
  • The Sylonex optocouplers will receive the “light” from a DAC, steered by the Arduino over I2C.
  • To avoid matching of the optocouplers, there is a calibration loop using a current-source and an ADC. A calibration routine on the Arduino will guarantee linearity over a broad range. I can even change impedance on the fly.
  • Inputrelais are needed as well as I want to connect 3 sources.
  • There is (only) 1 relais in the outputcircuit, other relais are there for calibration of the 4 optocouplers. Later I will have more to start and stop amps, tuner and other devices. Most of it is connected through I2C.
  • Very good stability of power supplies and other circuitry.
  • All components will have their own I2C-ICs to manage I/O to the Arduino. An I2C-bus will connect all.
  • The Arduino will communicate to the outside world (tablet, PC, IR-remote, web).

It looks easy enough to do, doesn't it? Forget it :bullseye: !
At the moment I can control the volume and I can switch inputs. This is enough to have it running and to evaluate the working. But this took me 9 months, although not full-time. I really enjoyed this time, I learned a lot and it's worth it. That's why I want to share my experience.

Next time something on the behaviour of the loop DAC - opamp - Sylonex. This was the hardest part.
 
Arduino and remote control

This is great. I was looking to use Arduino just to control the LDR's and build a remote control using the new Apple Aluminium Control.
I use the Warpspeed LDR design as it allows the volume to go down to zero and have several other benefits of lower noise and better current control. The pot is only 200 ohms and does a good job of limiting the current so the LDR does not burn out at any volume or even when left on. This was the hardest part as you cannot find a motorized remote with this impedance.

I look forward to your build and see how it works. Are you planning to program a chip or keep the whole Arduino controller in the final product?
 
There are some out there, can be a custom job, in the $300-$400 price range. The question is, should we push the art into the obscenely expensive Picasso range?

I was thinking it was cheaper to down low to microcontrollers that are cheaper the the whole control unit. The Microcontrollers being in the $10 range.

Let me do some research to see what I come up with.

Using the ADC is a very interesting idea. Getting a voltage out to a VCCS that is adjusted for each LDR will be ideal.
 
I plan to keep the Arduino in. A small Arduino board is very cheap. I have the Mega which costed me about 30€, small ones go down to 12€. I prefered it for the easy programming and interfacing, and there are lots and lots of libraries available that save days of (sometimes boring) programming time.
The Arduino will not only do volume-control. Later it must also switch PC, DAC, CD-player, Tuner and Power-amp. And it needs to connect to the remote that will be a tablet or mobile phone. Therefor I think it's an easy platform to do this job.
I agree it has a cost. Each hobby has a cost. Part of the cost is to improve the sound. But there the Georgehifi solution is the best value for money one can find for a Sylonex solution, I would have bought that if it was for the sound only. But part of the cost is for fun, I really like to work out and develop this stuff. For 100€ you can select enough parts to get a big box you can play with for months. The hourly cost soldering (and desoldering:() parts is a lot lower then the hourly cost listening to CDs, counting the cost for a CD. And I saved some money by buying 20 optocouplers instead of the 100 needed to match ;).
The approach is indeed modular. I have an analog board, 5 voltage to current boards from which 1 works as resistance measurement interface to ADC, a power distribution board and I connect selfmade and Jeelab-modules for I2C-interfacing. It's a 3D-design. I try to make a decent picture to show it working. And I urgently need to make a blockdiagram to explain.
 
Nice to see another Arduino project. Feel free to reuse the Apple Aluminum Remote code from my project.

Using Arduino to calibrate the ldr every time you turn it on is the best way to keep linearity in the device. You can even use the built in analog inputs and outputs to do 256 levels of calibration (not as good as a ADC, but maybe good enough).
 
The DAC-Opamp-Sylonex link
Or more clearly: how to control the current through the LED to have good control of the resistance. It took me ages to have some fine control of the optocoupler resistance. The optocoupler is far from linear, even far from logarithmic.

1. Linear
A direct connection to a DAC with an opamp converting voltage to current (see schematic 1) is not giving enough resolution to have good volume-control at the low end. See graph 1 showing the relation between current on the X-axis and resistance on the Y-axis (not on scale). The axis is logarithmic. It is clear it’s impossible to control the resistance this way.

2. Exponential
I tried with an exponential amp between the DAC and the optocoupler (see schematic 2, examples can be found in VCOs for synthesizers). It took a while to have it working in a very basic way (without exotic parts and without temp adjust), but also that didn’t work. See graph 2. It looks a lot better, the result is linear on a logarithmic scale. Still the control is not good enough. I stopped working on this quite fast as there were several problems. First the relation was still NOK. Second you need a lot of parts to compensate for temperature drift. I would have had far too complex and expensive electronics to control the LED. And third I had to go from the DAC that has a positive voltage out only, to a voltage swing from negative to positive. It was really interesting to search for schematics and to work it out, but I stopped even before linking it to a real DAC. The graph is made with manual measurements.

3. Feedback with 2nd Sylonex
Finally I used a 2nd optocoupler in the feedback loop of the opamp to have good control (see schematic 3, thanks Gootee for the idea). But even then control of the very low volumes is critical.
As the optocouplers are reacting really slow, it also took some time to have the circuit around the opamp stable, I had to slow down the opamp quite a lot to avoid oscillation, that’s what C3 is doing. I discovered this late, that’s why I had to solder it at the bottom of the PCB. What you don’t see on the schematics is that Opto+& - are going to 2 optocouplers in series. The resistor of 1 of the optocouplers goes to LDR+&- for the feedback loop. For the results see graphs 3 and 4 that were taken on the final volumecontrol. The 0 of the axis is at the 0 of the DAC and that’s where the maximum current goes through the LED. The graph is showing the digital values from both DAC and ADC. Full range is around 50kR.
As you can see, this is linear, nearly over the whole range. Only at the bottom it is far from linear due to the saturation of the LEDs. And the zero is not really at zero as the DAC is not linear at all around zero (this is depending on the DAC used). I had to put an offset to be able to get the maximum current in the LEDs. Both deviations are easily compensated in software.

Still needed is very high resolution to have good control and small steps in volume together with coherence between left and right. A very stable power-supply of the DACs and ADC is mandatory, as is the PS for the opamps. I'll come back to this. First I'll make a block-diagram and some pictures, unfortunately I have to work this WE.
 

Attachments

  • VoltToCurrent_Lin.JPG
    VoltToCurrent_Lin.JPG
    15.9 KB · Views: 1,322
  • Graph_RvsDAC_Linear.JPG
    Graph_RvsDAC_Linear.JPG
    41.2 KB · Views: 1,317
  • VoltToCurrent_Exp.JPG
    VoltToCurrent_Exp.JPG
    44.6 KB · Views: 1,302
  • Graph_RvsVolt_Exponential.JPG
    Graph_RvsVolt_Exponential.JPG
    108.5 KB · Views: 1,292
  • VoltToCurrent_Feedback.JPG
    VoltToCurrent_Feedback.JPG
    83.6 KB · Views: 1,294
  • Graph_ADCvsDAC.JPG
    Graph_ADCvsDAC.JPG
    60.3 KB · Views: 437
hello fellow arduino 'avrdudes' (lol)

I also had the thought of using a cpu (arduino) to help keep an LDR honest, so to speak. I had posted about it, here:

Arduino based passive analogue input selection & volume control - Page 2 - Head-Fi.org Community

there was discussion on that thread and on others, but it never went to the level of actual breadboarding.

a good calibration and control loop would be the value-add to the 'simple' ldr concept.

I have some non sylonex ldr's that I found at a local surplus store. if the ldr itself can be taken out of the equation (or make it matter very little) that makes the project so much more useful - if any old ldr type device can be made to work as long as there is a software driver to keep it honest.
 
I have some non sylonex ldr's that I found at a local surplus store. if the ldr itself can be taken out of the equation (or make it matter very little) that makes the project so much more useful - if any old ldr type device can be made to work as long as there is a software driver to keep it honest.
In the system I made it's easy enough to change the ranges (of current through the LED and resistance of the LDR) by changing 1 resistor in each DAC, see the schematics for the calculation. That makes it possible to use other parts then the Sylonex-ones. The only limit is the maximum current through the LEDs the opamp can deliver which is 35mA for an OPA277. BTW, I've chosen this opamp because of the very low offset-voltage it has.
For the software it makes no difference which part is used. The software takes into account the low reaction of the optocouplers at very low resistance. For each calibration step, it waits till the resistance has stabilised. It means slow reacting optocouplers can be used as well.
A matter of importance is to have the optocoupler in the feedback loop not too much different from the optocoupler it is linked to. The more they are different, the more the slope of the curve DAC/ADC will be different from the ideal case. It's not a problem for the software as it is compensated, but in extreme cases it could make the control of the resistance less precise.
 
Here is a block diagram of the analog part of 1 channel only. It shows the 2 optocouplers, but only the resistor part of it. For the rest it's only relais for input, for mute and for calibration.
The 3 INPUT-relais are clear, no comment needed.
REL_OUT is clear as well. It's used as mute by switching off the output during the calibration, and it links the output to the calibration circuit.
REL_SHUNT connects the output to the earth or to the calibration circuit. Connected to the calibration circuit, it makes it possible to measure the resistance of the shunt resistor. The connection to earth is needed to be able to measure the series-resistor.
REL_SERIES is there to measure the resistance of the series-resistor, in this case the output needs to be connected to the ground which is done by rel_shunt.
In total there are 8 relays in the stereo-preamp, steered by the Arduino through I2C. I used a Jeelab Output Plug. This is a small module containing a MCP23008T and a ULN2803 as a buffer. I added a hardware protection to avoid calibration and closure of input or outputrelais simultaniously as this would put DC on the output. My poweramp is linked in DC and I don't like the small of frying speakers. As a programming error is easily made, a hardware protection helps to sleep better.
Measurement of the resistance is done by a precise current source which sends current through the resisitor. A voltage buffer sends the tension over the resistor to an ADC. A famous law does the rest. The buffer board is the same as the one for the DAC, only some parts are different to make it really precise and stable. As an ADC I use a Jeelabs Analog Plug, based on a MCP3424. It's a 4 channel one, but only 1 is used at the moment.
The DAC is remaining now. That's a MCP4728 4-channel DAC. I dit put it on a small breadboard to be compatible with the Jeelabs connections.
Next time some pictures.
 

Attachments

  • BlockDiagram.JPG
    BlockDiagram.JPG
    16.4 KB · Views: 914
Here finally some pictures.
Picture 1 shows the complete unit.
> In the front you have from left to right the 3 I2C-interfaces:
- the Output Plug from Jeelabs, used for the relais
- in the middle the ADC-plug from Jeelabs
- and at the right the DAC-chip, soldered on a converter to DIL by Tirna-electronics.
> These boards are connected to the first big board that does the distribution of all signals and power to the right connectors on the backside. This big PCB is called the distribution board.
> In the middle between the 2 big boards are 6 small PCBs.
- 4 of them are to convert the output from the DACs to current through the LEDs, incorporating a 2nd optocoupler on the analog board in the feedback loop.
- 1 is the circuit to convert resistance to voltage
- and the last one makes to connections to the relais. Picture 2 shows a detail.
> The name of the last board is revealed above. The analog board contains the relais and the optocouplers, see pic 3 for a close-up of the Sylonex parts. Connection to input and output is done on the back.

The last picture shows the complete preamp, including the B1symmetric as buffer, and 2 power-supplies. 1 PS is used for the I2C-parts. A very good PS is needed to keep the DACs working stable. And the same quality of PS is needed as power for the opamps.

I still have to move it in the housing, but I need to swap my multimedia PC first. You don't see the Arduino. It will come in the same housing as the PC, far from the preamp. This will allow to have the buttons and display at eye-level, and the preamp close to the poweramp which is at floorlevel. All signal cables can be very short. A galvanic isolator between I2C and the Arduino will be added as well.
 

Attachments

  • Preamp Overview.jpg
    Preamp Overview.jpg
    672.1 KB · Views: 934
  • Opamps Closeup.jpg
    Opamps Closeup.jpg
    252.4 KB · Views: 868
  • Sylonex Closeup 2.jpg
    Sylonex Closeup 2.jpg
    97 KB · Views: 820
  • Preamp Complete.jpg
    Preamp Complete.jpg
    366.3 KB · Views: 846
I have the calibration routine OK. The goal of the routine is to measure the current needed against the resistance asked. This is done for each optocoupler for 10 resistance values. The resistance values are chosen more or less logarithmic, which is obvious.
I keep the links between current (DAC-value) and resistance (ADC-value) in an array.
Calibration starts from the default value of the current. This value is changed until the resistance value has been met. At that moment the obtained DAC-value is written in the array.

The optocouplers are really slow, especially at high currents. Therefor I repeat each measurement until I have 5 identical resistance measurements. I observed that 5 stable results is really stable. For sure this does not work at the high resistances as they move (+- 2Ohm on 10kOhm), there a maximum number of tries stops the calculation. It took me a while to find out that waiting for stabilisation is a real must. Without this the loop is unstable.
I also needed to optimise the search for the correct value by avoiding too big jumps, too small jumps etc. This is described in detail in the routine I attached.

At the end I stored the calibration values as fixed values in the program, this is the default used at startup. But I can do a re-calibration whenever I want. Best is to do it at working temperature. Changes in values after calibration are very small. I think it would be interesting to see it over a very long term to evaluate the drift of the optocoupler.
Measuring the 10 values for 4 optocouplers, including the stabilisation etc takes less then 5 minutes. Therefor it's not an issue to do it from time to time. To change the default values, I need to change the program. I want to change this in the future and put the new values in eprom. But first I need to put it in the final housing.
 

Attachments

  • Calibration.txt
    6.9 KB · Views: 224
Galvanic isolation is really important !!
I had an issue during programming of the Arduino. To program it, I need to connect the Arduino with USB to the Audio-PC in my stereo. That PC is earthed, and it's linked with USB as well to my DAC. This gave me 2 problems:
1st issue:
There is an earth loop between the PC and the DAC causing noise during playback. This was not too bad at the start, but became really annoying after putting very short powercables. Probably this reduced the resistance in the loop too far. A solution for this was the implementation of a USB-isolator between the PC and the DAC. I installed the Ultravox from Diyparadise and the sound became a lot clearer immediatly. Also the noise coming from the PC dissappeared completely.
2nd issue:
There was a similar loop between the PC and my preamp, coming from the USB-cable, and coming from the fact that the ADC in the calibration is linked both to the ground of my preamp and to the ground of the Arduino. I could have solved this by putting a relay to connect the DAC to ground only during calibration, but I was too lazy for that. Another solution was to isolate the Arduino completely from I2C. Therefor I used an ADUM1250, which is a galvanic isolation IC for I2C. As it's too small for my fingers and soldering gun, I asked Tirna Electronics to solder it for me on a SOIC8-adaptor. With this in (see at the arrow on the picture), the sound is 100% clean again. It blocks also possible noise on the lines that could come from the Arduino.

I noticed that the Arduino can possibly create a lot of noise. At a moment I had the Arduino not earthed at all. This made the Arduino transmit a hell of noise in the preamp, even with the galvanic isolation inbetween. The transistors were at only 200mm from the Arduino at that moment, but it shows it can be a real noise transmitter. Connecting it to the PC (earthing) made the noise disappear completely. It shows for me as well that connecting an Arduino straight to audio will inject noise into the earth. Now I send the noise to the PC which is galvanic isolated from the audio.

I'm happy I will be able to put the preamp at a meter away from Arduino and PC by using the galvanic isolated I2C-bus. Keeping noise at a distance is always better. Also my DAC will be far from the noisy sources. I sleep better now :).
 

Attachments

  • IMG_6990_arrow.JPG
    IMG_6990_arrow.JPG
    379.4 KB · Views: 418
we've had zero issues with the arduino and noise.

I would check your ground design and layout.

we've tested the arduino in our 'a10 preamp' (amb.org) and its at the same level of noise as our test gear (RME firewire box usually used for testing).

you may want to consider ferrites to link grounds if you are not already doing that.

running from computer usb will always be a problem. I use that for debug but never for actual audio use. yes, you will have ground loops with pc's and earth ground vs. usb ground.
 
At the moment I have zero noise, even with the Arduino linked through USB. That's achieved by using galvanic isolation. I keep the Arduino linked to the PC as I use the PC as remote control for the Arduino (for Volume, IO-selection and calibration.
And I only have the noise when the Arduino is not linked to earth at all, which should never be the case. At that moment even the earthplane on the board acts like an antenna. As soon as the Arduino is grounded, the noise disappears completely.
I use ferrites on several places, but as I use galvanic isolation between audio and digital, it's not of major importance. I use them to avoid HF passing through the power supllies. HF is always present on the mains, and I keep it out in several steps (ferrite on mains, filter on mains, ferrites on low voltage).
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.