With Schematic

Curt Lewellyn and 3 OthersGeraldo Moran
Seungwoo Byun
Anxuan Xie

   +5V

    |

   Photoresistor

    |

    +---- A0 (Analog Pin on Arduino)

    |

  Resistor (e.g., 10k ohms)

    |

    +---- GND


   +5V

    |

   RGB LED (Common Anode)

    |

    +---- Red Pin   ---- 9 (PWM Pin on Arduino)

    |

    +---- Green Pin ---- 10 (PWM Pin on Arduino)

    |

    +---- Blue Pin  ---- 11 (PWM Pin on Arduino)

    |

   Resistor (e.g., 330 ohms)

    |

    +---- GND


Make sure to connect the components as described in the schematic:

  1. Connect the photoresistor to an analog pin (e.g., A0) on the Arduino, along with a resistor (e.g., 10k ohms) connecting to the ground (GND) pin.

  2. Connect the common anode of the RGB LED to +5V.

  3. Connect each color pin of the RGB LED (Red, Green, Blue) to their respective PWM pins on the Arduino (e.g., 9, 10, 11).

  4. Connect a resistor (e.g., 330 ohms) from each color pin to the ground (GND) of the Arduino.

This schematic assumes a common anode RGB LED. If you have a common cathode RGB LED, you'll need to adjust the connections accordingly.


second code

Seungwoo Byun and 2 OthersGeraldo Moran
Anxuan Xie

const int photoResistorPin = A0; // Analog pin for the photoresistor

const int redPin = 9;            // PWM pin for the red channel of the RGB LED

const int greenPin = 10;          // PWM pin for the green channel of the RGB LED

const int bluePin = 11;           // PWM pin for the blue channel of the RGB LED


void setup() {

  Serial.begin(9600); // Initialize serial communication for debugging

}


void loop() {

  int photoValue = analogRead(photoResistorPin); // Read the analog value from the photoresistor

  Serial.println(photoValue); // Print the photoresistor value for debugging


  // Map the photoresistor value to an RGB color range

  int redValue = map(photoValue, 0, 1023, 0, 255);

  int greenValue = map(photoValue, 0, 1023, 0, 255);

  int blueValue = map(photoValue, 0, 1023, 0, 255);


  analogWrite(redPin, redValue);     // Set the red channel of the RGB LED

  analogWrite(greenPin, greenValue); // Set the green channel of the RGB LED

  analogWrite(bluePin, blueValue);   // Set the blue channel of the RGB LED


  delay(100); // Delay for better readability (adjust as needed)

}

Chat GPT Code

Curt Lewellyn and 3 OthersGeraldo Moran
Seungwoo Byun
Anxuan Xie

const int photoResistorPin = A0; // Analog pin for the photoresistor

const int redPin = 9;            // PWM pin for the red channel of the RGB LED

const int greenPin = 10;          // PWM pin for the green channel of the RGB LED

const int bluePin = 11;           // PWM pin for the blue channel of the RGB LED


void setup() {

  Serial.begin(9600); // Initialize serial communication for debugging

}


void loop() {

  int photoValue = analogRead(photoResistorPin); // Read the analog value from the photoresistor

  Serial.println(photoValue); // Print the photoresistor value for debugging


  // Map the photoresistor value to an RGB color range

  int redValue = map(photoValue, 0, 1023, 0, 255);

  int greenValue = map(photoValue, 0, 1023, 0, 255);

  int blueValue = map(photoValue, 0, 1023, 0, 255);


  analogWrite(redPin, redValue);     // Set the red channel of the RGB LED

  analogWrite(greenPin, greenValue); // Set the green channel of the RGB LED

  analogWrite(bluePin, blueValue);   // Set the blue channel of the RGB LED


  delay(100); // Delay for better readability (adjust as needed)

}

Color Detection using photo resistor

Curt Lewellyn and 3 OthersGeraldo Moran
Seungwoo Byun
Anxuan Xie

https://www.eevblog.com/forum/beginners/colored-led-recognition-with-photoresistor-or-diode/

Mid Review

Seungwoo Byun and 2 OthersGeraldo Moran
Anxuan Xie

Armadillo Backpack

Coolest Backpack ever?

Nathan Byun, William Xie, Geraldo Moran

Mid review

Day 2 Progress - Jan/10/23

Anxuan Xie and 2 OthersGeraldo Moran
Seungwoo Byun

Today, we posted precedents and began working on our actual prototypes. Nathan worked on the camouflage LED lights, while Geraldo and I worked on the actual prototype and posted precedents.

Day 1 Progress - Jan/09/23

Anxuan Xie and 2 OthersGeraldo Moran
Seungwoo Byun

On the first day, we decided what to make for the project. We are creating an armadillo backpack and a camouflaged jersey that will be attached to a color sensor in the backpack. The color of the jersey will change as the background color changes. By the end of the class, we had completed a rough prototype and created a sketch for it.

Arduino model prototype for camo leds

Seungwoo Byun and 2 OthersGeraldo Moran
Anxuan Xie

arduino code(made by chat gpt and mr D)

Seungwoo Byun and 2 OthersGeraldo Moran
Anxuan Xie

const int lightSensorPin = A0;  // Analog pin for the light sensor
const int redPin = 10;          // Digital pin for the red LED of the RGB LED
const int greenPin = 11;        // Digital pin for the green LED of the RGB LED
const int bluePin = 12;         // Digital pin for the blue LED of the RGB LED

void setup() {
  pinMode(lightSensorPin, INPUT);
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);

  Serial.begin(9600);  // Initialize serial communication at 9600 bps
}

void loop() {
  int lightValue = analogRead(lightSensorPin);  // Read the analog value from the light sensor

  // Map the light value to the LED brightness (assuming the sensor values range from 0 to 1023)
  int brightness = map(lightValue, 0, 1023, 0, 255);

  // Set the color of the RGB LED based on the light value
  analogWrite(redPin, brightness);
  analogWrite(greenPin, brightness);
  analogWrite(bluePin, brightness);

  // Display the light sensor reading on the Serial Monitor
  Serial.print("Light Sensor Reading: ");
  Serial.println(lightValue);

  delay(100);  // Optional delay to slow down the changes and make it more visible
}

Precedent no.2

Anxuan Xie and 2 OthersGeraldo Moran
Seungwoo Byun