You can build a digital computer OR Logic Gate circuit using the Arduino microcontroller and a few electronic components. The green LED turns on when either the pushbutton switch OR the photocell is TRUE. You can easily build the logic circuit using the Fritzing wiring diagram shown in Figure 7-6. You can build this basic digital computer circuit on MakerShield, as shown in Figure 7-1.
Did you notice that the Fritzing wiring diagram looks like the AND Logic Gate circuit. That’s because it is. The cool thing about using an Arduino (or any other computer, really) is that often you can use the same physical circuit and make it do different things, simply by changing the computer code. In this case, either pressing the pushbutton switch OR placing your hand over the photocell will turn on the green LED.
This cool gadget can become an automatic LED night light. If your home loses power because of an electrical storm or the area substation is not operating, this device can function as an automatic light source. The photocell is electrically wired to detect darkness. When night falls (or when the power fails), the signal at pin D4 becomes TRUE, and the Arduino microcontroller turns on the green LED, as in Figure 7-7. Or, if you just want to turn the light on when it isn’t dark out, you can just hit the pushbutton switch. This makes the signal at pin D3 TRUE, which again causes the Arduino microcontroller to turn on the green LED.
Figure 7-6. The Arduino OR Logic Gate Fritzing wiring diagram
Figure 7-7. The LED is on: the photocell is covered with tape
TECH NOTE
The incandescent light bulb is slowly being replaced by LEDs because of their low power consumption and long life.
Leave a Reply