Comment Construire un Détecteur de Lumière du Circuit à l'Aide d'un Arduino

In this project, we will go over how to build a light detector circuit using an arduino.

How to Build a Light Detector Circuit Using an Arduino

A light detector circuit is a circuit which can detect the presence or absence of light, depending on how we write our code to respond to the varying light levels. For example, if there is a great deal of light shining on our circuit, we can make anything that we want occur, such as have an LED light up. And we can do the same thing if there is a very low amount of light shining on our circuit. We could also just detect changes in light levels. We can detect a change when something passes in front of a light source, blocking the normal light to our circuit, etc.

For this circuit, we will make an LED light if there is a great amount of light hitting our circuit.

In another circuit, we will write a program for an LED to light when there is a very low amount of light, stimulating a night light.

For this project, the main component we will use is a photoresistor. When we place a photoresistor in series with a resistor, a voltage divider is formed. Voltage will be allocated to the 2 components based on the each one’s respective resistance. More voltage will fall across the component with the greater resistance, according to ohm’s law, V=IR. We will exploit this principle in this circuit to determine the light level that our circuit is exposed to.

Components Needed for the Light Detector Circuit

  • Photoresistor
  • 10KΩ Resistor
  • Arduino

Light Detector Circuit Schematic

The schematic for the light detector circuit is shown below:

How to Build a Light Detector Circuit Using an Arduino

 

Code

The code to turn on an LED when sound is detected is shown below.

//these define the pin connections const int ledPin=13; //the code will flash the LED connected to digital pin 13
const int sensorPin= 0; //Sensor pin connects to analog pin A0

int level; //the variable that will hold the light level reading

const int threshold=800; //this represents the threshold voltage. If voltage is below 800, this triggers the LED to turn on

 

For more detail: Comment Construire un Détecteur de Lumière du Circuit à l'Aide d'un Arduino


A Propos De L'Auteur

Ibrar Ayyub

Je suis expérimenté, rédacteur technique, titulaire d'une Maîtrise en informatique de BZU Multan, Pakistan à l'Université. Avec un arrière-plan couvrant diverses industries, notamment en matière de domotique et de l'ingénierie, j'ai perfectionné mes compétences dans la rédaction claire et concise du contenu. Compétent en tirant parti de l'infographie et des diagrammes, je m'efforce de simplifier des concepts complexes pour les lecteurs. Ma force réside dans une recherche approfondie et de présenter l'information de façon structurée et logique format.

Suivez-Nous:
LinkedinTwitter

Laisser un Commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

fr_FRFrench
Faire défiler vers le Haut