Attiny85 from mains power


I'm attempting my first proper build, using a attiny85.

My idea is to use a attiny85, a ir receiver and a 4 channel relay module to control some lights.

I need 5v for the relay module and 5v for the tiny. What would anyone recommended to power it from mains 230v UK. My thoughts were a 5v 10w Regulated Switching Power Supply.

Could I power the tiny directly from it, how regulated are they? would some extra components be wise, if so some guidance would be greatly appreciated. Been many years since I did basic electronics at college (electrician) and I'm afraid most of what I learnt has left me :confused:


they work find for me here in the US. simple transformer based power supply. if you want much smaller, look for a cell phone charger.

of course you need to know the power consumption of your circuit to make a proper selection

Directly on to pin8 attiny85 ?

The relay module pulls about 260mA, so a 500mA supply should be fine. The one in the link was the smallest hard wire one I found?

I use 5V phone chargers for mine. Just cut the phone connection part off the end (usually a USB cable nower days anyway!) and find the +ve and GND wire with a multimeter (or even an LED + Resistor if you dont have a multimeter).

The charger should have its own caps and smoothing etc against voltage spikes...but a small value electrolytic across pin 8 (+ve) and 4 (-ve) would not go amiss.

Depending on what you are doing, a pack of 4AAs is another option? I use the attiny's at the moment for environment checking (moisture and heat)...they use about 9uA in watchdog sleep mode, wake up every half an hour and take a measurement...depending on the result, they either turn on a warning LED (flashes for .2 seconds every 2 second WD wake up routine).

So this can run for years off a CR2032 battery...


That did cross my mind. I have one with a usb outlet and a fig8 input. what would you say is small value cap?

Going to be hard wired in a junction box near a light switch. Essentially the other end of a two way lighting circuit.

Tested the code working on my uno and breadboard it but it is to large to fit on a attiny85 :confused: might have to find a plan B

I noticed your other thread.

Anyway, the size of cap doesn't really matter too much...the size of it physically kinda makes you want to use say 0.1 or 1uF just to quell any potential Vspikes.

As with your IR problem...there may be a way around it but you need to provide more detail in the other thread.

That sounds promising. What info do I need to add.

Well, what it is it is meant to be doing...

What remote? How many commands? Is a remote you design yourself not an option?

You can decode raw IR signals with pulsein() like here:

PS. This is the trinket...which is an ATtiny85 at its this library should be fine?

Done that on the other thread. :)