What Are Snap Circuits?
Snap Circuits® makes learning electronics easy and fun! Learn how to integrate Snap Circuits® with your hardware. Fun for kids!
If you have not completed the introductory project please go to Snap Circuits - Introduction. This project also contains a complete index of Snap Circuit projects.Let's Get Started
Using the Arduino, launch the fan when light is detected.
Building the Circuit
The minimum set requirement for this project is SC-300.
Build the following circuit:
Click the link below to download a PDF containing the circuit diagram and instructions to build it (the PDF file can also be found in the GitHub repository).
Here are images of the components that you will use to build the circuit.
Here are images of the completed circuit.
Loading the Sketch
The attachment below contain the sketch for this project. Click the link below and save this to your computer.
Download Arduino Sketch (you may need to right-click and choose Download or Save Target As)
Load this sketch into the Arduino IDE in the same manner as in the Blinking LED project. After it is loaded compile and run it. The sketch for this project will write output to the serial port so you will need to open the Serial Monitor from the Tools menu (you can press
This project is really two circuits in one. The first circuit monitors the photo resistor. When light is shined directly on the photo resistor the resistance drops significantly which connects the 3V3 pin directly to the D3 and causes D3 to go HIGH. When no light is shined on the photo resistor the resistance is very high and causes D3 to go LOW.
The photo resistor is being used as a switch by connecting it to a digital port. To see how to use it on an analog port see the project Measuring Light.
The second circuit uses a relay to turn a motor connected to a battery on and off. The relay and battery are required because the Arduino cannot push enough current to run the motor on its own. The relay is a switch that is activated by current from another isolated circuit. The relay in this circuit is connected to an Arduino digital port that will activate and deactivate the relay. When the relay is activated, the circuit connecting the battery to the lamp is closed and the motor turns on. When the relay is deactivated the circuit is open and the motor turns off.
The software will monitor the value of pin D3. When the pin is LOW the software ignores it and does nothing. When the pin goes HIGH (light is detected) the software changes a flag to indicate that light was detected and starts the motor. When the light is removed, the software will turn the motor off. This action will cause the fan to launch from the motor.