Wiring is simple using the Adafruit Pi Cobblers. Connect the blue right rail to ground and the red left rail to 3.3V. Then connect one side of the photocell to 3.3V and the other side to Pi GPIO #18 (you can use any pin but our example code is for #18). Then connect a 1uF capacitor from #18 to ground. Make sure the negative side of the capacitor (marked with a - down the side if its electrolytic) goes to ground. The capacitor just needs to be rated for 5V or greater, its really unlikely you'll find a 1uF that has less than 16V rating.

Raspberry Pi 20-Pin Wiring (RPI rev. 1 and 2)

Raspberry Pi 40-Pin Wiring (RPI rev. 3 - A+, B+ and Zero)

This guide was first published on Jul 29, 2012. It was last updated on Jul 19, 2024.

This page (Wiring) was last updated on Mar 08, 2024.

Text editor powered by tinymce.