LDR Pre MkII - LDR volume control and I/O switching

The list of differences between LDR Pre MkII and original VxD LDR volume controller is so long that I thought it might require a new thread, even though LDR Pre MkII is actually a spin-off of amazing VxD from Vincent:

Arduino based LDR volume and source selection controller

1) Instead of Arduino Nano which runs on Atmega328P, LDR Pre is driven by Atmega328PB which can be found on some Chinese Arduino Nano clones. To utilise however the full power of "PB" which has three native 16 bit timers instead of one, Nano clone boards require hardware modification to expose additional pins on "PB", as well as new bootloader which uses serial1 instead of serial0.
2) LDR Pre has native 16-bit "DAC" capability, instead of 8-bit DAC in VxD. This allows smooth volume changes without impedance range switching which was causing volume bumps due to time constants in RC filters at PWM outputs.
3) LDR Pre supports only OLED with SSD1306/SSD1311, no LCDs any more. OLEDs from Aliexpress running on SSD1309 are not supported - I was not able to make them work over I2C.
4) LDR Pre has firmware which stores all the parameters in EEPROM.
5) LDR Pre fw has ability to change all the parameters from user interface, including: load and nominal impedance, screen brightness, screen saver timeout, welcome message, I/O names and LDR min values, max saved volume level, measured 5V voltage, etc.
6) Entire user interface is accessible by a remote or encoder. You can use only one of them or both to access all functions.
7) Backlight pin is now used to control power amp relay
8) Entire board runs on 5V. Built in Nano 5v regulator is not used any more, so less heat on the controller board. OLED now draws current from power supply directly instead from Nano.
9) Power supply is now delivering 4X5V instead of 2X12+8V.
10) There is no feedback code to maintain constant current in LDRs. I found this routine to cause more instability in impedance than environment temp, so I removed it. This allowed more room for additional functions.
11) Since all the parameters are stored in the EEPROM, it's possible to deliver unified, one-size-fits-all precompiled firmware updates without involving Arduino IDE and all the hassles it carries. There is no need to have IDE installed at all to update firmware or change parameters.
12) Calibration routine has been changed and optimized to accommodate 16-bit timers.
13) There is an option in the menu to reset all parameters and names to default values.
14) Firmware is power amp friendly - it can be configured not to save volumes above max value stored in EEPROM. By default this value is 10 (out of 50).
15) Firmware boots into standby mode. Pressing play button on remote for 3 seconds turns on the device and powers up the power amp (if connected). Pressing it again for three seconds puts the device in standby mode again and turns off the power amp stage.
16) Pressing center button on (Apple) remote or encoder for 3 seconds enters the setup menu.
17) There is now a child lock in the firmware, which allows to disable encoder and operate with remote only.
 

Attachments

  • IMG_4928.JPG
    IMG_4928.JPG
    466.5 KB · Views: 4,010
Last edited:
ZDR,
Can you describe the hardware modifications required to the Arduino Nano with Atmega328PB for this project?

-Michael

There are modifications in IDE, in hardware and in bootloader. PB has two 16bit compare registers which overlap with RX/TX lines used in Nano, so I had to redirect serial1 to serial0 Nano pins and use serial1 instead of serial0. Forgive me that I do not remember exactly the pin names or everything I did exactly, it was done few months back. Bootloader had to be modified also to use serial1 for flashing instead of serial0.

Now that most of the parameters are exposed in the user interface, I would expect that most of the people would not care about open source and fiddling with Arduino IDE.
 
Last edited:
Hi zdr,

What about to split the board in two ?
One board with relays and LDRs and maybe with I/O connectors
and the other with Arduino and control stuff and maybe with OLED display.

In this way you have the noisy stuff away from signal.

PCB layout took care of that. Grounds are separated and pierced all over with vias. I usually do not solve problem I cannot see, hear or measure, since it probably does not exist :)

I hate messy wiring between boards, I prefer it like this. It also keeps the cost down.
 
The code actually runs DACs (PWMs) in 12bit resolution, although hardware has native 16-bit compare registers and timers. The reason for this, is that ADCs cannot "see" this resolution, and therefore it's would be a waste of resources - they are still 8-bit, software oversampled to 12-bit. 12-bit gives however a significant increase in precision compared to original 8 bit, eliminating the need for impedance range switching which was causing volume "bumps".
 
The code has been modified to be downstream power amp friendly:

1) Saved volume is capped to max value saved in the parameters, default 25. It cannot happen that device starts up at max volume level, unless you allowed it explicitly in the parameters.
2) Device boots in standby mode - all relays are switched off, LDRs placed in high resistance mode, OLED is showing only three dots. You power up the device by pressing and holding play button on the remote. You put it again in the standby the same way - three seconds press on play button.
 
Last edited:
Volume steps are one thing still not exposed in the user interface, I have doubts about it. In order to do so, I would have to reserve dynamic memory for an array sized for max steps, which is 80 or even 100, even though most of us will use 50 most of the time. After adding full remote control operation in the code, I'm not sure there is still enough room for this in memory.