Feasability of led dimming

Morning. I’m David, 46 and I have about 40 finches. First time posting. I’m very very new to arduino and to electronics as a whole. I’m not posting codes etc here as I have not got that far yet. Nor am i asking for any ... I’ll may ask for assistance when I get closer to the project assembly. For now though I just have one question: I have googled sunrise / sunset LED dimming, and dimming LEDs over time etc, but all of these seem to use an RTC for absolute time of day timings. I don’t need the LEDs to dim at a certain time by the clock, I need them to dim over a 40 minute period from the time of a button press. Can this be done WITHOUT a real time clock module ? I do have one, though for various reasons I really don’t want to use it.

That was my question. Hereafter comes a brief outline of my project, just in case it’s interesting to anyone, though there is no question in here: My birds fly free throughout the bedroom all day, but are trained to fly into their cage at bed time, this is so that if they get a “night fright” they can’t take flight in panic and fly into a wall or window, injuring or killing themselves. The way that they are trained is that there is an LED strip around the cage door, and when the room is dark they fly to the light, and into the food cage (there are 5 cages end to end, 3 are sleeping and perching cages, one is the dining hall and the other is the bathroom) So phase one of the project is to activate the LED strip around the door based on the darkening of the room at dusk. (Photo sensor) Phase 2, a reed switch on the cage door will turn OFF the door light and turn ON a cage ceiling light (quite dim at its brightest) when the door is closed. Phase 3 the cage ceiling light needs to dim gradually over a 30 or 40 minute timespan in order to let them eat, find a perch and settle down for the night. So that 30-40 minute process would be triggered by the switch activated by the door closing. This is what I want to do without the use of the RTC module if possible. The reason that I don’t want to use the RTC is that eventually I would like to control it all with an AT Tiny 85 in order to put all of the electronics into an aluminium profile in the smallest form factor possible. Obviously the ATtiny85 only has 6 pins I can use: 1) reed switch, 2) door LED strip, 3) photo sensor, 4) ceiling (and maybe back wall) LED strips

As long as the duration doesn't need to be exactly 40 minutes you are fine without the RTC.

Sounds like a cool project!

Yes, you will be fine without an RTC. You technically do have 6 pins on the ATTiny, but not fully and I'd not rely on that path. If you use smart LEDs, it is very possible you can control all of the LED duties with a single pin, just splitting up the sections of LED duties in the code by LED address. Otherwise if you already have the LEDs and they are plain dumb strips, then I think you should consider using multiple ATTiny chips.

If nothing else is going on other than fading the LED, then there's no harm in simply dividing brightness into 40 steps with a minute delay per. It'd be something as simple as 'brightness = brightness - 6' and delay (60000).

You can also look at the DIP14 ATtiny84a which comes with up to 12 IO pin (one of which is reset so hard to use - same for the ATtiny85, 5 normal and one reset).

You'll probably need power drivers for your LED strips as well.

You don't need an RTC, the internal timekeeping is not perfect but within a few percent (and you could measure the error to correct for it by extending/shortening the actual time to get better accuracy), which should be good enough for your application.

Brilliant. Thank you all. I’ll crack on then. I’ll take photos as I go.

The demo Several Things at a Time illustrates the use of millis() to manage timing. It may help with understanding the technique.

Have a look at Using millis() for timing. A beginners guide if you need more explanation.

…R

“Pert As long as the duration doesn't need to be exactly 40 minutes you are fine without the RTC. Sounds like a cool project!” I don’t think the birds would mind too much if it’s put by a new minutes. Thank you, it’s phase one of a three phase smart cage. Phase 2 is a bird selfie booth, a perch on a load cell triggering 3 cameras. Phase 3 is temperature control with heating and cooling.

INTP : I like the idea of the time splitting into one minute increments. That’s exactly the sort of advice I needed. Also multiple ATTinies.

Wvmarle: I’d never heard of one of those. Genius. Thank you. As for power ... that’s part of the learning curve I have set for myself. Mosfets and the like. The LED strip I want to use though is a bog-standard warm white 5v. Playing and experimentation to come. - oh and given that all the answers I have received have been excellent and exactly what I asked - I can surmise, from your signature, that my question wasn’t entirely stupid :)

Robin2 Thank you for the links. Evening reading and playing shall ensue.

Just to clarify- are you the one closing the door manually each night?

Yes. Myself or my fiancée. I wish I could train the birds to do it. Lazy little buggers that they are !

Who knows ... maybe auto closing doors and an RFID bird counter is in the future. Baby steps.