Light Cup Sensor

The Light Cup Module is a beautiful and versatile component that emits a soft glow of light. It consists of an RGB LED and a light cup that helps diffuse and spread the light, creating an elegant visual effect. In this step-by-step guide, we’ll show you how to set up the Light Cup Module with an Arduino and create projects that add a touch of brilliance to your creations.

Materials Needed:

  1. Arduino board (e.g., Arduino Uno, Arduino Nano)
  2. Light Cup Module (with built-in RGB LED)
  3. Breadboard and jumper wires
  4. USB cable for Arduino
  5. Computer with the Arduino IDE installed (https://www.arduino.cc/en/software)

Step 1: Wiring

Connect the Light Cup Module to the Arduino board as follows:

  • Connect the module’s VCC (Voltage) pin to the 5V pin on the Arduino.
  • Connect the module’s GND (Ground) pin to the GND pin on the Arduino.
  • Connect each of the module’s R (Red), G (Green), and B (Blue) pins to separate digital pins on the Arduino (e.g., R: D3, G: D5, B: D6).

Step 2: Arduino Code

Open the Arduino IDE and create a new sketch. Then, enter the following code:

// Pin numbers for the Light Cup Module (Change these if you used different pins)
const int redPin = 3;
const int greenPin = 5;
const int bluePin = 6;

void setup() {
  pinMode(redPin, OUTPUT); // Set the Red pin as OUTPUT
  pinMode(greenPin, OUTPUT); // Set the Green pin as OUTPUT
  pinMode(bluePin, OUTPUT); // Set the Blue pin as OUTPUT
}

void loop() {
  // Set Light Cup to Red
  setColor(255, 0, 0);
  delay(1000); // Wait for 1 second

  // Set Light Cup to Green
  setColor(0, 255, 0);
  delay(1000); // Wait for 1 second

  // Set Light Cup to Blue
  setColor(0, 0, 255);
  delay(1000); // Wait for 1 second
}

// Function to set Light Cup color
void setColor(int redValue, int greenValue, int blueValue) {
  analogWrite(redPin, redValue);
  analogWrite(greenPin, greenValue);
  analogWrite(bluePin, blueValue);
}

Step 3: Uploading the code

Connect your Arduino board to the computer using the USB cable and select the appropriate board and port from the Arduino IDE. Then, click the “Upload” button to upload the code to the Arduino.

Step 4: Glowing Elegance

Once the code is uploaded successfully, the Light Cup Module will cycle through different colors – red, green, and blue – in an infinite loop, creating an elegant glowing effect.

Step 5: Experiment and Customize

Now that the Light Cup Module is set up and displaying colors, you can experiment with different combinations of RGB values to create your desired hues. Adjust the code to create various lighting effects, color transitions, and patterns.

Congratulations! You’ve successfully set up and used the Light Cup Module with Arduino. This elegant module allows you to add a soft and mesmerizing glow to your Arduino projects, enhancing the aesthetics and ambiance of your creations. Have fun experimenting and incorporating the Light Cup Module into your Arduino projects to illuminate your world with a touch of glowing elegance!

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

or

Log in with your credentials

or    

Forgot your details?

or

Create Account