Content on this site may not be resold or reproduced. Copying is strictly prohibited. This post may contain affiliate links. See the Affiliate Disclosure for more information. Use of information on this site is at your own risk. View the Terms of Service.
In this article, I will show you a quick and easy way to attach a light sensor to your robot to follow or avoid light. But first, how will we detect light?
We will be using photoresistors to determine brightness. A photoresistor, or photo cell, is a light detecting resistor (LDR). Photoresistors act just like regular resistors, but they change in response to the amount of light detected.
Table of Contents
Create the Circuit using a Wiring Diagram
The easiest way to use the photoresistor is to connect it to another fixed value resistor in a voltage-divider arrangement. The Voltage Output will drive the Analog Input signal on the Arduino. We can then compare values printed to the serial monitor to determine if it's bright or dark. In this configuration, high values yield a brighter signal, and low values yield a darker signal.
If that's a little confusing for you to understand, no worries, I've outlined each step of the project below. For those of you who are more advanced, and familiar with Arduino, resistors, and I/O, then feel free to wire up your circuit and to skip to Step #2 - Write th…
About Liz Miller
Creator of LearnRobotics.org. Liz is a Robotics Engineer with experience ranging from Robotics Research at UPenn, Teaching at MIT, and Automated Manufacturing Engineering at United Technologies. Liz writes technical tutorials that anyone can follow and provides tips and tricks to help engineers grow their careers. Liz has authored over 100 pieces of unique content on this site. You can support her work here. Learn more about Learn Robotics on our About Us page.
You may also like
Welcome to Learn Robotics!
I’m Liz, a Robotics Engineer, and the creator of Learn Robotics.