Arduino based LDR volume and source selection controller

I have just finished a volume controller.
And it works wonderfully well.

I would like to thank Vincent for sharing this beautiful project.

The LDR replace my audio-gd FUN after my phono preamp.
The sound is more open with good bass and very natural. It's alive, it's very impressive.

Merci Vincent ça sonne vraiment très bien !

Nounouchet
 
I have just finished a volume controller.
And it works wonderfully well.

I would like to thank Vincent for sharing this beautiful project.

The LDR replace my audio-gd FUN after my phono preamp.
The sound is more open with good bass and very natural. It's alive, it's very impressive.

Merci Vincent ça sonne vraiment très bien !

Nounouchet

Enjoy;) Did you notice any volume "bumps" around the middle or anywhere else?
 
Hi Zdr,
my apple silvier remote controller still don't work with your below code... but it's work with original Vincent's code with many stucks.

May I ask again if there someone who got same problems with me and how to solve it?? :)
or ...the way if I want to change the remote controller, how I should modify the code? I can read all remote contrller's IR code through the arduino.

int getIRkey() {

c1 = c2 = c3 = c4 = 0;
duration = 1;
bool repeat = false;

while ((duration = newpulseIn(PIN_REMOTE, HIGH, 15000)) < 2000 && duration != 0)
{
// Wait for start pulse
}
//PRINTLN(duration);

if (duration == 0) // This is an error no start or end of pulse
return (255); // Use 255 as Error

if (duration < 3000) { // This is the repeat
//PRINT("repeat\n");
repeat = true;
}

if (duration < 5000) { // This is the command get the 4 byte
mask = 1;
for (int i = 0; i < 8; i++) { // get 8 bits
if (newpulseIn(PIN_REMOTE, HIGH, 3000) > 1000) // If "1" pulse
c1 |= mask; // Put the "1" in position
mask <<= 1; // shift mask to next bit
}
mask = 1;
for (int i = 0; i < 8; i++) { // get 8 bits
if (newpulseIn(PIN_REMOTE, HIGH, 3000) > 1000) // If "1" pulse
c2 |= mask; // Put the "1" in position
mask <<= 1; // shift mask to next bit
}
mask = 1;
for (int i = 0; i < 8; i++) { // get 8 bits
if (newpulseIn(PIN_REMOTE, HIGH, 3000) > 1000) // If "1" pulse
c3 |= mask; // Put the "1" in position
mask <<= 1; // shift mask to next bit
}

mask = 1;
for (int i = 0; i < 8; i++) { // get 8 bits
if (newpulseIn(PIN_REMOTE, HIGH, 3000) > 1000) // If "1" pulse
c4 |= mask; // Put the "1" in position
mask <<= 1; // shift mask to next bit
}

c3 >>= 1; // Discard the least significant bit

//PRINTLN(c1); PRINTLN(c2); PRINTLN(c3); PRINTLN(c4);

if ((c1 == 238) && (c2 == 135) /*&& c4 == 131*/) { // Only return valid Apple remote codes
// if ((c1 == 0) && (c2 == 255) /*&& c4 == 131*/) { // Only return dodgy Asda subwoofer remote codes
//PRINTLN(c4);
return (c3);
}

if (repeat && (c3 == 2) or repeat && (c3 == 4)) // Only way to verify a repeat from this remote is with the 2 code?
return (0);
}
return (255);
}
#pragma endregion
 
Last edited:
Hi Zdr,
my apple silvier remote controller still don't work with your below code... but it's work with original Vincent's code with many stucks.

May I ask again if there someone who got same problems with me and how to solve it?? :)
or ...the way if I want to change the remote controller, how I should modify the code? I can read all remote contrller's IR code through the arduino.

Can you please also show what code you are using for newPulseIn?
 
Can you please also show what code you are using for newPulseIn?

Hi Wineds,

below is my apple silver remote's code,

2011254915 vol up
2011246723 vol down
2011275395 play/pause
2011283587 menu
2011259011 input up
2011271299 input down


And below is my new remote's code (which I want to replace with)

300816615 vol up
300849255 vol down
21893359 play/pause
300855375 menu
21889279 input up
21897439 input down
 
Here's the replacement according to the On Semi discontinuation notice: VN2222LL-G

ON Device Replacement Device Replacement Device Supplier
FXS04 NCP3218MNR2G ON Semiconductor
FXS03 ADP3211AMNR2G ON Semiconductor
5LP01SP VP2106N3-G Microchip Technology Inc.
5LP01SP-AC VP2106N3-G Microchip Technology Inc.
5LN01SP VN2222LL-G Microchip Technology Inc.
5LN01SP-AC VN2222LL-G Microchip Technology Inc.
 
Just a thought at this point as i have not tried..

There is an 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
 
carefull choosing a replacement

Hello Ken,

The resistors around the mosfet are calculated for this model, so using another type may result in lower precision.
The characteristics we want here is a low Vgs(th).

5LN01SP are available at Mouser, who can ship globally.

Cheers,
Vincent

Yep, mouser doesn't stock them anymore
Same, I was looking into building this attenuator
 
Just a thought at this point as i have not tried..

There is an 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..

Yes, this is better solution.

Also you can use this: Ebay adapter