Skip to main content

Arduinos: Photocell Hardware

Physical Computing, the Internet of Things, Sensors and Servos

Electronic Components


For input, we will use the analog sensor, the photocell. When the amount of light changes, the photocell changes the amount of resistance. Nearly any sensor you can think of will work with the Arduino, and Sparkfun carries many types including: accelerometer, biometrics, capacitive, current, flex/force, gyros, ID, IMU, infrared, light/image, magneto, proximity, radiation, sound, temperature, vernier, and weather. (See sensors)


For output, we will be using a light-emitting diode (LED). The direction of the current through an LED is important, power through the longer lead (+), and grounding of the shorter lead (-). A diode is a type of semiconductor. To learn more about diodes, check out


To reduce the amount of current, we will be using two resistors. Resistors reduce current flow and lower voltage. The amount of resistance provided is color coded. Look at the resistors we have provided you, and use the color chart below to determine resistance. To read more about resistors, check out .

Hardware schematics

In this set up, imagine that we have two circuits. Both start and end at the Arduino. In the first, we take a wire from 5V to the breadboard to provide power. We then use the same row to connect our photocell to send current through it. The second leg of the photocell goes on a separate row. The current then runs from the second leg of the photocell to A0 to send the analog data being collected from the photocell back to the Arduino. The same row needs one leg of the resistor (bidirectional) and the resistor needs to bridge the breadboard to another row that can be grounded. The grounding wire goes from that row on the breadboard back to the Arduino completing circuit (circle) 1. The Arduino now has the data it needs to determine if the light should be on or off. So, for output, we take a wire from the Arduino digital pin 9 to a new row on the breadboard. This provides data and current. On this same row is the long leg (+) of the LED. The LED bridges to another row with the short lead (-). On this row, there should be one leg of the second resistor. The resistor should bridge back to the bottom of the breadboard so that the second leg is being grounded in the same row as the first resistor. (There is more than one correct way to build a circuit. You could separately ground each circuit.)

Fritzing Schematic

Fritzing is a wonderful application that allows for digitally prototyping and creating schematics. The first image above shows the hardware view in the Project View. This was built using the extensive Parts Library, and dragging and dropping the parts in a user-friendly interface. While you first want to have built the circuit in real life, you then want to rebuild the circuit in Fritzing. When the circuit is ready in Breadboard view, you can switch modes to schematic and get the diagram here. This shows the electronic circuit. You can also switch to PCB (printed circuit board) mode and use the Autoroute function to generate a PCB design with copper traces that you can then etch yourself or get printed. You can import your Arduino code in Fritzing and you can also test your circuit. To learn more, check out

University of Florida Home Page

This page uses Google Analytics - (Google Privacy Policy)

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.