The shorter header pin goes through the MUX PCB from the bottom of the MUX PCB and then soldered from the component side.
The longer header pin plugs into the solder-less breadboard.
The other option is your header pins may be quite long hence they can plug into the breadboard ‘and’ you can also plug female connector wires from the top side of the PCB.
Yes, it's just one of those interesting principles of electronics that you have to actually connect the parts together, just pointing one part at another does not work.
Had I looked at this thread earlier (but I was asleep ) I do hope I wodul have noticed the obvious problem as it happens so regularly on these forums.
While the photos are pretty good, I just can't determine the values of the resistors. What are they?
You don't need a resistor on every LDR, you just use one resistor on the multiplexer common. And if you connect the LDRs to ground rather than Vcc - 5 V - you can just use the internal pullup on the Arduino by setting pinMode for that pin as INPUT_PULLUP to provide an approximately 47k pullup - if that suits.
The idea of reading each LDR twice is that if the input impedance is very high, the first reading allows the voltage to stabilise after you switch the multiplexer to it, you ignore that first reading and reading it again will give you a more stable value.
Okay thank you so much!!! I soldered and tried again. It seems to work!! I added 4 more ldrs too. Only problem is that the last ldr seems to always give a high value regardless of the light intensity. Could there be any reason for it?
"You don't need a resistor on every LDR, you just use one resistor on the multiplexer common. And if you connect the LDRs to ground rather than Vcc - 5 V - you can just use the internal pullup on the Arduino by setting pinMode for that pin as INPUT_PULLUP to provide an approximately 47k pullup - if that suits.
The idea of reading each LDR twice is that if the input impedance is very high, the first reading allows the voltage to stabilise after you switch the multiplexer to it, you ignore that first reading and reading it again will give you a more stable value."
Okay this is a bit confusing to me haha.. I am sorry, I am very new to electronics and learning as I go. If I use one resistor, which LDR gets it, or is it in the circuit itself?
Just tried 12 ldrs. Here are the serial monitor values and the code below. One screenshot shows the values without any light source vs light source close to channel 0. There are certain channels that show high values regardless.
Also yes can give number if easier. Sorry for asking too many questions :))
const byte sensePin = A0;
void setup()
{
DDRB = 255;
Serial.begin(9600);
}
void loop()
{
int valY [12];
for (byte i = 0; i < 12; i++) {
PORTB = i;
(void)analogRead(sensePin); // discard the first reading
valY [i] = analogRead(sensePin);
}
for (byte i = 0; i < 12; i++) {
Serial.print(F("Channel"));
Serial.print (i);
Serial.print(F(" = "));
Serial.println(valY [i]);
}
Serial.println();
delay(2000);
}
Thanks once again for all the help. I rebuilt the whole thing after checking the volts of each breadboard and finding the exact 10k resistors.
Only problem I'm facing is the channel 7, which shows always 1023. I think my soldering might have been wrong. I reordered the piece to solder again. So I will see if it works today.
Thanks once again.
The values I shared for ldrs were voltages. I misunderstood your question. Sorry.
Also rewrote the code so I can unpack at max msp easily.
//16 channels analog multiplexer
//Pinout
// S0 -> Arduino Digital 8
// S1 -> Arduino Digital 9
// S2 -> Arduino Digital 10
// S3 -> Arduino Digital 11
// E -> Ardunio GND
// Z -> Arduino Analog A0
// VEE/ GND -> Arduino GND
// VCC -> Arduino + 5V
// Y0 to Y15 -> Analog Extended Pins
const byte sensePin = A0;
void setup()
{
DDRB = 255;
Serial.begin(9600);
}
void loop()
{
int valY [12];
for (byte i = 0; i < 12; i++) {
PORTB = i;
(void)analogRead(sensePin); // discard the first reading
valY [i] = analogRead(sensePin);
}
for (byte i = 0; i < 12; i++) {
Serial.print(valY [i]);
Serial.print(" ");
}
Serial.println();
delay(100);
}