Arduino Light Sensors: How to Measure Light Intensity Using Arduino

게시자

While we can’t touch it, light surrounds us, allowing us to see and go about our daily lives. It also allows crops to grow, keeps us warm and even provides solar energy for an increasing number of rooftops.

If you want to actually measure light intensity, there are a number of ways to do so. I'll outline a couple options here in the context of Arduino usage. Of course, what’s presented here is only the tip of the iceberg, and these concepts could be applied to a wide variety of embedded systems.

LDR Sensor: Light Dependent Resistor

Photoresistors, also known as light-dependent resistors or LDRs, are components that change their resistance to electricity based on the amount of light they receive. They are almost exactly what they sound like: two-terminal devices that resist the flow of electrical current in a circuit, with decreasing resistance based on the amount of light received.

How to Connect an LDR Sensor to Arduino

Arduino boards and the like can’t sense resistance directly, so you’ll need to set up a voltage divider (as shown in the above image). Here the 5V pin from an Arduino Uno is connected to an LDR, while the other leg is connected to A0 and a ~50 ohm resistor. The other leg of this resistor is connected to ground, forming a voltage divider and allowing A0 to sense the relative resistance of each leg. The result is a number that can be correlated to different light levels. Code found here is used to analyze this setup in the Arduino IDE, recycled from this soil moisture sensing post. As with the following phototransistor experiment, you can add in a delay() function to the sketch if the serial monitor is getting too “clogged.”

Easy to implement and very inexpensive, LDRs are the go-to sensing method for many projects. Note that like “normal” resistors, LDRs come in different low- and full-light resistance values. Be sure to consider that when buying/spec’ing these components, as one may work better than another for your application.

Phototransistor Circuit with Arduino

Light Intensity Sensor Image 2

Phototransistors react to light by varying current flow from collector to emitter in the same manner as a normal transistor, but are activated by light instead of an external current input to the base. The collector here is connected to +5V on the Arduino, while the emitter leg is connected to A0, along with ground through a ~50 ohm resistor.

The setup here is nearly identical to the photoresistor arrangement seen earlier, and the same code works here as well. However, expect the values corresponding to different light intensities to be different.

Note that the base leg of the BPV11 component used here is broken out, but it’s not needed in this case and is left unconnected. When connected to a positive 5V, the output will be high, while connecting it to ground gives a low output. Some phototransistors omit this lead altogether as a two-legged version. There may be applications where you’d want to override the component’s light-sensing function, or compensate for certain light levels with the base, so the three-legged version is appropriate in some circumstances.

Photodiode & Arduino

Another option for light detection is the photodiode. One difficulty with Arduino experimentation with this device is that many come as a surface-mount device, such as this VEMD5510CF, requiring rather advanced soldering skills if you don’t have a printed circuit board for it. Others, like the BPW83 component, are through-hole, but are designed to sense light in the infrared spectrum. Still, these components certainly have appropriate use cases, so don’t forget about this option, especially when putting together a circuit for mass production.

Light Sensors & Wavelength: More Considerations

Whatever technology you choose to sense light, it is important to pay attention to the wavelength range to which it responds. 380–740 nanometers is the approximate range that our eyes can see. Others filter out visible light to respond to IR remote controls and the like. Different ranges are useful in their own right, but engineers and designers must be careful to spec’ the correct part to avoid frustration.

There are of course a variety of applications for this type of sensing. One could even use this type of light-detecting hardware to enhance a greenhouse/plant growing setup, such as the Raspberry Pi-based rig seen here.

최신 뉴스

Sorry, your filter selection returned no results.

개인정보 보호정책이 업데이트되었습니다. 잠시 시간을 내어 변경사항을 검토하시기 바랍니다. 동의를 클릭하면 Arrow Electronics 개인정보 보호정책 및 이용 조건에 동의하는 것입니다.

당사의 웹사이트에서는 사용자의 경험 향상과 사이트 개선을 위해 사용자의 기기에 쿠키를 저장합니다. 당사에서 사용하는 쿠키 및 쿠키 비활성화 방법에 대해 자세히 알아보십시오. 쿠키와 추적 기술은 마케팅 목적으로 사용될 수 있습니다. '동의'를 클릭하면 기기에 쿠키를 배치하고 추적 기술을 사용하는 데 동의하는 것입니다. 쿠키 및 추적 기술을 해제하는 방법에 대한 자세한 내용과 지침을 알아보려면 아래의 '자세히 알아보기'를 클릭하십시오. 쿠키 및 추적 기술 수락은 사용자의 자발적 선택이지만, 웹사이트가 제대로 작동하지 않을 수 있으며 사용자와 관련이 적은 광고가 표시될 수 있습니다. Arrow는 사용자의 개인정보를 존중합니다. 여기에서 당사의 개인정보 보호정책을 읽을 수 있습니다.