Arduino based LDR volume and source selection controller

I am encountering an issue while Biasing.

I could not dial down Bias below 1.2k on LSE and below 809 on RSE. What could be the problem?

When I replace with fresh LDRs, initially i.e, 1st RUN, i could adjust BIAS around 700k ohm and measured Resistances as explained..

Immediately after this when I try to caliberate its throwing 'Error 10' and after this point, when i try to measure the bias its showing 1.2k or above. I couldnt dial down.

Any one experienced this behavior or any solution you can suggest?

Replacing LDRs is an expensive affair for me so dont want to further experiment with available 2 pieces :)

When I measured Minimum resistance LSE 70.3 ohm, LSH 88.9 ohm, RSE 52.1 ohm, RSH 115.5 ohm

All are bought from element14 and all components are as per BOM no alternate parts used.
 
Last edited:
I have replaced another time the LSE LDR and now could bias to 700k ohm on all LDRs

Now its not caliberating and throwing 'Error 10'..

Am using zdr OLED code.

Any thoughts? suggestions?

See this for a hint :

// Error codes:
// 1 : left series could not be calibrated
// 2 : right series could not be calibrated
// 3 : left shunt could not be calibrated
// 4 : right shunt could not be calibrated
// 10 : left series LDR too low max value. Adjust trimmer RT1
// 11 : right series LDR too low max value. Adjust trimmer RT3
// 12 : left shunt LDR too low max value. Adjust trimmer RT2
// 13 : right shunt LDR too low max value. Adjust trimmer RT4
// 20 : cannot set LDRs or calibration relays. Analog and/or relay power supplies are not connected?
// 30 : configuration error: INPUTCOUNT and OUTPUTCOUNT out of range
 
Just a thought at this point as i have not tried..

There is a SMD version of the same component 5LN01C (SOT-23).

Though pin structure is slightly different, probably we can do little bit of innovation around and solder on other side of board as one of the pins (Drain) might require a jumper while 2 can fit current pads..

This will not compromise on the electrical parameters as they are exactly the same as that of 5LN01SP

Looks like 5LN01C is the way to go, PCB modification is trivial. I ordered few other alternatives to test, but they are also SOT23:

http://www.onsemi.com/pub_link/Collateral/NTA7002N-D.PDF

2.42" OLED might pose a problem however. I cannot find the one I ordered earlier anymore, all that I could find is SSD1309 based. While SSD1309 seems to be supported by U8G library, the operation will be slower than with SSD1306 Ascii, unless I figure something out in the code. There is no SSD1309 Ascii as far as I can see, for the time being at least.

My OLED SSD1309 I2C variant seems to work at least, but only when I press certain point on the PCB with my finger, since I got a dud from ebay seller. It will be a while until I get another.
 
I have the gerber files ready (I'll double check though) fets placed on the bottom layer

Before buying the LDRs I want to ask those who used SR3 ones, is the minimum volume a problematic, i.e. too loud before going to mute ?

Any other problem other than calibration hassle ?

LDR_new_board.jpg
 
Last edited:
Hi,
finally my PCB is soldered, but when I try to upload the code I got an error like this :

D:\Oude PC\Documents\Hobby\arduino\arduino preamp\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:14:26: fatal error: PinChangeInt.h: No such file or directory
#include <PinChangeInt.h>

Where can I find that PinChangeInt.h ?

Regards,
Ronny
 
I have the gerber files ready (I'll double check though) fets placed on the bottom layer

Before buying the LDRs I want to ask those who used SR3 ones, is the minimum volume a problematic, i.e. too loud before going to mute ?

Any other problem other than calibration hassle ?

LDR_new_board.jpg

Apart from calibration hassle, no other issues I could find so far. Both SR2 and SR3 have a volume "bump" though.
 
I am a total newbee in this Arduino thing so please do not slab me too hard ;-)
Sorry for the long post, but I don´t know what is relevant..
I try to compile the source code but get this error message:



Arduino: 1.6.10 (Windows 10), Board: "Arduino Nano, ATmega168"

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:33:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

char* inputName[INPUTCOUNT] = { "DAC IN", "PHONO IN" }; //** each name maximum 9 characters. There must be exactly INPUTCOUNT names in the list.

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:33:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:36:67: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

char* outputName[OUTPUTCOUNT] = { "LINE 1", "LINE 2", "HEADPHONE" }; //** each name maximum 9 characters. There must be exactly OUTPUTCOUNT names in the list.

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:36:67: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:36:67: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'byte doCalibration()':

firmware_LDR_v1.0:401: error: 'setLCDMaxLight' was not declared in this scope

setLCDMaxLight();

^

firmware_LDR_v1.0:422: error: 'printTick' was not declared in this scope

printTick();

^

firmware_LDR_v1.0:636: error: 'printBar' was not declared in this scope

printBar(percent);

^

firmware_LDR_v1.0:885: error: 'printBar' was not declared in this scope

printBar(percent);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setMute(byte)':

firmware_LDR_v1.0:1089: error: 'printTwoNumber' was not declared in this scope

printTwoNumber(VOLCOL, volume);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setInput()':

firmware_LDR_v1.0:1096: error: 'lcd_print' was not declared in this scope

lcd_print(inputName[chan_in], 9);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setOutput()':

firmware_LDR_v1.0:1125: error: 'lcd_print' was not declared in this scope

lcd_print(outputName[chan_out], 9);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setVolume(byte)':

firmware_LDR_v1.0:1568: error: 'printTwoNumber' was not declared in this scope

printTwoNumber(VOLCOL, vol);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setup()':

firmware_LDR_v1.0:1612: error: 'sinMap' was not declared in this scope

analogWrite(PIN_LCDBRI, sinMap(i, 0, LCDBRI_MAX, 0));

^

firmware_LDR_v1.0:1618: error: 'defineCustomChar' was not declared in this scope

defineCustomChar();

^

firmware_LDR_v1.0:1620: error: 'setLCDMaxLight' was not declared in this scope

setLCDMaxLight();

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void loop()':

firmware_LDR_v1.0:1709: error: 'startLCDFadeIn' was not declared in this scope

startLCDFadeIn();

^

firmware_LDR_v1.0:1769: error: 'startLCDFadeIn' was not declared in this scope

startLCDFadeIn();

^

firmware_LDR_v1.0:1835: error: 'startLCDFadeIn' was not declared in this scope

startLCDFadeIn();

^

firmware_LDR_v1.0:1927: error: 'sinMap' was not declared in this scope

LCDcurrentPW = sinMap(mil_delta, 0, TIME_LCDFADEIN * 1000, LCDinitialPW);

^

firmware_LDR_v1.0:1931: error: 'setLCDMaxLight' was not declared in this scope

setLCDMaxLight();

^

firmware_LDR_v1.0:1939: error: 'sinMap' was not declared in this scope

LCDcurrentPW = sinMap(mil_delta, TIME_LCDFADEOUT * 1000, 0, LCDBRI_MIN);

^

firmware_LDR_v1.0:1943: error: 'setLCDMinLight' was not declared in this scope

setLCDMinLight();

^

firmware_LDR_v1.0:1949: error: 'startLCDFadeOut' was not declared in this scope

startLCDFadeOut();

^

Multiple libraries were found for "Adafruit_MCP23008.h"
Used: C:\Users\benedikte\Documents\Arduino\libraries\Adafruit_MCP23008
Not used: C:\Program Files (x86)\Arduino\libraries\Adafruit_MCP23008
Multiple libraries were found for "PinChangeInt.h"
Used: C:\Users\benedikte\Documents\Arduino\libraries\PinChangeInt
Not used: C:\Program Files (x86)\Arduino\libraries\PinChangeInt
exit status 1
'setLCDMaxLight' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 
Koldby,

are you sure your Arduino is ATMega168 ?
Arduino: 1.6.10 (Windows 10), Board: "Arduino Nano, ATmega168"

Check in Arduino "Preferences" where the location is from your libraries, and remove all the others from that other directorie.

Ronny
As far as I can see it doesn't matter which Arduino type there is on my board as it is not when I try to upload the code , but when I try to compile it the errors appear. The board is not even connected to the PC.

If I remove all libraries from both the lib folder in /documents and /programs and only put the libraries from LDR controller in the /programs I get this:



Arduino: 1.6.10 (Windows 10), Board: "Arduino Nano, ATmega168"

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:33:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

char* inputName[INPUTCOUNT] = { "DAC IN", "PHONO IN" }; //** each name maximum 9 characters. There must be exactly INPUTCOUNT names in the list.

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:33:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:36:67: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

char* outputName[OUTPUTCOUNT] = { "LINE 1", "LINE 2", "HEADPHONE" }; //** each name maximum 9 characters. There must be exactly OUTPUTCOUNT names in the list.

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:36:67: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino:36:67: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'byte doCalibration()':

firmware_LDR_v1.0:401: error: 'setLCDMaxLight' was not declared in this scope

setLCDMaxLight();

^

firmware_LDR_v1.0:422: error: 'printTick' was not declared in this scope

printTick();

^

firmware_LDR_v1.0:636: error: 'printBar' was not declared in this scope

printBar(percent);

^

firmware_LDR_v1.0:885: error: 'printBar' was not declared in this scope

printBar(percent);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setMute(byte)':

firmware_LDR_v1.0:1089: error: 'printTwoNumber' was not declared in this scope

printTwoNumber(VOLCOL, volume);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setInput()':

firmware_LDR_v1.0:1096: error: 'lcd_print' was not declared in this scope

lcd_print(inputName[chan_in], 9);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setOutput()':

firmware_LDR_v1.0:1125: error: 'lcd_print' was not declared in this scope

lcd_print(outputName[chan_out], 9);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setVolume(byte)':

firmware_LDR_v1.0:1568: error: 'printTwoNumber' was not declared in this scope

printTwoNumber(VOLCOL, vol);

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void setup()':

firmware_LDR_v1.0:1612: error: 'sinMap' was not declared in this scope

analogWrite(PIN_LCDBRI, sinMap(i, 0, LCDBRI_MAX, 0));

^

firmware_LDR_v1.0:1618: error: 'defineCustomChar' was not declared in this scope

defineCustomChar();

^

firmware_LDR_v1.0:1620: error: 'setLCDMaxLight' was not declared in this scope

setLCDMaxLight();

^

C:\Users\benedikte\AppData\Local\Temp\Temp1_VxD LDR Controller rev1.zip\firmware_LDR_v1.0\firmware_LDR_v1.0.ino: In function 'void loop()':

firmware_LDR_v1.0:1709: error: 'startLCDFadeIn' was not declared in this scope

startLCDFadeIn();

^

firmware_LDR_v1.0:1769: error: 'startLCDFadeIn' was not declared in this scope

startLCDFadeIn();

^

firmware_LDR_v1.0:1835: error: 'startLCDFadeIn' was not declared in this scope

startLCDFadeIn();

^

firmware_LDR_v1.0:1927: error: 'sinMap' was not declared in this scope

LCDcurrentPW = sinMap(mil_delta, 0, TIME_LCDFADEIN * 1000, LCDinitialPW);

^

firmware_LDR_v1.0:1931: error: 'setLCDMaxLight' was not declared in this scope

setLCDMaxLight();

^

firmware_LDR_v1.0:1939: error: 'sinMap' was not declared in this scope

LCDcurrentPW = sinMap(mil_delta, TIME_LCDFADEOUT * 1000, 0, LCDBRI_MIN);

^

firmware_LDR_v1.0:1943: error: 'setLCDMinLight' was not declared in this scope

setLCDMinLight();

^

firmware_LDR_v1.0:1949: error: 'startLCDFadeOut' was not declared in this scope

startLCDFadeOut();

^

Multiple libraries were found for "LDRstruct.h"
Used: C:\Program Files (x86)\Arduino\libraries\VxD_OLED_ADA_ASCII
Not used: C:\Program Files (x86)\Arduino\libraries\LDR_1602_LCD
Not used: C:\Program Files (x86)\Arduino\libraries\LDR_1602_LCD
Not used: C:\Program Files (x86)\Arduino\libraries\LDR_1602_LCD
Not used: C:\Program Files (x86)\Arduino\libraries\LDR_1602_LCD
exit status 1
'setLCDMaxLight' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.



I have the OLED display.
All this makes absolutely no mening to me.
 
koldby, you need to have all three files (screen.ino, firmware_LDR_v1.0.ino, LDRstruct.h) in the same folder named firmware_LDR_v1.0.

The error messages are related to missing functions declared in the screen.ino file. The i2c-address of your display should only matter after code was successfully compiled (i.e. you should not be able to access the display in case the wrong address is used).
 
koldby, you need to have all three files (screen.ino, firmware_LDR_v1.0.ino, LDRstruct.h) in the same folder named firmware_LDR_v1.0.

The error messages are related to missing functions declared in the screen.ino file. The i2c-address of your display should only matter after code was successfully compiled (i.e. you should not be able to access the display in case the wrong address is used).

But I have all the files in the same folder.. Just checked it.
The same holds true for the VxD LDR Controller rev1 folder and diyaudio-ldrcontroller-develop folder. All of them cannot be complied no matter what I do.:confused:
Is it my version of Win 10 that is playing tricks on me? Should I try it on another computer?:(