Auto Intensity Control of LED using CloudX CloudX

  • img
Project Details

In this project, I will show you how to design and build a simple but effective circuit called Auto Intensity Control of LED using CloudX. Sometimes we forget to turn off the lights and waste electricity and you must have also seen street light turned on in the day. In this circuit we are not only turning On and off lights based on light conditions but also varying the intensity of light according to outside light conditions.Here we have used LDR and PWM concept with CloudX for decreasing or increasing the brightness of the LED automatically.

Basically, PWM refers to Pulse Width Modulation, the output signal via a PWM pin will be an analog signal and acquired as a digital signal from the CloudX. It uses the duty cycle of the digital wave to generate the sequential analog value for the signal. And, that signal is further used to control the brightness of the LED.

 

 

Material Required

CloudX M633

LDR

Resistor ( 100k ohm)

1 watt LED

Connecting wires

Breadboard

 

Circuit Diagram

 

 

Code

#include <CloudX\ADC.h>
#include <CloudX\PWM.h>

int LDRValue; // create a variable for placing a whole number or integer


setup(){
       //setup here
       
            Analog_setting(); // Configure and initialize the CloudX Analog Pins for Use
            PWM1_init(5000); // Configure the CloudX PWM module 1
            PWM1_start(); // Start PWM Module 1 Operation.
            PWM1_duty(0); // Set PWM duty cycle to 0.

 
loop(){
      //Program here
            LDRValue = Analog_read(A0); //read analog signal at A0 and store value in LDRValue
            LDRValue = ((float)LDRValue/1023) * 100; //convert LDRValue?s value to percentage
            PWM1_duty(LDRValue); // Sets PWM duty cycle with the value inside LDRValue
 
        
        }
    }

 

 

Share this with friends