As the sun dips below the horizon and the world transitions from the golden hues of dusk to the cool tones of night, there's something uniquely peaceful about a well-lit garden. The gentle glow of soft lighting not only adds charm but also enhances safety and utility. While solar garden lights are readily available on the market, building your own light-sensitive system from scratch adds a personal touch, especially when you dive into the magic of old-school CMOS logic chips like the CD40107.
In this DIY project, we’ll use the 40107—a dual buffer with open-drain outputs—to create a clever little system that automatically turns on two sets of garden lights in a staggered fashion as night falls. One set will activate during the early evening when light levels are moderately low, and the second will switch on when complete darkness sets in. This design mimics the natural gradual dimming of the day and creates a layered lighting ambiance that feels elegant, intentional, and above all—engineered by you.
Let’s walk through how this dual-phase garden light system comes to life, all centered around the unassuming yet powerful 40107.
Getting to Know the 40107
Before we dig into the physical build, it's important to understand what the 40107 is doing in our setup. The CD40107BE is a dual buffer chip, meaning it has two separate channels that can be used independently. Each channel takes a digital input and provides a digital output, but here's the twist—it has open-drain outputs. This means the output can pull the connected line low but cannot drive it high. That might seem like a limitation, but in reality, it gives us creative control over how and when power flows to the rest of the circuit.
Think of open-drain outputs as gates that only pull things down. To actually get a usable signal out of them, you need a pull-up resistor, or in many cases, something that senses when the gate is "closed" and acts accordingly. In our garden light system, these open-drain outputs give us a smooth way to control transistors, which in turn control higher-power lighting circuits.
The Core Idea: A Dance of Light and Shadow
Our goal is simple but nuanced: two sets of lights that respond to fading light levels. The first phase of lighting will turn on when it’s just starting to get dim—think sunset. These might be softer ambient lights near walkways or plants. The second phase kicks in only when it's nearly or completely dark, adding more illumination or activating brighter lights for visibility and security.
This is where the 40107 comes in. With two independent channels, we can feed it two separate light-detection circuits, each tuned to different levels of brightness. The output of each channel will drive a transistor, which then controls a relay or directly powers a set of LEDs.
Let’s walk through this system, from sunlight to starlight.
Light-Sensing the Analog Way
Since we’re not using microcontrollers or any code, everything here will be good old analog. To detect light levels, we’ll use photoresistors—small components that change resistance depending on the amount of light hitting them. During the day, a photoresistor has low resistance, letting current flow easily. At night, its resistance increases significantly.
Each photoresistor will be part of a voltage divider that provides a digital logic level to the 40107 input. As the sun sets, the voltage at the input changes until it crosses the threshold that the 40107 recognizes as a "low" signal. Because the chip is an inverter with open-drain output, a low input leads to a high-impedance state (inactive), and a high input results in the output being pulled low—allowing us to use that transition to control transistors.
You’ll build two separate sensor circuits, each with its own photoresistor, tuned to different light levels using fixed resistors and trimmer pots. One will trip earlier (first phase), and the other later (second phase).
Controlling the Power: Transistors and Lighting
Now, how do we take that low output from the 40107 and use it to turn on actual lights? That’s where NPN transistors or MOSFETs come in. The open-drain output of the 40107 is perfect for this—it pulls the transistor’s base or gate low, turning it on.
For each phase:
1. The 40107 output connects to a transistor.
2. That transistor drives a relay (for AC lights) or directly powers a DC LED lighting strip.
3. When the photoresistor detects low light, the input to the 40107 changes, the output pulls low, the transistor activates, and voila—light!
Because we’re using open-drain outputs, we also prevent both lighting stages from interfering with one another. Each stage is electrically isolated in terms of control, offering precise switching without the need for complex circuitry.
Building the System Step by Step
Here’s a rundown of the construction approach, avoiding the nitty-gritty of circuit diagrams but offering enough structure to get your hands working.
1. Prepare the Light Sensors
● Use two photoresistors, mounting each one on a small breadboard or PCB.
● Connect each to a resistor and a trimmer pot to form a voltage divider.
● Feed each divider into one of the 40107’s inputs.
● Tune the trimmers while observing the input behavior under different lighting conditions to set when the lights will switch.
2. Wire Up the 40107
● Connect the two sensor outputs to the two inputs of the 40107.
● Add pull-up resistors to each output pin. These help define the output when it’s not actively pulling low.
● The outputs will be wired to the bases of transistors, each paired with a current-limiting resistor.
3. Add Power Transistors and Lights
● For each phase, wire a transistor that can handle the current of your lighting system.
● For low-voltage LED strips, MOSFETs are ideal.
● For AC lights or higher-voltage systems, use a transistor to drive a relay.
● Make sure to include flyback diodes if you’re using relays to prevent voltage spikes from damaging your components.
4. Test During Daylight and Evening
● During full daylight, both sensors should keep the 40107 inputs high, keeping the outputs floating (no light).
● As the sun begins to set, the first photoresistor’s input will drop below the logic threshold, triggering the first output. First set of lights activates.
● Later, the second sensor will follow suit, triggering the second output and lighting up the brighter or broader illumination setup.
Enclosure and Outdoor Readiness
Since this project is meant for a garden, durability matters.
● Use weatherproof enclosures for your electronics.
● Seal holes with silicone to prevent water ingress.
● Mount photoresistors facing upward or slightly angled, and shield them from rain with transparent covers.
● Run your LED strips or lighting through waterproof connectors or conduit if needed.
● Make sure your power supply is robust enough to support the lighting load and is safely housed.
Final Thoughts: Why the 40107 Shines in This Role
Many might wonder why not use a microcontroller for something like this. While that's a valid path, there's a distinct joy in crafting circuits with discrete logic chips. The CD40107BE gives this project a solid foundation with its two independent buffers and open-drain design. It brings just enough logic to the table to make the automation smart, without complicating things.
By using analog light sensors, basic transistors, and the 40107, you create a system that is not only elegant in its simplicity but also deeply satisfying to build and watch in action. As dusk descends and your garden lights gradually wake up in two stages, you’ll know every flicker of light came from your own mind and hands.
This project stands as a great reminder that with the right components—and a bit of patience—you don’t need screens, code, or even advanced math to make your surroundings a little more magical. Sometimes, all it takes is a humble chip, a pair of photoresistors, and a spark of curiosity.
Comments
participate in discussions
Please login ? to participate in the comments
New customer Start here.