অপ-অ্যাম্প নাইট লাইট — কোড ছাড়াইOp-Amp Comparator Night Light (LM358)
LDR আর 10 kΩ resistor মিলে supply ভাগ করে inverting input এ দেয়, আর নব non-inverting input এ ট্রিপ লেভেল ঠিক করে। অন্ধকারে sensor এর voltage নবের নিচে নামলে LM358 এর output HIGH হয়ে LED জ্বলে যায় — রাস্তার ল্যাম্পের আসল analogue ব্রেন, একটাও কোড ছাড়া।
The LDR and a 10 kΩ resistor divide the supply down to the inverting input, and the knob sets the trip level on the non-inverting one. When darkness drags the sensor voltage below the knob, the LM358 output swings HIGH and the LED lights — the analogue brain of a street light.
সার্কিট ডায়াগ্রাম · Circuit diagram
যা যা লাগবে · Parts you need
- 1 × Breadboard power supply (3.3 V / 5 V) ব্রেডবোর্ড পাওয়ার সাপ্লাই — ৩.৩ V আর 5 V রেল
- 1 × 9 V battery ৯ V ব্যাটারি
- 1 × Op-amp LM358 (comparator) অপ-অ্যাম্প LM358 (তুলনাকারী)
- 1 × Light sensor (LDR) আলো সেন্সর (LDR)
- 1 × Resistor 10000Ω Resistor
- 1 × Knob (potentiometer) নব (Potentiometer)
- 1 × LED (yellow) LED বাতি
- 1 × Resistor 220Ω Resistor
- 14 × Jumper wires জাম্পার তার
তার লাগানো · Wiring
| 9 V battery + | → | Breadboard power supply (3.3 V / 5 V) DC+ |
| 9 V battery - | → | Breadboard power supply (3.3 V / 5 V) DC- |
| Breadboard power supply (3.3 V / 5 V) V1 | → | Light sensor (LDR) a |
| Light sensor (LDR) b | → | Resistor a |
| Resistor b | → | Breadboard power supply (3.3 V / 5 V) GND |
| Breadboard power supply (3.3 V / 5 V) V1 | → | Op-amp LM358 (comparator) VCC |
| Op-amp LM358 (comparator) GND | → | Breadboard power supply (3.3 V / 5 V) GND |
| Light sensor (LDR) b | → | Op-amp LM358 (comparator) IN1- |
| Breadboard power supply (3.3 V / 5 V) V1 | → | Knob (potentiometer) 1 |
| Knob (potentiometer) 2 | → | Breadboard power supply (3.3 V / 5 V) GND |
| Knob (potentiometer) W | → | Op-amp LM358 (comparator) IN1+ |
| Op-amp LM358 (comparator) OUT1 | → | Resistor a |
| Resistor b | → | LED A |
| LED K | → | Breadboard power supply (3.3 V / 5 V) GND |
Code (Arduino C++)
// No Arduino here! The LDR and the 10k resistor divide the supply down to the
// IN1- pin: bright light means a low LDR resistance and IN1- near 4.5 V,
// darkness means the LDR climbs towards 1M and IN1- falls. The knob feeds a
// trip level to IN1+. The LM358 compares the two: IN1+ higher than IN1- ->
// OUT1 swings HIGH and the LED lights. Daylight keeps the LED off, darkness
// flips it on, and the knob sets exactly how dark it must get. This analogue
// comparison is the brain of real night lights and street lamps — not one
// line of code anywhere.