Preamp Control - Volume, input, mute, remote

Update report. So far I have installed the Arduino IDE and purchased 3 Arduino Nanos, and an Apple remote should be delivered today. I have successfully programmed the Nano and figure out most of the pinout. I have the latest IR Remote code and have to figure out the input pin on the Nano from the IR receiver. The Apple remote uses a NEC protocol so I will use an IR receiver optimized for the NEC code, at a $1.25 each they are cheap to experiment with.
I am bread boarding things now, if the IR works than I can finish the program (called a sketch in Arduino talk) test all. When I reach the NO POP solution I will turn some more Boards. The digital board will change, probably much smaller, and maybe the Display board. For the people that bought the original boards from me I will email a set of updated boards to them at no cost.
Step by Step...
 
Update. I have tested the IR transmitter and receiver circuit, read and verified the codes of the Apple remote. Still need to test the user buttons and verify that section of the code. I went through the schematics and was able to remove ALL of the parts on the digital board and some of the parts on the display board being replaced by the Arduino Nano, which mounts on the back of the Display board. Only one cable will go from the Display board to the Analog board.
Only thing is, the connector for the ribbon cable to the Analog board had to change, mounts where the SIP connector was, theonly change to the Analog board.
The Arduino Nano costs $6.50, this is the Atmel processor which costs around $6 and a PCB, some other parts, built and tested. Amazing.
Same with the Apple type remote, built, tested, slim design, and only $7.50. Very nice.
Will post the new schematics and board layouts once I finish testing.
Making real progress. Have a good one.
 
Sounds great John. I love the original metal Apple remote controls. The slim aluminum case has a wonderful feel. You can sometimes pick them up used on Ebay. The replacement plastic ones work well but are not as slim and don't have that "feel".
20220208_054403.jpg
 
Ok, the design is not completely tested, so subject to change, but if anyone is interested here is the latest proposed schematics for the analog and display boards. Will redo the BOM for this set of boards to get a new cost estimate, also subject to change until fully tested and ready to post new gerbers.
 

Attachments

I spent most of the day today debugging the software and testing hardware, and it is working correctly, finally. I will double check the PCB layouts again tomorrow and order boards. And another order of parts. Once I build up a set of boards I can fine tune the software while listening to a square wave until the pop is gone.
I am changing the relays from the LSB to MSB when turning up and MSB to LSB when turning down the volume, hopefully this method will work first time.
Attached is a copy of the code for anyone with a case of insomnia.
 

Attachments

I ordered boards and parts last night. Can't wait to build it and test with audio. I think the current boards sounds about a good as a volume control can sound, maybe Caddock resistors are better but I don't think I would hear that. No artifacts when not changing volume, just have to get rid of the relay action pop.
10 days to 2 weeks I should know.
 
It’s cool to follow along. I made a portable radio media player a few years ago using an xmega, started with a sparkfun Proto pcb. Iirc I left it at, got the remote control code working for NEC, I even built my own remote. I’ll share the code but it was written in bascom-avr basic compiler
If I have time I’ll look at your design in more detail
I get great service from jcbpcb and DHL ddp, usually one week even during the holidays
Good luck coding 🙂
 
I received PCBs yesterday and since all the control is now on the Display board I stripped the old board of parts and built the new one. I found the Infrared remote functions all worked perfectly. I had to add a 100 millisecond delay on the input select and mute push button control software to smooth it out. I am having a problem with the rotary encoder not working, the decoder output pulses show on the oscilloscope but are too short for the microprocessor to pick up. The Rbias resistor on the decoder can be changed to change the pulse width so I need to locate a 10 megohm resistor on Monday to try.

Since the IR remote works, tomorrow I will build up the analog board and do a listening test for the 127 to 128 transition pop.

If the current rotary encoder design doesn't work then there are a coupe other ways to skin that problem.

Combining software and hardware makes troubleshooting both more frustrating and more satisfying at the same time.
 
  • Like
Reactions: Big Cheese
Got pulled away from the project today, Changing the automatic transmission fluid in the wife's car then saw a neighbor trying to dig post holes in the San Diego Sandstone so hauled my jackhammer over and helped him out. So I only got about half way through stripping the analog board and hope to finish tomorrow after work, a lot of relays to remove and transfer to the new board but getting there quickly.
 
Today I picked up a 10 meg-ohm resistor for testing the output pulse width from the rotary decoder, didn't help, so I will simply remove the rotary decoder chip and test a direct connection from the rotary encoder to the microprocessor and add some code to handle it.

I finished building the analog board and a ribbon cable for it and tested it listening to a 1khz square wave running through it. No delays in the code yet so it is similar to the previous digital logic and it still pops but fainter. Now it can tune the code for relay timing until the pop is completely gone.

Will tweak the Display PCB to move the microprocessor up and the ribbon cable connector down so they can both be pulled in at the same time, they are a little close now and it is a small bit of pain to have to unplug one cable to plug in the other. Once the code is finalized it wouldn't matter as I will not have to plug into the microprocessor after that, but for future use..., and if I am eliminating the decoder chip and turning the revision of the board I might as well.
 
I have breadboarded a similar, but simpler project, in my case as a balanced attenuator in front of an adc for amplifier distortion measurements. In this use I don't actually care about the 'pops' between steps. But, just in case, I change all the relays with one write, this way they should all change at the same time, no intermediate steps, which I think causes the pops. I'm using the Nano digital pins to drive the 8x8 display and to read the rotary control, using the analog pins A0-A5 as digital pins to the relay transistors. I don't use separate vol_up(), vol_down() routings, variable volume is a 6bit number and the code is simple:
PORTC=volume;
Because of the Nano pin assignments and for 8 bit volume control it might be more complicated, but search for Arduino PORTB and PORTD.
As an aside I ordered high quality Omron relays, Vishay resistors, but before committing to PCB layout breadboarded with cheap parts off of Amazon, for my use I see no signal degradation using the cheap parts. A second aside, I do notice noise from the display and turn it off a few seconds after a volume change.
1646870617511.png
 
Yeah, I started with schematic capture then breadboarding then PCB layout. The first design and until now has been digital logic chips which pretty much changes the relays all at once which is like writing a port all bits at once. You still have the mechanical delays of the relay pull-in and release time. I used a relay very similar to the Omron, small signal, gold plated contacts. Cheaper resistors for testing but RN65 or RN70 series Dale/Vishay for the final design sound good, or should I say nothing added to or removed from the sound that I can hear.

With 5 bits you would only have 32 steps so from 60 db to 124 db you would have 2 db per step. My friend who has an audio equipment company had a 64 step solution, 6 bits, about 1 db per step, but had customers asking for 128, 7 bits, about .5 db per step, and 256 steps, 8 bits, about .25 db per step. The problem, which you wouldn't see with 5 bits, happens when you cross from 127 to 128, 7 bits on 1 off, to 8th bit on and 7 bits off. I don't have the tools to figure out why, need a digital logic analyzer and an audio spectrum analyzer, but doesn't matter why, the pop is audible, it doesn't hurt anything but is mildly annoying. Now, with the microprocessor I can control the open and close time of the relays and should be able to eliminate the pop.

My design has the digital all on the display boards and the analog on a separate board with no common grounds or connections so no digital noise invades the audio. The display is very cool as it reads the outputs of the microprocessor 8 pins for the relay controls which addresses into an EEPROM that holds the display data for the seven segment LEDs, which are silent in the audio spectrum. You need three digits to do 7 or 8 bits display so one EEPROM is multiplexed to the three digits.

Anyways, back to debugging the relay delay and rotary decoder code. And I need to post some pics of the new boards. 🙂
Have a good one.
 
I started with a delay between the 7th and 8th relay, anywhere from 1 millisecond to 20 milliseconds and found a 2 millisecond delay when turning up and a 1 millisecond delay when turning down had 99% of the pop gone, this with a 1khz square wave. Listening to that square wave at volume for very long will make you deaf. 🙂
I then put on some regular music and it was great. I will keep experimenting and finalize in a couple days.
In the meantime will work on the code for the rotary encoder.
 
After reading 5 articles on using the rotary encoder with an Arduino Microprocess. I found that all but one did not use interrupts and where missing a lot of possible conditions for how the encoder works. I tried 6 different ways to read the encoder and wasn't happy with the results. So, I sat down last night and wrote a quick sketch which has the two possible conditions to detect if the encoder has moved. Then there are four different starting conditions of the encoder and each of those have a pair of next conditions depending on whether the encoder is turning clockwise or counterclockwise. After typing in the code I found I had to add delays between reads to account for the speed of rotation. I tested for a while and came to a compromise on the delays. As it is now, if you rotate verrrrry slowly it doesn't pick up a second change. Try to turn verrry fast and it doesn't work correctly either, but at the speed that a person would normally turn a knob the encoder works well with a pretty good spread on speed of rotation. With the remote working so well most will probably not use the knob that much.

I am going to test with some code that has interrupts, I prefer not to use interrupts if the task can be done without but I will try it for this case, it has the possibility to read whether rotation is slow or fast.

I am also going to try to add a feature for an encoder with a switch, the current part number has a switch, so it can change the function of the code. I will try to have it step by 4 just rotating the knob, but if you push in and rotate it will step by 1.

Attached is the latest version of the code.
 

Attachments

So not entirely happy with my rotary encoder code, I tried the code by Paul Stoffregen on Arduino.cc. I found that it didn't quite work right on the Arduino Nano and after more reading I found that the Nano only has two interrupts and one is already used for the IR-Remote using the code by Ken Shirriff, also from Arduino.cc. The Encoder code does have a option to use no interrupts. You have to keep the delays to a minimum in the code to use it, but I tried it and it work pretty well, I would say 99% of good.
So attached is the final code.
I will clean up the schematic, BOM (removing the rotary decoder chip, and one ribbon cable and headers instead of two), and the gerbers and post them.
 

Attachments