This circuit may perform something simple ,for example in our case switch an LED on and off, or may be extended to controlled a light affected process such as masking (imprinting onto) a PCB board or and other use you may find for it.
We're going design this simple circuit (Arduino being the major component) and use a simulation tool like Proteus(ISIS) tool simulate it.
The circuit schematic design will also be done using Proteus .
The Arduino Code is fairly simple;just a few lines of code:
const int sensorPin = 0; //LDR sensor will connect hereNext is the circuit:
int solenoidPin = 2;
int rate = analogRead(sensorPin);
When you run this you should see this:
Now a little explanation:
The Arduino reads the Analog input from the LDR and a value of 10(possibly intensity),
When this input value is greater than 10, the LED will go off.
You need the Arduino IDE or Atmel Studio(-with Visual Micro Plugin);
When you build a sketch in Atmel Studio, the .hex file is stord within the "Debug" folder of your sketch. Copy this .hex file in to a directory which you can easily access,double click on your Proteus schematic and select the program file option and navigate to the .hex file directory.
However when using the Arduino IDE the .hex file is stored in %temp% (Temporary folder in your Appdata-Windows users), the remainder of the process remains the same for linking into Proteus.
1N40001,2N2222,ARDUINO UNO,LED,1 Kilo Ohm resistor,10 Kilo Ohm resistor,Torch_LDR,Relay.
Then run it.