INTERFACING LIGHT CUP SENSOR WITH BHARAT -PI
by madhankarthick in Circuits > Sensors
14 Views, 0 Favorites, 0 Comments
INTERFACING LIGHT CUP SENSOR WITH BHARAT -PI
The light cup module is a combination of an LED module and a Tilt switch module. The Mercury ball inside the Tilt switch causes the LED to TURN OFF and TURN ON. The tilt switch consists of a mercury ball. It is sometimes called a mercury opening module .
A tilt switch is a switch that uses mercury as a conductive material to make electrical contact between two leads. A tilt switch consists of a tube inside which a mercury ball is used to make a contact between the lead terminals.
How Light Cup Module Works?
When the tilt switch is placed at the vertical position, the mercury ball falls to the bottom of the tube, as is a good conductor of electricity it generates electrical contact between the lead terminal thus acting as a Closed circuit.
When you change the position of the switch in the horizontal direction the mercury ball which was at the bottom rolls towards the side direction and hence there is no contact between the lead terminal, therefore, it acts as an Open-circuit. The circuitry of the module is such that when the mercury ball is at the bottom of the glass the voltage at the signal pin will be LOW and the led module will be turned OFF. When we roll the mercury ball the voltage at the signal pin will be HIGH and the led module will be turned ON.
LIGHT CUP SENSOR PINOUT
The Magic Light Cup sensor typically has three pins: VCC (power supply), GND (ground), and OUT (signal output). Connect VCC to a 5V power source, GND to ground, and OUT to a digital or analog input pin on a microcontroller. The sensor detects light and outputs a signal on the OUT pin based on the light intensity it detects.
Pin Configuration
G - Ground Pin
+Ve-VCC Pin
S -Signal Pin
L- LED Pin
Specifications
These modules are sold in a pair, with each module consisting of a mercury tilt switch, an LED, a 10kΩ resistor, and 4 male pin headers to facilitate connection of the switch, LED, power, and ground.
Operating Voltage:3.3V ~ 5.5V
Current Consumption: 15mA
Light Sensor Detection Range:500-10000 lux
Microphone Detection Range:50-10000 Hz
Output Signal:Digital (High/Low)
Board Dimensions:1.5cm x 3.6cm [0.6in x 1.4in]
Features
1. Colorful light effects based on ambient light or sound levels
2. Adjustable sensitivity using a potentiometer
3. Low power consumption
4. Easy to integrate with other electronic components
5. Fun and easy to use
Requirements
· Bharat-pi (board)
· Aurdinno-ide
· Light cup sensor
· Led
· Jumper wires
Interfacing Light Cup Sensor With Bharat Pi
The following circuit shows you the connection of the KY-027 Magic Light Cup Module with Bharat Pi Please make the connection carefully
Source Code and Programming
int ledmodule=2;
int tiltmodule=4;
int sensorvalue;
void setup()
{
pinMode(ledmodule,OUTPUT);
pinMode(tiltmodule,INPUT);
Serial.begin(115200);
}
void loop()
{
sensorvalue = digitalRead(tiltmodule);
if (sensorvalue==HIGH)
{
digitalWrite(ledmodule,HIGH);
Serial.println("Rolling");
}
else{
digitalWrite(ledmodule,LOW);
Serial.println("Stable");
}
delay(20);
}
code avilabel at git hub: https://github.com/Madhankarthick/interfacing-light-ccup-sensor-with-bharat-pi/blob/fde6f691b421f76d6e1beae6462ac7582c1faa65/light%20cup.txt
Downloads
Applications
1. DIY electronic projects
2. Music visualizers
3. Mood lighting
4. Home automation
5. Entertainment and gaming
Conclusion
We can see output on the Serial monitor. When the tilt switch is at the stable position, the mercury ball is at the base then the output will be “Stable” and when we make a move to the sensor such that the mercury ball goes away from the base of the tube, then sensor output will be “Rolling”.