this post was submitted on 28 Jul 2024
22 points (100.0% liked)

Ask Electronics

3316 readers
2 users here now

For questions about component-level electronic circuits, tools and equipment.

Rules

1: Be nice.

2: Be on-topic (eg: Electronic, not electrical).

3: No commercial stuff, buying, selling or valuations.

4: Be safe.


founded 1 year ago
MODERATORS
 

I'm trying to build a very simple, stupid light switch for my grow light. Essentially, I want to turn on the light, if it gets too dark outside, so that my plants can survive the northern winter.

Since I'm a software guy, my first thought was an ESP32, but that seems excessive.

My current approach would be something like this: https://www.ebay.com/itm/313561010352 In conjunction with a relay, both powered by a USB-PSU.

If the light level is low enough, the logic DO pin should send a signal and that should be enough to trigger a small relay, so that the relay then closes the circuit to switch on the lights.

Is that idea completely stupid? With electronics, I'm usually missing something very obvious.

The lights themselves are already just usb powered and only draw 5W, so that shouldn't be problem.

What I'm concerned with is the actual switching. Is the logic signal "strong" enough to activate a relay? Would simple transistor maybe sufficient?

top 11 comments
sorted by: hot top controversial new old
[–] nilclass@discuss.tchncs.de 6 points 3 months ago (1 children)

It's not completely stupid. One pissible issue: when the light level is around the threshold, slight variations (think: cloud passing by) will cause the relay to switch back and forth quickly. This can be solved with some additional parts (keyword: hysteresis).

I would recommend using a microcontroller, it makes this problem easy to solve, plus you can have more logic to trigger the lights (eg time based).

Another thing is turning off: if it's purely based on light level, you need to make sure the sensor does not "see" any of the LED light, otherwise it thinks the sun is back up

[–] leisesprecher@feddit.org 3 points 3 months ago (1 children)

At least the last problem could probably be solved by simply a simple housing so the sensor "looks" outside - at least I hope so.

[–] litchralee@sh.itjust.works 2 points 3 months ago

If you're looking to do this project without a microcontroller -- it's an exercise that every SW engineer should consider doing at least once -- then the venerable 555 timer may be of aid here:

https://elonics.org/light-sensor-circuit-using-ldr-555-timer-adjustable/

[–] Bell@lemmy.world 4 points 3 months ago* (last edited 3 months ago) (1 children)
[–] leisesprecher@feddit.org 1 points 3 months ago (1 children)

I thought about that as well, but the simple ones seem to have no sensitivity setting, and they are are butt ugly and bulky - not exactly what I want in my room.

[–] Bell@lemmy.world 3 points 3 months ago (1 children)

I think the sensitivity setting is literally a piece of electrical tape over some percentage of the sensor eye

[–] leisesprecher@feddit.org 1 points 3 months ago

That's incredibly fancy.

[–] montar@lemmy.ml 3 points 3 months ago* (last edited 3 months ago) (1 children)

First thing that comes to mind is ye olde cheap opamp and a potentiometer. This aritcle claims hysteresis can be done with a resistor. Opamp output is not meant for relay, but it can control a transistor which in turn can control your relay just fine.

Edit: i've just re-read your post, there's no need for relays if you have low voltage, just get a transistor rated for more than 5V and make sure it wom't overheat.

[–] nilclass@discuss.tchncs.de 1 points 3 months ago (1 children)

there's no need for relays if you have low voltage

That's a good point. Also makes me wonder if those lights will actually make a difference when it comes to plant growth, given the low power.

[–] montar@lemmy.ml 2 points 3 months ago (1 children)

Ppl do it with UV LEDs and they claim it works. I never tested it, i'm dried-a-cactus kind of guy.

[–] nilclass@discuss.tchncs.de 1 points 3 months ago

Growing plants with LEDs certainly works, I'm just wondering if the power of a USB port is enough