Timer for LED's

I want to have my Christmas LEDS come on for 6hrs and off for 18hr and repeat. My current idea is a ardunio nano + RTC and use this with a transistor to turn on and off a circuit which s externally powered by 9v

Is that a good approach ? What kind of transistor should I use if so ?

What does that 9 volt "power" supply look like?

What does that 9 volt "power" supply look like?

one 9v battery
It's only powering two small light up snowmen that each worked on 4.5v, so i figured 9v for the two and the ardunio to control them on and off.

Give a proper designation of that battory. Now I guess that is that type used for firealarms. That kind of battory is a voltage source, not any power source. Useless ii my opinion. That battory will not live for a day.

So the snowmen I am powering use 3x1.5V AA's I basically just need to automate the switching on.

What current do the LEDs draw?
A transistor, preferably a logic level MOSFET can be used. The FET connects LED minus to GND.

Sorry don't have the current draw, I need to measure it.

Mostly I just wanted to know if my transistor idea was the correct approach for switching on a circuit.

In general Arduino outputs handle max 20 mA.

I'd not bypass the @Railroader's query into the 9V battery thingy.

Let's say you are using the grand old copper top style 9V battery with a nominal 300Ah (that means the battery can supply 300mA power for one hour) power supply capacity. Now let's say your relay coil, to turn light on and off draws 50mA. You might notice that, from the numbers, the relay wants a lot of power from the 9V battery. So, after prototyping on the breadboard with the USB plugged in the project works wonderfully. Now you let the thing run on battery, soon you are back here with a post. Something like my project works great on the bench but when I let it run on battery, after about 10, just a guess, minutes the relay starts clicking, the lights turn off and on, the MCU reboots...

And Railroader will ask about which kind of 9V battery you are using.... So why not, also, work on that 'run the project on a 9V copper top thingy' problem whiles you got someone interested in making your project do the thing, properly?

ok, I guess I have not thought this one throught at all.

Not sure what a relay coil is also. I don't have many parts, other than my ardunio starter kit and what I have in my garage.
Was just going to use a duracell 9v.and have a similar one with a resistor to power the ardunio.

Just wanted fairy lights that turn on and off, perhaps there is a simple way to recreate that circuit that is in those 50 string packs (6hrs on 18hrs off ) but after searching and searching I can't find a simple way that i understand.

You most likely need a quite beafy power supply with quite some thousands of mAH. Look at power banks!

A relay is one way to turn on and off the xmas lights.


I have an ESP32 controlling the environment of some plants. One of the functions is to turn the sunlamp on at a particular time and turn the sunlamp off at a particular time. The sunlamp runs off mains power. The ESP32, Uno, STM32, Due, and Mega do not ever directly control AC power. A device is used that can operate on lower voltages and control higher voltages. One such device used to control high voltages with low voltage signals is a relay module made to do so.

Internet search 'Arduino relay module.'

There are SSR, Solid State Relays that handles AC mains and can be switched on and off by Arduinos.

Let's say you are using the grand old copper top style 9V battery with a nominal 3mAh (that means the battery can supply .003mA power for one hour) power supply capacity.

Those have a capacity of about 550 mAh. But the point still stands...

You may want to consider the source of time the project will be using.

There is an internal clock source that gives time in millis() or micros() which can be counted for time. This requires no extra power but has its limitations with accuracy.

There are external RTC modules, clocks, that can be set with a time and run great. The extrahardware will draw extra power.

I use an ESP32 that I programmed upon power up to set the internal clock from an internet source,